We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 790df76 commit dfe1c8dCopy full SHA for dfe1c8d
README.md
@@ -108,14 +108,17 @@ from openai import AsyncOpenAI
108
109
client = AsyncOpenAI()
110
111
-stream = await client.chat.completions.create(
112
- model="gpt-4",
113
- messages=[{"role": "user", "content": "Say this is a test"}],
114
- stream=True,
115
-)
116
-async for chunk in stream:
117
- if chunk.choices[0].delta.content is not None:
118
- print(chunk.choices[0].delta.content)
+async def main():
+ stream = await client.chat.completions.create(
+ model="gpt-4",
+ messages=[{"role": "user", "content": "Say this is a test"}],
+ stream=True,
+ )
+ async for chunk in stream:
+ if chunk.choices[0].delta.content is not None:
119
+ print(chunk.choices[0].delta.content)
120
+
121
+asyncio.run(main())
122
```
123
124
## Module-level client
0 commit comments