Files
kira/backend/services/llm.py
T
hobokenchicken 97424cb98f init: Kira — AI body double with Honcho memory
Full voice pipeline (Whisper STT -> DeepSeek LLM -> OpenAI TTS),
animated SVG avatar (Live2D-ready), girly-pop UI, lofi music,
timer/notes/pets/wardrobe widgets, 10 background scenes with
particle effects, Honcho cross-session memory.
2026-06-04 10:51:38 -04:00

31 lines
844 B
Python

"""LLM service — DeepSeek API"""
import logging
from openai import AsyncOpenAI
from config import settings
logger = logging.getLogger("kira.llm")
def _get_client() -> AsyncOpenAI:
return AsyncOpenAI(
api_key=settings.deepseek_api_key,
base_url=settings.deepseek_base_url,
)
async def get_kira_response(messages: list[dict]) -> str:
"""Get Kira's response from the LLM."""
try:
client = _get_client()
resp = await client.chat.completions.create(
model=settings.deepseek_model,
messages=messages,
max_tokens=300,
temperature=0.7,
)
return resp.choices[0].message.content or "Mhm, I'm here!"
except Exception as e:
logger.error(f"LLM error: {e}")
return "I'm still here with you! Could you say that again?"