"""Debug CLI: `python -m app.llm.cli 'вопрос'` — one completion with the configured provider.""" import asyncio import sys from app.config import LLMSettings from app.llm.factory import make_provider from app.llm.provider import ChatMessage async def ask(question: str) -> None: settings = LLMSettings() provider = make_provider(settings) try: result = await provider.complete([ChatMessage("user", question)]) finally: await provider.aclose() print(f"[{settings.provider} {settings.model or '-'}] tokens={result.tokens}\n{result.text}") def main() -> None: if len(sys.argv) < 2: sys.exit("usage: python -m app.llm.cli 'question'") asyncio.run(ask(" ".join(sys.argv[1:]))) if __name__ == "__main__": main()