Skip to content

Instantly share code, notes, and snippets.

Proposal 4.1: CallId — Simplified Analysis & Options

Summary

ToolCallContent.CallId and ToolResultContent.CallId are currently required non-null (Throw.IfNull). Not all provider wire types have a natural correlation identifier.

Of 64 tool call/output wire types across 4 providers, 15 lack a natural non-null CallId:

| Provider | Wire Type | Role | Family | Notes |

Tool Output Types -- Cross-Provider Inventory

OpenAI (12 output types)

Resource/ItemParam variants (e.g., FunctionToolCallOutputResource, ApplyPatchToolCallOutputItemParam) are the same shape at different API boundaries -- omitted for simplicity.

Wire Type Role Family In MEAI? Wire output property
FunctionToolCallOutput output function Yes (FunctionResultContent) output (string)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jozkee
jozkee / NewStream.cs
Created December 6, 2022 20:35
Implementation of NewStream with Template Method Pattern
namespace System.IO;
public abstract class NewStream : Stream
{
private bool _disposed;
public sealed override int Read(byte[] buffer, int offset, int count)
{
ValidateBufferArguments(buffer, offset, count);
return Read(buffer.AsSpan(offset, count));
@jozkee
jozkee / Stream2022.cs
Last active November 16, 2022 15:13
Make Stream easier to implement
public abstract class Stream2022 : Stream
{
public sealed override int Read(byte[] buffer, int offset, int count)
=> Read(buffer.AsSpan(offset, count));
public abstract override int Read(Span<byte> buffer);
public sealed override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
=> ReadAsync(buffer.AsMemory(offset, count), cancellationToken).AsTask();
@jozkee
jozkee / net7_rc2_report.md
Created October 18, 2022 05:23
.NET 7 RC2 Report

Legend

  • Statistical Test threshold: 10%, the noise filter: 2 ns
  • Result is conclusion: Slower|Faster|Same|Noise|Unknown. Noise means that the difference was larger than 10% but not 2 ns.
  • Ratio = Base/Diff (the higher the better).
  • Alloc Delta = Allocated bytes diff - Allocated bytes base (the lower the better)

Statistics

Total: 86862

@jozkee
jozkee / TempWorkingDirectory.cs
Created March 17, 2022 17:32
TempWorkingDirectory
public class TempWorkingDirectory
{
string _directory;
public TempWorkingDirectory(string directory)
{
_directory = directory;
}
public void CreateFile(string filepath)
{
@jozkee
jozkee / how-to-use-cose.md
Last active February 9, 2022 00:18
System.Security.Cryptography.Cose how to use
@jozkee
jozkee / preserve_multiple_serializations.cs
Last active January 5, 2021 02:49
preserving references across multiple (de)serialization calls
// Assuming that you have a list of `Employee`s and you have to serialize each one individually
// and you also want to take advantage of the references saved in the `ReferenceHandler`'s resolver.
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ConsoleApp4
{
class Program
@jozkee
jozkee / preserve_with_custom_converter.cs
Created January 5, 2021 02:25
preserving references + custom converters
// Assuming that you wrote a custom converter for `Company` and you don't want to manually serialize the `Supervisor`, which is an `Employee`.
// you want to delegate that to the Serializer and you also want to preserve the references that you have already saved.
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ConsoleApp4
{