@@ -38,20 +38,22 @@ as a string.
38
38
client .chat .completions .runTools ({
39
39
model: ' gpt-3.5-turbo' ,
40
40
messages: [{ role: ' user' , content: ' How is the weather this week?' }],
41
- tools: [{
42
- type: ' function' ,
43
- function: {
44
- function: getWeather as (args : { location: string , time: Date }) => any ,
45
- parse: parseFunction as (args : strings ) => { location: string , time: Date },
46
- parameters: {
47
- type: ' object' ,
48
- properties: {
49
- location: { type: ' string' },
50
- time: { type: ' string' , format: ' date-time' },
41
+ tools: [
42
+ {
43
+ type: ' function' ,
44
+ function: {
45
+ function: getWeather as (args : { location: string ; time: Date }) => any ,
46
+ parse: parseFunction as (args : strings ) => { location: string ; time: Date },
47
+ parameters: {
48
+ type: ' object' ,
49
+ properties: {
50
+ location: { type: ' string' },
51
+ time: { type: ' string' , format: ' date-time' },
52
+ },
51
53
},
52
54
},
53
- }
54
- } ],
55
+ },
56
+ ],
55
57
});
56
58
` ` `
57
59
@@ -236,7 +238,6 @@ async function main() {
236
238
main ();
237
239
` ` `
238
240
239
-
240
241
### Integrate with ` zod `
241
242
242
243
[ ` zod ` ](https://www.npmjs.com/package/zod) is a schema validation library which can help with validating the
@@ -261,8 +262,8 @@ async function main() {
261
262
function: getWeather ,
262
263
parse: GetWeatherParameters .parse ,
263
264
parameters: zodToJsonSchema (GetWeatherParameters ),
264
- }
265
- }
265
+ },
266
+ },
266
267
],
267
268
})
268
269
.on (' message' , (message ) => console .log (message ));
@@ -293,4 +294,3 @@ See an example of a Next.JS integration here [`examples/stream-to-client-next.ts
293
294
### Proxy Streaming to a Browser
294
295
295
296
See an example of using express to stream to a browser here [`examples/stream-to-client-express.ts`](examples /stream -to -client -express.ts).
296
-
0 commit comments