Skip to content

Commit 78f3d4f

Browse files
authored
feat: drop predefined models for ollama (#1165)
1 parent 4fab4c5 commit 78f3d4f

File tree

5 files changed

+29
-59
lines changed

5 files changed

+29
-59
lines changed

Argcfile.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ _argc_before() {
313313
moonshot,moonshot-v1-8k,https://api.moonshot.cn/v1 \
314314
novita,meta-llama/llama-3.1-8b-instruct,https://api.novita.ai/v3/openai \
315315
openrouter,openai/gpt-4o-mini,https://openrouter.ai/api/v1 \
316-
ollama,llama3.1:latest,http://${OLLAMA_HOST:-"127.0.0.1:11434"}/v1 \
317316
perplexity,llama-3.1-8b-instruct,https://api.perplexity.ai \
318317
qianwen,qwen-turbo-latest,https://dashscope.aliyuncs.com/compatible-mode/v1 \
319318
siliconflow,meta-llama/Meta-Llama-3.1-8B-Instruct,https://api.siliconflow.cn/v1 \

config.example.yaml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,10 @@ clients:
9898
# supports_reasoning: true
9999
# - name: xxxx # Embedding model
100100
# type: embedding
101-
# max_input_tokens: 200000
102-
# max_tokens_per_chunk: 2000
103101
# default_chunk_size: 1500
104102
# max_batch_size: 100
105103
# - name: xxxx # Reranker model
106104
# type: reranker
107-
# max_input_tokens: 2048
108105
# patch: # Patch api
109106
# chat_completions: # Api type, possible values: chat_completions, embeddings, and rerank
110107
# <regex>: # The regex to match model names, e.g. '.*' 'gpt-4o' 'gpt-4o|gpt-4-.*'
@@ -125,19 +122,23 @@ clients:
125122

126123
# For any platform compatible with OpenAI's API
127124
- type: openai-compatible
128-
name: local
129-
api_base: http://localhost:8080/v1
125+
name: ollama
126+
api_base: http://localhost:11434/v1
130127
api_key: xxx # Optional
131128
models:
129+
- name: deepseek-r1
130+
max_input_tokens: 131072
131+
supports_reasoning: true
132132
- name: llama3.1
133133
max_input_tokens: 128000
134134
supports_function_calling: true
135-
- name: jina-embeddings-v2-base-en
135+
- name: llama3.2-vision
136+
max_input_tokens: 131072
137+
supports_vision: true
138+
- name: nomic-embed-text
136139
type: embedding
137-
default_chunk_size: 1500
138-
max_batch_size: 100
139-
- name: jina-reranker-v2-base-multilingual
140-
type: reranker
140+
default_chunk_size: 1000
141+
max_batch_size: 50
141142

142143
# See https://ai.google.dev/docs
143144
- type: gemini
@@ -197,11 +198,6 @@ clients:
197198
api_base: https://api.groq.com/openai/v1
198199
api_key: xxx
199200

200-
# See https://github.com/jmorganca/ollama
201-
- type: openai-compatible
202-
name: ollama
203-
api_base: http://localhost:11434/v1
204-
205201
# See https://learn.microsoft.com/en-us/azure/ai-services/openai/chatgpt-quickstart
206202
- type: azure-openai
207203
api_base: https://{RESOURCE}.openai.azure.com

models.yaml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -440,35 +440,6 @@
440440
output_price: 0
441441
supports_reasoning: true
442442

443-
# Links:
444-
# - https://ollama.com/library
445-
# - https://github.com/ollama/ollama/blob/main/docs/openai.md
446-
- provider: ollama
447-
models:
448-
- name: llama3.1
449-
max_input_tokens: 131072
450-
supports_function_calling: true
451-
- name: llama3.2
452-
max_input_tokens: 131072
453-
supports_function_calling: true
454-
- name: llama3.2-vision
455-
max_input_tokens: 131072
456-
supports_vision: true
457-
- name: qwen2.5
458-
max_input_tokens: 131072
459-
supports_function_calling: true
460-
- name: qwen2.5-coder
461-
max_input_tokens: 32768
462-
supports_function_calling: true
463-
- name: deepseek-r1
464-
max_input_tokens: 131072
465-
supports_reasoning: true
466-
- name: nomic-embed-text
467-
type: embedding
468-
max_tokens_per_chunk: 8192
469-
default_chunk_size: 1000
470-
max_batch_size: 50
471-
472443
# Links:
473444
# - https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models
474445
# - https://cloud.google.com/vertex-ai/generative-ai/docs/model-garden/explore-models

src/client/common.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -553,24 +553,29 @@ async fn set_client_models_config(client_config: &mut Value, client: &str) -> Re
553553
std::env::var(&env_name).ok()
554554
}),
555555
) {
556-
if let Ok(fetched_models) = abortable_run_with_spinner(
556+
match abortable_run_with_spinner(
557557
fetch_models(api_base, api_key.as_deref()),
558558
"Fetching models",
559559
create_abort_signal(),
560560
)
561561
.await
562562
{
563-
model_names = MultiSelect::new("LLM models (required):", fetched_models)
564-
.with_validator(|list: &[ListOption<&String>]| {
565-
if list.is_empty() {
566-
Ok(Validation::Invalid(
567-
"At least one item must be selected".into(),
568-
))
569-
} else {
570-
Ok(Validation::Valid)
571-
}
572-
})
573-
.prompt()?;
563+
Ok(fetched_models) => {
564+
model_names = MultiSelect::new("LLM models (required):", fetched_models)
565+
.with_validator(|list: &[ListOption<&String>]| {
566+
if list.is_empty() {
567+
Ok(Validation::Invalid(
568+
"At least one item must be selected".into(),
569+
))
570+
} else {
571+
Ok(Validation::Valid)
572+
}
573+
})
574+
.prompt()?;
575+
}
576+
Err(err) => {
577+
eprintln!("✗ Unable to fetch models: {err}");
578+
}
574579
}
575580
}
576581
if model_names.is_empty() {

src/client/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ register_client!(
3333
(bedrock, "bedrock", BedrockConfig, BedrockClient),
3434
);
3535

36-
pub const OPENAI_COMPATIBLE_PROVIDERS: [(&str, &str); 25] = [
36+
pub const OPENAI_COMPATIBLE_PROVIDERS: [(&str, &str); 24] = [
3737
("ai21", "https://api.ai21.com/studio/v1"),
3838
(
3939
"cloudflare",
@@ -53,7 +53,6 @@ pub const OPENAI_COMPATIBLE_PROVIDERS: [(&str, &str); 25] = [
5353
("moonshot", "https://api.moonshot.cn/v1"),
5454
("novita", "https://api.novita.ai/v3/openai"),
5555
("openrouter", "https://openrouter.ai/api/v1"),
56-
("ollama", "http://{OLLAMA_HOST}:11434/v1"),
5756
("perplexity", "https://api.perplexity.ai"),
5857
(
5958
"qianwen",

0 commit comments

Comments
 (0)