|
8 | 8 | * 3. Results sent back to the model |
9 | 9 | * 4. Process repeats until no more tool calls (up to maxToolRounds) |
10 | 10 | * |
11 | | - * The API is simple: just call getResponse() with tools, and await the result. |
| 11 | + * The API is simple: just call callModel() with tools, and await the result. |
12 | 12 | * Tools are executed transparently before getMessage() or getText() returns! |
13 | 13 | * |
14 | 14 | * maxToolRounds can be: |
@@ -63,7 +63,7 @@ async function basicToolExample() { |
63 | 63 | }, |
64 | 64 | }; |
65 | 65 |
|
66 | | - const response = client.getResponse({ |
| 66 | + const response = client.callModel({ |
67 | 67 | model: "openai/gpt-4o", |
68 | 68 | input: "What's the weather like in San Francisco?", |
69 | 69 | tools: [weatherTool], |
@@ -140,7 +140,7 @@ async function generatorToolExample() { |
140 | 140 | }, |
141 | 141 | }; |
142 | 142 |
|
143 | | - const response = client.getResponse({ |
| 143 | + const response = client.callModel({ |
144 | 144 | model: "openai/gpt-4o", |
145 | 145 | input: "Process this data: hello world", |
146 | 146 | tools: [processingTool], |
@@ -183,7 +183,7 @@ async function manualToolExample() { |
183 | 183 | }, |
184 | 184 | }; |
185 | 185 |
|
186 | | - const response = client.getResponse({ |
| 186 | + const response = client.callModel({ |
187 | 187 | model: "openai/gpt-4o", |
188 | 188 | input: "What is 25 * 4 + 10?", |
189 | 189 | tools: [calculatorTool], |
@@ -245,7 +245,7 @@ async function streamingToolCallsExample() { |
245 | 245 | }, |
246 | 246 | }; |
247 | 247 |
|
248 | | - const response = client.getResponse({ |
| 248 | + const response = client.callModel({ |
249 | 249 | model: "openai/gpt-4o", |
250 | 250 | input: "Search for information about TypeScript", |
251 | 251 | tools: [searchTool], |
@@ -311,7 +311,7 @@ async function multipleToolsExample() { |
311 | 311 | }, |
312 | 312 | ]; |
313 | 313 |
|
314 | | - const response = client.getResponse({ |
| 314 | + const response = client.callModel({ |
315 | 315 | model: "openai/gpt-4o", |
316 | 316 | input: "What time is it and what's the weather in New York?", |
317 | 317 | tools, |
|
0 commit comments