30 lines
743 B
Python
30 lines
743 B
Python
import asyncio
|
|
|
|
from groq import AsyncGroq
|
|
# Убедитесь, что переменная окружения GROQ_API_KEY установлена
|
|
|
|
|
|
client = AsyncGroq(
|
|
api_key=GROQ_API_KEY,
|
|
)
|
|
|
|
|
|
async def create_request():
|
|
chat_completion = await client.chat.completions.create(
|
|
messages=[
|
|
{
|
|
"role": "system",
|
|
"content": " you are a helpful assistant."
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "Explain the importance of fast language models",
|
|
}
|
|
],
|
|
model="llama-3.3-70b-versatile",
|
|
)
|
|
|
|
print(chat_completion.choices[0].message.content)
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(create_request()) |