Skip to content

Commit 3d1cfd3

Browse files
Merge pull request #1234 from ConstantinChirila/update-http-js-quickstart-280825
Improved the quickstart to work with new 1.16rc4 Echo
2 parents 43edbd4 + a759323 commit 3d1cfd3

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

conversation/javascript/http/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ expected_stdout_lines:
3838
- '== APP - conversation == Output response: What is dapr?'
3939
- '== APP - conversation == Tool calling input sent: What is the weather like in San Francisco in celsius?'
4040
- '== APP - conversation == Output message: What is the weather like in San Francisco in celsius?'
41-
- '== APP - conversation == No tool calls in response'
41+
- '== APP - conversation == Tool calls detected: [{"id":"0","function":{"name":"get_weather","arguments":"location,unit"}}]'
4242
expected_stderr_lines:
4343
output_match_mode: substring
4444
match_order: none
@@ -63,12 +63,12 @@ The terminal console output should look similar to this, where:
6363

6464
- The app then sends an input `What is the weather like in San Francisco in celsius?` to the `echo` Component mock LLM.
6565
- The mock LLM echoes `What is the weather like in San Francisco in celsius?` and calls the `get_weather` tool.
66-
- Since we are using the `echo` Component mock LLM, the tool call is not executed and the LLM returns `No tool calls in response`.
66+
- The echo Component calls the `get_weather` tool and returns the requested weather information.
6767

6868
```text
6969
== APP == Tool calling input sent: What is the weather like in San Francisco in celsius?
7070
== APP == Output message: What is the weather like in San Francisco in celsius?
71-
== APP == No tool calls in response
71+
== APP == Tool calls detected: [{"id":"0","function":{"name":"get_weather","arguments":"location,unit"}}]
7272
```
7373

7474
<!-- END_STEP -->
@@ -107,11 +107,12 @@ The terminal console output should look similar to this, where:
107107
- The mock LLM echoes `What is dapr?`.
108108
- The app then sends an input `What is the weather like in San Francisco in celsius?` to the `echo` Component mock LLM.
109109
- The mock LLM echoes `What is the weather like in San Francisco in celsius?`
110+
- The echo Component returns the information from the `get_weather` tool call.
110111

111112
```text
112113
== APP - conversation == Conversation input sent: What is dapr?
113114
== APP - conversation == Output response: What is dapr?
114115
== APP - conversation == Tool calling input sent: What is the weather like in San Francisco in celsius?
115116
== APP - conversation == Output message: What is the weather like in San Francisco in celsius?
116-
== APP - conversation == No tool calls in response
117+
== APP == Tool calls detected: [{"id":"0","function":{"name":"get_weather","arguments":"location,unit"}}]
117118
```

conversation/javascript/http/conversation/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ async function main() {
114114
const result = data?.outputs?.[0]?.choices?.[0]?.message?.content;
115115
console.log("Output message:", result);
116116

117-
if (data?.outputs?.[1]?.choices?.[0]?.message?.toolCalls) {
117+
if (data?.outputs?.[0]?.choices?.[0]?.message?.toolCalls) {
118118
console.log(
119-
"Output message:",
120-
JSON.stringify(data.outputs[1].choices[0].message?.toolCalls, null, 2)
119+
"Tool calls detected:",
120+
JSON.stringify(data.outputs[0].choices[0].message?.toolCalls)
121121
);
122122
} else {
123123
console.log("No tool calls in response");

0 commit comments

Comments
 (0)