clean: archive legacy stt/tts/llm services; update ARCHITECTURE.md + README.md to current stack (REST gpt-4o-transcribe, nano, sage, Honcho, incremental TTS, white noise)
Per PLAN item 6. Legacy files moved to archive/legacy-pipeline/.
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
"""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?"
|
||||
@@ -1,27 +0,0 @@
|
||||
"""Speech-to-text via OpenAI Whisper API"""
|
||||
|
||||
import logging
|
||||
from openai import AsyncOpenAI
|
||||
from config import settings
|
||||
|
||||
logger = logging.getLogger("kira.stt")
|
||||
|
||||
|
||||
def _get_client() -> AsyncOpenAI:
|
||||
return AsyncOpenAI(api_key=settings.openai_api_key)
|
||||
|
||||
|
||||
async def transcribe_audio(audio_bytes: bytes) -> str | None:
|
||||
"""Transcribe audio bytes to text using Whisper API."""
|
||||
try:
|
||||
client = _get_client()
|
||||
transcript = await client.audio.transcriptions.create(
|
||||
model="whisper-1",
|
||||
file=("audio.webm", audio_bytes, "audio/webm"),
|
||||
language="en",
|
||||
response_format="text",
|
||||
)
|
||||
return transcript.strip() if transcript and transcript.strip() else None
|
||||
except Exception as e:
|
||||
logger.error(f"STT error: {e}")
|
||||
return None
|
||||
@@ -1,31 +0,0 @@
|
||||
"""Text-to-speech via OpenAI TTS API"""
|
||||
|
||||
import logging
|
||||
from openai import AsyncOpenAI
|
||||
from config import settings
|
||||
|
||||
logger = logging.getLogger("kira.tts")
|
||||
|
||||
|
||||
def _get_client() -> AsyncOpenAI:
|
||||
return AsyncOpenAI(api_key=settings.openai_api_key)
|
||||
|
||||
|
||||
async def synthesize_speech(text: str, voice: str = "nova") -> bytes:
|
||||
"""Synthesize text to speech audio bytes.
|
||||
|
||||
Voices available: alloy, echo, fable, nova, shimmer
|
||||
Nova is the warmest female voice — fits Kira's personality.
|
||||
"""
|
||||
try:
|
||||
client = _get_client()
|
||||
resp = await client.audio.speech.create(
|
||||
model="tts-1",
|
||||
voice=voice,
|
||||
input=text,
|
||||
response_format="opus",
|
||||
)
|
||||
return resp.content
|
||||
except Exception as e:
|
||||
logger.error(f"TTS error: {e}")
|
||||
return b""
|
||||
Reference in New Issue
Block a user