feat(simulation): support multiple tool calls (#35861)

This commit is contained in:
James Long 2026-07-08 00:35:18 -04:00 committed by GitHub
commit 8d00a51766
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 3 deletions

View file

@ -18,7 +18,13 @@ import { Effect, Queue } from "effect"
export type Item =
| { readonly type: "textDelta"; readonly text: string }
| { readonly type: "reasoningDelta"; readonly text: string }
| { readonly type: "toolCall"; readonly id: string; readonly name: string; readonly input: unknown }
| {
readonly type: "toolCall"
readonly index: number
readonly id: string
readonly name: string
readonly input: unknown
}
| { readonly type: "raw"; readonly chunk: unknown }
export type FinishReason = "stop" | "tool-calls" | "length" | "content-filter"

View file

@ -30,7 +30,11 @@ function chunkOf(item: SimulationLLMExchange.Item): OpenAIChatEvent | unknown {
{
delta: {
tool_calls: [
{ index: 0, id: item.id, function: { name: item.name, arguments: JSON.stringify(item.input) } },
{
index: item.index,
id: item.id,
function: { name: item.name, arguments: JSON.stringify(item.input) },
},
],
},
},