Ollama's OpenAI-compatible API handles reasoning natively via the `reasoning` field in streaming chunks, so there is no need for <think>/<final> tag enforcement. Including "ollama" in isReasoningTagProvider() caused enforceFinalTag to be set for all Ollama models, discarding all output since they don't emit <final> tags. Fixes #2279 Co-Authored-By: Ayush Ojha <ayushozha@outlook.com>
31 lines
926 B
TypeScript
31 lines
926 B
TypeScript
/**
|
|
* Utility functions for provider-specific logic and capabilities.
|
|
*/
|
|
|
|
/**
|
|
* Returns true if the provider requires reasoning to be wrapped in tags
|
|
* (e.g. <think> and <final>) in the text stream, rather than using native
|
|
* API fields for reasoning/thinking.
|
|
*/
|
|
export function isReasoningTagProvider(provider: string | undefined | null): boolean {
|
|
if (!provider) return false;
|
|
const normalized = provider.trim().toLowerCase();
|
|
|
|
// Check for exact matches or known prefixes/substrings for reasoning providers
|
|
if (normalized === "google-gemini-cli" || normalized === "google-generative-ai") {
|
|
return true;
|
|
}
|
|
|
|
// Handle google-antigravity and its model variations (e.g. google-antigravity/gemini-3)
|
|
if (normalized.includes("google-antigravity")) {
|
|
return true;
|
|
}
|
|
|
|
// Handle Minimax (M2.1 is chatty/reasoning-like)
|
|
if (normalized.includes("minimax")) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|