From 4ee0dc4c11bbab3d7a64882fad1cfee9ca3be207 Mon Sep 17 00:00:00 2001 From: Eric Jungbauer Date: Mon, 13 Apr 2026 15:49:22 +0000 Subject: [PATCH] Fix default LLM model to claude-3-haiku (compatible with API key tier) --- agents/llm_client.py | 4 ++-- agents/test_llm.py | 18 ++++++++++++++++++ agents/test_llm2.py | 38 ++++++++++++++++++++++++++++++++++++++ agents/test_pm.py | 26 ++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 agents/test_llm.py create mode 100644 agents/test_llm2.py create mode 100644 agents/test_pm.py diff --git a/agents/llm_client.py b/agents/llm_client.py index 0f5c000..bf4943a 100644 --- a/agents/llm_client.py +++ b/agents/llm_client.py @@ -13,9 +13,9 @@ from shared import DASHBOARD_API, api_request # Default models per provider DEFAULT_MODELS = { - "anthropic": "claude-sonnet-4-5-20250514", + "anthropic": "claude-3-haiku-20240307", "openai": "gpt-4o-mini", - "litellm": "anthropic/claude-sonnet-4-5-20250514", + "litellm": "anthropic/claude-3-haiku-20240307", "ollama": "llama3", } diff --git a/agents/test_llm.py b/agents/test_llm.py new file mode 100644 index 0000000..1762f76 --- /dev/null +++ b/agents/test_llm.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import sys +sys.path.insert(0, "/app/agents") +from shared import api_request, DASHBOARD_API +from llm_client import get_llm_config, DEFAULT_MODELS + +# Check what config the user has +config = api_request(f"{DASHBOARD_API}/api/users/2/llm", retries=1) +print(f"LLM config: {config}") +print(f"Default model for anthropic: {DEFAULT_MODELS.get('anthropic')}") + +# Try a simple completion +from llm_client import complete +try: + result = complete(2, "Say hello in one sentence.", max_tokens=50) + print(f"Success: {result}") +except Exception as e: + print(f"Error: {e}") diff --git a/agents/test_llm2.py b/agents/test_llm2.py new file mode 100644 index 0000000..762d94e --- /dev/null +++ b/agents/test_llm2.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +import json +from urllib import request + +API_KEY = "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" + +# Try different model names +models = [ + "claude-sonnet-4-5-20250514", + "claude-3-5-sonnet-20241022", + "claude-3-haiku-20240307", + "claude-sonnet-4-5-20250514", +] + +for model in models: + try: + body = json.dumps({ + "model": model, + "max_tokens": 20, + "messages": [{"role": "user", "content": "Say hi"}], + }).encode() + req = request.Request( + "https://api.anthropic.com/v1/messages", + data=body, + headers={ + "x-api-key": API_KEY, + "anthropic-version": "2023-06-01", + "content-type": "application/json", + }, + method="POST", + ) + with request.urlopen(req, timeout=30) as resp: + result = json.loads(resp.read().decode()) + text = result.get("content", [{}])[0].get("text", "") + print(f" {model}: OK - {text}") + break + except Exception as e: + print(f" {model}: {e}") diff --git a/agents/test_pm.py b/agents/test_pm.py new file mode 100644 index 0000000..33412b4 --- /dev/null +++ b/agents/test_pm.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +"""Quick test for the project monitor agent.""" +import sys, json +sys.path.insert(0, "/app/agents") + +config = { + "project_name": "AI Agents", + "wiki_collection_id": "9d9e471c-84cd-4ba7-bae5-c70f61805228", + "wiki_doc_ids": "", + "gitea_repo": "eric/ai-agents", + "custom_urls": "", + "custom_notes": "", + "report_collection_id": "", + "include_in_briefing": "true", +} + +print("Starting project monitor test...") +try: + from project_monitor import run + section, summary = run(config, user_id=2, instance_id=5) + print("SUCCESS") + print(f"Summary: {summary[:200]}") +except Exception as e: + print(f"FAILED: {type(e).__name__}: {e}") + import traceback + traceback.print_exc()