Skip to content

Commit

Permalink
docs(helpers): make async client usage more clear
Browse files Browse the repository at this point in the history
closes #1639
  • Loading branch information
RobertCraigie committed Aug 12, 2024
1 parent 153e4a4 commit 34e1edf
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 34e1edf

Please sign in to comment.