From 800862405dd5f932ae1776b2b46e7d927f415854 Mon Sep 17 00:00:00 2001 From: Yijia-Xiao Date: Mon, 11 May 2026 09:03:06 +0000 Subject: [PATCH] feat(ollama): allow Custom model ID in the CLI dropdown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users with other models pulled via `ollama pull` (beyond the three suggested defaults) can now select "Custom model ID" and type any model name. Matches the same pattern used for DeepSeek, GLM, Qwen, and MiniMax — the existing _prompt_custom_model_id flow handles the "custom" value generically, so this is a one-row catalog addition plus regression coverage. --- tests/test_ollama_base_url.py | 11 +++++++++++ tradingagents/llm_clients/model_catalog.py | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/tests/test_ollama_base_url.py b/tests/test_ollama_base_url.py index 0ad61b4b9..6c7cbe096 100644 --- a/tests/test_ollama_base_url.py +++ b/tests/test_ollama_base_url.py @@ -154,3 +154,14 @@ def test_ollama_model_labels_no_local_suffix(): for mode in ("quick", "deep"): labels = [label for label, _ in get_model_options("ollama", mode)] assert all("local" not in label for label in labels), labels + + +def test_ollama_offers_custom_model_id(): + """Ollama users with custom-pulled models can pick 'Custom model ID'.""" + from tradingagents.llm_clients.model_catalog import get_model_options + for mode in ("quick", "deep"): + entries = get_model_options("ollama", mode) + values = [v for _, v in entries] + assert "custom" in values, f"Ollama {mode!r} missing 'custom' option: {entries}" + # Custom option is last so it doesn't push the curated defaults off-screen + assert values[-1] == "custom", f"'custom' should be last entry: {values}" diff --git a/tradingagents/llm_clients/model_catalog.py b/tradingagents/llm_clients/model_catalog.py index fdde80507..d88c0f137 100644 --- a/tradingagents/llm_clients/model_catalog.py +++ b/tradingagents/llm_clients/model_catalog.py @@ -159,16 +159,20 @@ MODEL_OPTIONS: ProviderModeOptions = { # apply whether the user runs ollama-serve on localhost or against a # remote host. The actual resolved endpoint is surfaced separately by # cli.utils.confirm_ollama_endpoint() right after provider selection. + # "Custom model ID" lets users pick any model they have pulled via + # `ollama pull` beyond the three suggested defaults. "ollama": { "quick": [ ("Qwen3:latest (8B)", "qwen3:latest"), ("GPT-OSS:latest (20B)", "gpt-oss:latest"), ("GLM-4.7-Flash:latest (30B)", "glm-4.7-flash:latest"), + ("Custom model ID", "custom"), ], "deep": [ ("GLM-4.7-Flash:latest (30B)", "glm-4.7-flash:latest"), ("GPT-OSS:latest (20B)", "gpt-oss:latest"), ("Qwen3:latest (8B)", "qwen3:latest"), + ("Custom model ID", "custom"), ], }, }