_resolve_endpoint raises ValueError when provider/model in agent config is not a string

Open Beginner friendly
#33 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
92/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
ai, testing

Research direction

Start in artemis/services/llm.py at _resolve_endpoint and compare provider/model handling with the other fields using _get_val. Run tests/unit/agents/test_explorer.py to reproduce the nine failures. Done means non-string provider or model attributes use the documented string defaults and the affected tests pass.

Written by the indexing model from the issue text.

Description

In artemis/services/llm.py, _resolve_endpoint extracts provider_val and model_val using bare getattr:

provider_val = getattr(cfg, "provider", "google")
model_val = getattr(cfg, "model", "gemini-2.5-flash")

While other fields in the same function use _get_val(obj, attr, expected_type) to safely validate types, provider_val and model_val do not. When cfg has non-string or mock attributes (such as in tests/unit/agents/test_explorer.py), getattr does not fall back to the default string, causing ModelProvider.from_string to raise:

ValueError: Unknown LLM provider <MagicMock name='mock.llm_config.get_agent().provider'>. Valid providers: ['anthropic', 'claude', 'custom', 'gemini', 'google', 'grok', 'ollama', 'openai', 'openrouter', 'vertex', 'vertexai', 'vllm', 'xai']

This currently breaks 9 unit tests in tests/unit/agents/test_explorer.py.

Fix

Use _get_val(cfg, "provider", str) or "google" and _get_val(cfg, "model", str) or "gemini-2.5-flash" consistent with the other fields in _resolve_endpoint.

Dominant language
Python
Stars
8.2k
Forks
779
Avg merge
20m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/artemis

All issues in google/artemis

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.