Compare commits

...

2 Commits

Author SHA1 Message Date
aj a7c304ccb5 Config: Switch receipt parsing to Qwen3-VL-Thinking model
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 16:06:18 -05:00
aj f622912f2e Improve: Support reasoning models in AI vision pipeline
Strip <think>...</think> blocks from reasoning model output (e.g.
Qwen3-VL-Thinking) and increase max_tokens from 4096 to 16384 to
accommodate thinking token overhead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 16:04:29 -05:00
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -220,6 +220,10 @@ namespace MoneyMap.Services
{ {
var trimmed = content?.Trim() ?? ""; var trimmed = content?.Trim() ?? "";
// Strip <think>...</think> blocks from reasoning models (e.g. Qwen3-VL-Thinking)
trimmed = System.Text.RegularExpressions.Regex.Replace(
trimmed, @"<think>[\s\S]*?</think>", "", System.Text.RegularExpressions.RegexOptions.IgnoreCase).Trim();
// Strip markdown code fences // Strip markdown code fences
if (trimmed.StartsWith("```json")) if (trimmed.StartsWith("```json"))
{ {
@@ -816,7 +820,7 @@ namespace MoneyMap.Services
} }
} }
}, },
max_tokens = 4096, max_tokens = 16384,
temperature = 0.1 temperature = 0.1
}; };
@@ -898,7 +902,7 @@ namespace MoneyMap.Services
OpenAIToolUseHelper.BuildToolsArray(tools), OpenAIToolUseHelper.BuildToolsArray(tools),
toolExecutor, toolExecutor,
maxToolRounds, maxToolRounds,
maxTokens: 4096, maxTokens: 16384,
_logger); _logger);
} }
catch (TaskCanceledException ex) when (ex.InnerException is TimeoutException) catch (TaskCanceledException ex) when (ex.InnerException is TimeoutException)
+1 -1
View File
@@ -21,6 +21,6 @@
"AllowedHosts": "*", "AllowedHosts": "*",
"AI": { "AI": {
"ModelsEndpoint": "http://athena.lan:11434", "ModelsEndpoint": "http://athena.lan:11434",
"ReceiptParsingModel": "llamacpp:Qwen3-VL-32B-Instruct-Q8_0" "ReceiptParsingModel": "llamacpp:Qwen3-VL-32B-Thinking-Q8_0"
} }
} }