fix: Resolved

This commit is contained in:
ali00209
2024-11-09 09:55:40 +05:00
parent a544611a56
commit 73a07c93e4
2 changed files with 39 additions and 7 deletions

View File

@@ -58,7 +58,10 @@ export function getGroqModel(apiKey: string, model: string) {
}
export function getOllamaModel(baseURL: string, model: string) {
let Ollama = ollama(model);
let Ollama = ollama(model, {
numCtx: 32768,
});
Ollama.config.baseURL = `${baseURL}/api`;
return Ollama;
}
@@ -80,6 +83,15 @@ export function getOpenRouterModel(apiKey: string, model: string) {
return openRouter.chat(model);
}
export function getXAIModel(apiKey: string, model: string) {
const openai = createOpenAI({
baseURL: 'https://api.x.ai/v1',
apiKey,
});
return openai(model);
}
export function getModel(provider: string, model: string, env: Env, apiKeys?: Record<string, string>) {
const apiKey = getAPIKey(env, provider, apiKeys);
const baseURL = getBaseURL(env, provider);
@@ -101,6 +113,8 @@ export function getModel(provider: string, model: string, env: Env, apiKeys?: Re
return getDeepseekModel(apiKey, model)
case 'Mistral':
return getMistralModel(apiKey, model);
case 'xAI':
return getXAIModel(apiKey, model);
default:
return getOllamaModel(baseURL, model);
}