Skip to content

Commit 33a174c

Browse files
use typeguard
1 parent c5d243c commit 33a174c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib/tool-orchestrator.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type * as models from '../models/index.js';
22
import type { APITool, Tool, ToolExecutionResult } from './tool-types.js';
33

44
import { extractToolCallsFromResponse, responseHasToolCalls } from './stream-transformers.js';
5+
import { isFunctionCallOutputItem } from './stream-type-guards.js';
56
import { executeTool, findToolByName } from './tool-executor.js';
67
import { hasExecuteFunction } from './tool-types.js';
78
import { buildTurnContext } from './turn-context.js';
@@ -105,7 +106,7 @@ export async function executeToolLoop(
105106
// Find the raw tool call from the response output
106107
const rawToolCall = currentResponse.output.find(
107108
(item): item is models.ResponsesOutputItemFunctionCall =>
108-
'type' in item && item.type === 'function_call' && item.callId === toolCall.id
109+
isFunctionCallOutputItem(item) && item.callId === toolCall.id,
109110
);
110111

111112
if (!rawToolCall) {

0 commit comments

Comments
 (0)