File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
examples/nodejs/examples/pipes Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -45,11 +45,12 @@ async function main() {
4545
4646 const [ streamForResponse , streamForToolCall ] = response . stream . tee ( ) ;
4747
48- const tools = await getToolsFromRunStream ( streamForToolCall ) ;
48+ const toolCalls = await getToolsFromRunStream ( streamForToolCall ) ;
49+ const hasToolCalls = toolCalls . length > 0 ;
4950
50- if ( tools . length ) {
51+ if ( hasToolCalls ) {
5152 // handle the tool calls
52- console . log ( 'Tools:' , tools ) ;
53+ console . log ( 'Tools:' , toolCalls ) ;
5354 } else {
5455 // handle the response stream
5556 }
Original file line number Diff line number Diff line change @@ -43,11 +43,12 @@ async function main() {
4343 ] ,
4444 } ) ;
4545
46- const tools = await getToolsFromRun ( response ) ;
46+ const toolCalls = await getToolsFromRun ( response ) ;
47+ const hasToolCalls = toolCalls . length > 0 ;
4748
48- if ( tools . length ) {
49+ if ( hasToolCalls ) {
4950 // handle the tool calls
50- console . log ( 'Tools:' , tools ) ;
51+ console . log ( 'Tools:' , toolCalls ) ;
5152 } else {
5253 // handle the response
5354 console . log ( 'Response:' , response ) ;
You can’t perform that action at this time.
0 commit comments