add hardcoded context windows for Groq models
This commit is contained in:
parent
fd71442331
commit
a864366c80
1 changed files with 34 additions and 7 deletions
|
|
@ -84,13 +84,40 @@ export async function fetchModelsFromEndpoints() {
|
|||
const models = jsonResponse.data || [];
|
||||
console.log(`✅ Fetched ${models.length} models from ${endpoint.url}:`, models.map(m => m.id));
|
||||
// Map each model to include its endpoint ID, unique ID, and model name
|
||||
return models.map((model) => ({
|
||||
...model,
|
||||
modelName: model.id, // Explicitly store model name
|
||||
endpointId: endpoint.id,
|
||||
uniqueId: `${endpoint.id}-${model.id}`, // Unique ID with endpoint ID first
|
||||
maxTokens: model.max_tokens || model.context_length || model.max_context_length || model.max_model_len || 8192, // Capture max tokens
|
||||
}));
|
||||
return models.map((model) => {
|
||||
// Get context window size from API or use known values for Groq models
|
||||
let maxTokens = model.max_tokens || model.context_length || model.max_context_length || model.max_model_len;
|
||||
|
||||
// Hardcoded context windows for known Groq models (since API doesn't return them)
|
||||
if (endpoint.id.includes('groq.com')) {
|
||||
const groqContextWindows = {
|
||||
'llama-3.1-8b-instant': 131072,
|
||||
'llama-3.3-70b-versatile': 131072,
|
||||
'llama-3.1-70b-versatile': 131072,
|
||||
'llama3-8b-8192': 8192,
|
||||
'llama3-70b-8192': 8192,
|
||||
'mixtral-8x7b-32768': 32768,
|
||||
'gemma2-9b-it': 8192,
|
||||
'meta-llama/llama-4-scout-17b-16e-instruct': 131072,
|
||||
'meta-llama/llama-4-maverick-17b-128e-instruct': 131072,
|
||||
'deepseek-r1-distill-llama-70b': 131072,
|
||||
'qwen/qwen3-32b': 131072,
|
||||
'mistral-saba-24b': 32768,
|
||||
'compound-beta': 131072,
|
||||
'compound-beta-mini': 131072,
|
||||
};
|
||||
maxTokens = groqContextWindows[model.id] || 8192;
|
||||
console.log(`Using hardcoded context window for Groq model ${model.id}: ${maxTokens} tokens`);
|
||||
}
|
||||
|
||||
return {
|
||||
...model,
|
||||
modelName: model.id,
|
||||
endpointId: endpoint.id,
|
||||
uniqueId: `${endpoint.id}-${model.id}`,
|
||||
maxTokens: maxTokens || 8192,
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`Error fetching models from ${endpoint.url}:`, error);
|
||||
return [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue