Skip to content

Commit d3fa4ec

Browse files
committed
chore(internal): add internal helpers & improve build scripts (#643)
1 parent b6e7177 commit d3fa4ec

File tree

14 files changed

+41
-21
lines changed

14 files changed

+41
-21
lines changed

ecosystem-tests/bun/bun.lockb

365 Bytes
Binary file not shown.

ecosystem-tests/bun/sample1.mp3

88.7 KB
Binary file not shown.
88.7 KB
Binary file not shown.
88.7 KB
Binary file not shown.
88.7 KB
Binary file not shown.
88.7 KB
Binary file not shown.
88.7 KB
Binary file not shown.
88.7 KB
Binary file not shown.
88.7 KB
Binary file not shown.

helpers.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,22 @@ as a string.
3838
client.chat.completions.runTools({
3939
model: 'gpt-3.5-turbo',
4040
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+
},
5153
},
5254
},
53-
}
54-
}],
55+
},
56+
],
5557
});
5658
```
5759
@@ -236,7 +238,6 @@ async function main() {
236238
main();
237239
```
238240
239-
240241
### Integrate with `zod`
241242
242243
[`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() {
261262
function: getWeather,
262263
parse: GetWeatherParameters.parse,
263264
parameters: zodToJsonSchema(GetWeatherParameters),
264-
}
265-
}
265+
},
266+
},
266267
],
267268
})
268269
.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
293294
### Proxy Streaming to a Browser
294295

295296
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

Comments
 (0)