Skip to content

Commit a34babd

Browse files
committed
👌 IMPROVE: Example
1 parent a51eb90 commit a34babd

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

examples/nodejs/examples/pipes/pipe.tool.stream.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff 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
}

examples/nodejs/examples/pipes/pipe.tool.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)