Telegram-Scrapper/ai_test.py
2025-01-28 01:30:53 +05:00

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())