Skip to content

Commit d5d3818

Browse files
committed
more readme work
1 parent 3f96a58 commit d5d3818

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ await client.files.create({
126126

127127
## Streaming Helpers
128128

129+
The SDK makes it easy to stream responses, by providing an emitter helper via `.stream()`:
130+
129131
```ts
130132
import OpenAI from 'openai';
131133

@@ -154,6 +156,10 @@ async function main() {
154156
main();
155157
```
156158

159+
With `.stream()` you get event handlers, accumulation, and an async iterable.
160+
161+
Alternatively, you can use `client.chat.completions({ ..., stream: true })` which only returns an async iterable of the events in the stream and thus uses less memory (it does not build up a final message object for you).
162+
157163
## Tool Helpers
158164

159165
The SDK makes it easy to create and run [function tools with the chats API](https://platform.openai.com/docs/guides/function-calling). You can use Zod schemas or direct JSON schemas to describe the shape of tool input, and then you can run the tools using the `client.beta.messages.toolRunner` method. This method will automatically handle passing the inputs generated by the model into your tools and providing the results back to the model.

helpers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ See an example of streaming helpers in action in [`examples/stream.ts`](examples
304304
305305
### Automated function calls via Beta Tool Runner
306306
307-
We now offer an easier to use tool calling approach via the `openai.beta.chat.completions.toolRunner({…})` helper. The SDK provides helper functions to create runnable tools that can be automatically invoked by the .toolRunner() method. These helpers simplify tool creation with JSON Schema or Zod validation.
307+
The SDK provides a convenient Beta Tool Runner at `openai.beta.chat.completions.toolRunner({…})` that simplifies [function tool calling](https://platform.openai.com/docs/guides/function-calling). This helper allows you to define functions with their associated schemas, and the SDK will automatically invoke them as the AI requests and validate the parameters for you.
308308
309309
#### Usage
310310

0 commit comments

Comments
 (0)