| 123456789101112131415161718192021222324 |
- import httpx
- import json
- def debug_chat():
- url = "http://localhost:11434/api/chat"
- messages = [
- {"role": "system", "content": "[SYSTEM: NUTRITIONAL ANALYST MODE]\nYou are the LocalFoodAI Analyst. Use ONLY verified local data for values.\nCRITICAL: Provide direct, concise answers. Skip all internal monologues, <thought> tags, or reasoning steps.\nFor each food discussed, you MUST follow this structure:\n1. Header: ### 🥗 [Name] (per 100g)\n2. Macros: A markdown table for Cal, P, F, C, Fib, Sug, Chol.\n3. Micros: A bulleted list for Na, Ca, Fe, K, VitA, VitC.\n4. Insight: A 1-sentence analysis of the food's nutritional profile.\nAlways prioritize local data over training memory. If a nutrient is missing, say 'Data not available'."},
- {"role": "user", "content": "How much protein in 100g of salmon?"}
- ]
- payload = {
- "model": "qwen3.5:9b",
- "messages": messages,
- "stream": False
- }
-
- print("Sending debug request...")
- with httpx.Client(timeout=300.0) as client:
- response = client.post(url, json=payload)
- print(f"Status: {response.status_code}")
- print("Response Body:")
- print(response.text)
- if __name__ == "__main__":
- debug_chat()
|