Skip to content

Commit d2ad769

Browse files
committed
fix(ollama): add shorthand support and fix test configuration
- Add "ollama::" to SHORTHAND_MODEL_PREFIXES for shorthand model syntax - Add ollama case in from_shorthand match for shorthand resolution - Quote variant names with dots in TOML configs to prevent parsing issues - Use correct model name (qwen2:0.5b) for shorthand test variant
1 parent 0eedb02 commit d2ad769

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

tensorzero-core/src/model.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,6 +2323,7 @@ pub const SHORTHAND_MODEL_PREFIXES: &[&str] = &[
23232323
"hyperbolic::",
23242324
"groq::",
23252325
"mistral::",
2326+
"ollama::",
23262327
"openai::",
23272328
"openrouter::",
23282329
"together::",
@@ -2440,6 +2441,13 @@ impl ShorthandModelConfig for ModelConfig {
24402441
.get_defaulted_credential(None, default_credentials)
24412442
.await?,
24422443
)),
2444+
"ollama" => ProviderConfig::Ollama(OllamaProvider::new(
2445+
model_name,
2446+
None,
2447+
OllamaKind
2448+
.get_defaulted_credential(None, default_credentials)
2449+
.await?,
2450+
)),
24432451
#[cfg(any(test, feature = "e2e_tests"))]
24442452
"dummy" => ProviderConfig::Dummy(DummyProvider::new(model_name, None)?),
24452453
_ => {

tensorzero-core/tests/e2e/config/tensorzero.functions.basic_test.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -792,14 +792,14 @@ max_tokens = 100
792792

793793
## Ollama
794794

795-
[functions.basic_test.variants.dolphin-llama3-8b-ollama]
795+
[functions.basic_test.variants."qwen2-0.5b-ollama"]
796796
type = "chat_completion"
797-
model = "dolphin-llama3-8b-ollama"
797+
model = "qwen2-0.5b-ollama"
798798
system_template = "../../../fixtures/config/functions/basic_test/prompt/system_template.minijinja"
799799
max_tokens = 100
800800

801801
[functions.basic_test.variants.ollama-shorthand]
802802
type = "chat_completion"
803-
model = "ollama::dolphin-llama3:8b"
803+
model = "ollama::qwen2:0.5b"
804804
system_template = "../../../fixtures/config/functions/basic_test/prompt/system_template.minijinja"
805805
max_tokens = 100

tensorzero-core/tests/e2e/config/tensorzero.functions.json_success.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,9 +734,9 @@ max_tokens = 100
734734

735735
## Ollama
736736

737-
[functions.json_success.variants.dolphin-llama3-8b-ollama]
737+
[functions.json_success.variants."qwen2-0.5b-ollama"]
738738
type = "chat_completion"
739-
model = "dolphin-llama3-8b-ollama"
739+
model = "qwen2-0.5b-ollama"
740740
system_template = "../../../fixtures/config/functions/json_success/prompt/system_template.minijinja"
741741
user_template = "../../../fixtures/config/functions/json_success/prompt/user_template.minijinja"
742742
json_mode = "on"

0 commit comments

Comments
 (0)