diff --git a/packages-ext/telemetry/src/utils/stream-text.ts b/packages-ext/telemetry/src/utils/stream-text.ts index 32a5b19..899239d 100644 --- a/packages-ext/telemetry/src/utils/stream-text.ts +++ b/packages-ext/telemetry/src/utils/stream-text.ts @@ -164,7 +164,6 @@ export const streamText = (options: WithUnknown // https://platform.openai.com/docs/guides/function-calling?api-mode=chat&lang=javascript#streaming for (const toolCall of choice.delta.tool_calls) { const { index } = toolCall - const toolName = toolCall.function.name! if (!tool_calls.at(index)) { tool_calls[index] = { @@ -174,7 +173,7 @@ export const streamText = (options: WithUnknown arguments: toolCall.function.arguments!, }, } - pushEvent({ toolCallId: toolCall.id, toolName, type: 'tool-call-streaming-start' }) + pushEvent({ toolCallId: toolCall.id, toolName: toolCall.function.name!, type: 'tool-call-streaming-start' }) } else { tool_calls[index].function.arguments! += toolCall.function.arguments diff --git a/packages/stream-text/src/index.ts b/packages/stream-text/src/index.ts index fa0cec7..275b4be 100644 --- a/packages/stream-text/src/index.ts +++ b/packages/stream-text/src/index.ts @@ -146,7 +146,6 @@ export const streamText = (options: WithUnknown): StreamTextR // https://platform.openai.com/docs/guides/function-calling?api-mode=chat&lang=javascript#streaming for (const toolCall of choice.delta.tool_calls) { const { index } = toolCall - const toolName = toolCall.function.name! if (!tool_calls.at(index)) { tool_calls[index] = { @@ -156,7 +155,7 @@ export const streamText = (options: WithUnknown): StreamTextR arguments: toolCall.function.arguments!, }, } - pushEvent({ toolCallId: toolCall.id, toolName, type: 'tool-call-streaming-start' }) + pushEvent({ toolCallId: toolCall.id, toolName: toolCall.function.name!, type: 'tool-call-streaming-start' }) } else { tool_calls[index].function.arguments! += toolCall.function.arguments