Skip to content

Commit

Permalink
docs(helpers): make async client usage more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertCraigie authored and megamanics committed Aug 14, 2024
1 parent ae9c905 commit 0d3ddba
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ It also supports all aforementioned [parsing helpers](#parsing-helpers).
Unlike `.create(stream=True)`, the `.stream()` method requires usage within a context manager to prevent accidental leakage of the response:

```py
from openai import AsyncOpenAI

client = AsyncOpenAI()

async with client.beta.chat.completions.stream(
model='gpt-4o-2024-08-06',
messages=[...],
Expand Down

0 comments on commit 0d3ddba

Please sign in to comment.