Spaces:
Paused

File size: 1,500 Bytes
6e84d1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

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())