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>
This commit is contained in:
2026-02-22 16:04:29 -05:00
parent 299ea3d4fe
commit f622912f2e
+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)