Spaces:
Paused
Paused
Download scratch/debug_llm.py from 3SCError404/miracle: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/spaces/3SCError404/miracle/resolve/main/scratch/debug_llm.py
- Command line
-
hf download hf://spaces/3SCError404/miracle/scratch/debug_llm.py
-
curl -L -o debug_llm.py https://huggingface.co/spaces/3SCError404/miracle/resolve/main/scratch/debug_llm.py
1.5 kB
| import asyncio | |
| import logging | |
| from core.llm import get_llm | |
| from agents.triage import TRIAGE_PROMPT, TriageResult | |
| from langchain_core.output_parsers import PydanticOutputParser | |
| from langchain_core.prompts import ChatPromptTemplate | |
| logging.basicConfig(level=logging.DEBUG) | |
| async def test_llm(): | |
| from core.config import get_settings | |
| s = get_settings() | |
| print(f"OLLAMA_BASE_URL: {s.OLLAMA_BASE_URL}") | |
| print(f"AI_MODEL: {s.AI_MODEL}") | |
| print("Testing LLM connection for DeepSeek v3.2 via Ollama...") | |
| llm = get_llm(timeout=30) | |
| parser = PydanticOutputParser(pydantic_object=TriageResult) | |
| prompt = ChatPromptTemplate.from_messages([("system", TRIAGE_PROMPT)]) | |
| chain = prompt | llm | |
| try: | |
| print("Invoking Triage chain...") | |
| response = await chain.ainvoke({ | |
| "title": "Bug: Dashboard not loading", | |
| "description": "When I try to open the dashboard, I get a spinning wheel and nothing happens. It started yesterday after the update.", | |
| "image_captions": "No visual evidence provided.", | |
| "kb_context": "No relevant KB articles found.", | |
| "format_instructions": parser.get_format_instructions() | |
| }) | |
| print("\n=== RESPONSE CONTENT ===") | |
| print(response.content if hasattr(response, 'content') else str(response)) | |
| print("========================\n") | |
| except Exception as e: | |
| print(f"FAILED: {e}") | |
| if __name__ == "__main__": | |
| asyncio.run(test_llm()) | |