22 lines
560 B
Python
22 lines
560 B
Python
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_ai(messages: list):
|
|
chat_completion = await client.chat.completions.create(
|
|
messages=messages,
|
|
model="llama-3.3-70b-versatile",
|
|
temperature=2,
|
|
)
|
|
|
|
print(chat_completion.choices[0].message.content)
|
|
|
|
# if __name__ == "__main__":
|
|
# asyncio.run(create_request()) |