gpt4free/etc/examples/text_completions_demo_async.py
kqlio67 e0f5e83729
Update docs/. etc/. g4f/. README.md (#2515)
Co-authored-by: kqlio67 <>
2024-12-28 20:11:48 +01:00

17 lines
452 B
Python
Executable file

import asyncio
from g4f.client import AsyncClient
async def main():
client = AsyncClient()
response = await client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "how does a court case get to the Supreme Court?"}
]
)
print(response.choices[0].message.content)
asyncio.run(main())