Update LLM providers and constants (#1937)

- Updated constants in app/lib/.server/llm/constants.ts
- Modified stream-text functionality in app/lib/.server/llm/stream-text.ts
- Updated Anthropic provider in app/lib/modules/llm/providers/anthropic.ts
- Modified GitHub provider in app/lib/modules/llm/providers/github.ts
- Updated Google provider in app/lib/modules/llm/providers/google.ts
- Modified OpenAI provider in app/lib/modules/llm/providers/openai.ts
- Updated LLM types in app/lib/modules/llm/types.ts
- Modified API route in app/routes/api.llmcall.ts
This commit is contained in:
Stijnus
2025-08-29 22:55:02 +02:00
committed by GitHub
parent b5d9055851
commit 38c13494c2
8 changed files with 251 additions and 26 deletions

View File

@@ -4,6 +4,44 @@
*/
export const MAX_TOKENS = 32000;
/*
* Provider-specific default completion token limits
* Used as fallbacks when model doesn't specify maxCompletionTokens
*/
export const PROVIDER_COMPLETION_LIMITS: Record<string, number> = {
OpenAI: 16384,
Github: 16384, // GitHub Models use OpenAI-compatible limits
Anthropic: 128000,
Google: 32768,
Cohere: 4000,
DeepSeek: 8192,
Groq: 8192,
HuggingFace: 4096,
Mistral: 8192,
Ollama: 8192,
OpenRouter: 8192,
Perplexity: 8192,
Together: 8192,
xAI: 8192,
LMStudio: 8192,
OpenAILike: 8192,
AmazonBedrock: 8192,
Hyperbolic: 8192,
};
/*
* Reasoning models that require maxCompletionTokens instead of maxTokens
* These models use internal reasoning tokens and have different API parameter requirements
*/
export function isReasoningModel(modelName: string): boolean {
const result = /^(o1|o3|gpt-5)/i.test(modelName);
// DEBUG: Test regex matching
console.log(`REGEX TEST: "${modelName}" matches reasoning pattern: ${result}`);
return result;
}
// limits the number of model responses that can be returned in a single request
export const MAX_RESPONSE_SEGMENTS = 2;