Merge branch 'main' into main

This commit is contained in:
Karrot
2024-11-08 17:10:40 -05:00
committed by GitHub
4 changed files with 25 additions and 1 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;
}
@@ -88,6 +91,15 @@ export function getLMStudioModel(baseURL: string, model: string) {
return lmstudio(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) {
const apiKey = getAPIKey(env, provider);
const baseURL = getBaseURL(env, provider);
@@ -111,6 +123,8 @@ export function getModel(provider: string, model: string, env: Env) {
return getMistralModel(apiKey, model);
case 'LMStudio':
return getLMStudioModel(baseURL, model);
case 'xAI':
return getXAIModel(apiKey, model);
default:
return getOllamaModel(baseURL, model);
}