22 lines
467 B
Python
22 lines
467 B
Python
import asyncio
|
|
|
|
from anthropic import AsyncAnthropic
|
|
|
|
from agent.config import settings
|
|
|
|
client = AsyncAnthropic(api_key=settings.anthropic_api_key)
|
|
|
|
|
|
async def run_turn(user_message: str) -> str:
|
|
message = await client.messages.create(
|
|
model=settings.model,
|
|
max_tokens=settings.max_tokens,
|
|
messages=[
|
|
{
|
|
"role": "user",
|
|
"content": user_message,
|
|
}
|
|
],
|
|
)
|
|
return message
|