Skip to content

Commit b6800d4

Browse files
docs(readme): mention .withResponse() for streaming request ID (#1202)
1 parent 6c25833 commit b6800d4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,18 @@ const completion = await client.chat.completions.create({ messages: [{ role: 'us
377377
console.log(completion._request_id) // req_123
378378
```
379379

380+
You can also access the Request ID using the `.withResponse()` method:
381+
382+
```ts
383+
const { data: stream, request_id } = await openai.chat.completions
384+
.create({
385+
model: 'gpt-4',
386+
messages: [{ role: 'user', content: 'Say this is a test' }],
387+
stream: true,
388+
})
389+
.withResponse();
390+
```
391+
380392
## Microsoft Azure OpenAI
381393

382394
To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI`

0 commit comments

Comments
 (0)