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.
This commit is contained in:
James 2026-02-25 14:17:54 -05:00
parent 193d88afef
commit 4970157690
1 changed files with 3 additions and 3 deletions

6
ai.go
View File

@ -169,7 +169,7 @@ Respond in JSON ONLY:
{"category": "...", "doc_type": "...", "date": "...", "vendor": "...", "amount": "...", "title": "...", "summary": "...", "full_text": "..."}` {"category": "...", "doc_type": "...", "date": "...", "vendor": "...", "amount": "...", "title": "...", "summary": "...", "full_text": "..."}`
reqBody := map[string]interface{}{ reqBody := map[string]interface{}{
"model": "accounts/fireworks/models/kimi-k2p5", "model": "accounts/fireworks/models/qwen3-vl-30b-a3b-instruct",
"max_tokens": 4096, "max_tokens": 4096,
"messages": []map[string]interface{}{ "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 }."}, {"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 // Retry once with minimal prompt to avoid triggering extended reasoning
log.Printf(" [AI] First attempt failed, retrying with simplified prompt...") log.Printf(" [AI] First attempt failed, retrying with simplified prompt...")
retryBody := map[string]interface{}{ retryBody := map[string]interface{}{
"model": "accounts/fireworks/models/kimi-k2p5", "model": "accounts/fireworks/models/qwen3-vl-30b-a3b-instruct",
"max_tokens": 4096, "max_tokens": 4096,
"messages": []map[string]interface{}{ "messages": []map[string]interface{}{
{"role": "system", "content": "Output valid JSON only. No other text."}, {"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.` 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{}{ reqBody := map[string]interface{}{
"model": "accounts/fireworks/models/kimi-k2p5", "model": "accounts/fireworks/models/qwen3-vl-30b-a3b-instruct",
"max_tokens": 4096, "max_tokens": 4096,
"messages": []map[string]interface{}{ "messages": []map[string]interface{}{
{ {