Monish BV
Add kiosk-api: stripped backend for speech integration
c2b7a7b
"""Debug provider that echoes prompts for offline development."""
from __future__ import annotations
import time
from typing import Iterable, List
from .base import BaseLLM, ChatMessage, LLMResponse, ProviderConfig
class EchoProvider(BaseLLM):
"""Development-only provider that echoes the latest user message."""
def __init__(self, config: ProviderConfig) -> None:
self.config = config
@classmethod
def describe(cls) -> dict:
return {"name": "echo", "supports_tools": False}
def format_messages(self, messages: Iterable[ChatMessage]) -> List[ChatMessage]:
return list(messages)
def generate(self, messages: Iterable[ChatMessage]) -> LLMResponse:
history = list(messages)
text = history[-1]["content"] if history else ""
timestamp = time.time()
response_text = f"[echo @ {timestamp:.0f}] {text}"
return LLMResponse(
text=response_text,
prompt_tokens=len(history),
response_tokens=len(response_text.split()),
)