From 497015769055f46206df73bc5476f8a9b67b49f1 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 25 Feb 2026 14:17:54 -0500 Subject: [PATCH] Switch vision model to qwen3-vl-30b-a3b-instruct Replaces kimi-k2p5 for all vision tasks. K2.5 was outputting chain-of-thought reasoning instead of JSON for non-English docs, requiring a fallback path. qwen3-vl works first try, no retry needed, preserves original language correctly. --- ai.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ai.go b/ai.go index f88f8ea..33ec85d 100644 --- a/ai.go +++ b/ai.go @@ -169,7 +169,7 @@ Respond in JSON ONLY: {"category": "...", "doc_type": "...", "date": "...", "vendor": "...", "amount": "...", "title": "...", "summary": "...", "full_text": "..."}` reqBody := map[string]interface{}{ - "model": "accounts/fireworks/models/kimi-k2p5", + "model": "accounts/fireworks/models/qwen3-vl-30b-a3b-instruct", "max_tokens": 4096, "messages": []map[string]interface{}{ {"role": "system", "content": "You are a document analysis API. Output ONLY raw JSON. No thinking, no commentary, no code fences. First character must be {, last character must be }."}, @@ -188,7 +188,7 @@ Respond in JSON ONLY: // Retry once with minimal prompt to avoid triggering extended reasoning log.Printf(" [AI] First attempt failed, retrying with simplified prompt...") retryBody := map[string]interface{}{ - "model": "accounts/fireworks/models/kimi-k2p5", + "model": "accounts/fireworks/models/qwen3-vl-30b-a3b-instruct", "max_tokens": 4096, "messages": []map[string]interface{}{ {"role": "system", "content": "Output valid JSON only. No other text."}, @@ -501,7 +501,7 @@ func AnalyzePageOnly(imageData []byte, pageNum int) (string, error) { FORMAT: Use ### for sections, **bold** for labels, markdown tables for tabular data, - bullets for lists. Preserve ALL numbers, dates, amounts, and values exactly as shown. If the document is in Russian, Dutch, German, French, or any other language — keep it in that language.` reqBody := map[string]interface{}{ - "model": "accounts/fireworks/models/kimi-k2p5", + "model": "accounts/fireworks/models/qwen3-vl-30b-a3b-instruct", "max_tokens": 4096, "messages": []map[string]interface{}{ {