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:
@@ -220,6 +220,10 @@ namespace MoneyMap.Services
|
||||
{
|
||||
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
|
||||
if (trimmed.StartsWith("```json"))
|
||||
{
|
||||
@@ -816,7 +820,7 @@ namespace MoneyMap.Services
|
||||
}
|
||||
}
|
||||
},
|
||||
max_tokens = 4096,
|
||||
max_tokens = 16384,
|
||||
temperature = 0.1
|
||||
};
|
||||
|
||||
@@ -898,7 +902,7 @@ namespace MoneyMap.Services
|
||||
OpenAIToolUseHelper.BuildToolsArray(tools),
|
||||
toolExecutor,
|
||||
maxToolRounds,
|
||||
maxTokens: 4096,
|
||||
maxTokens: 16384,
|
||||
_logger);
|
||||
}
|
||||
catch (TaskCanceledException ex) when (ex.InnerException is TimeoutException)
|
||||
|
||||
Reference in New Issue
Block a user