Telegram-Scrapper/ai_test.py
2025-01-28 20:38:33 +05:00

33 lines
794 B
Python

import asyncio
from groq import AsyncGroq
from src.core.settings.base import settings
# Убедитесь, что переменная окружения GROQ_API_KEY установлена
client = AsyncGroq(
api_key=settings.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())