Skip to content

feat(llm/ollama): implement list_models_remote via GET /api/tags #993

@bug-ops

Description

@bug-ops

Parent Epic

#991

Depends On

#992

Summary

Override list_models_remote in OllamaProvider to query Ollama's tag listing endpoint.

Endpoint

GET {base_url}/api/tags

No authentication required.

Response Shape (Ollama API)

{
  "models": [
    {
      "name": "llama3.2:latest",
      "model": "llama3.2:latest",
      "modified_at": "2025-09-12T...",
      "size": 2019393189,
      "details": {
        "parameter_size": "3.2B",
        "quantization_level": "Q4_K_M",
        "family": "llama"
      }
    }
  ]
}

Implementation Notes

  • Map nameModelInfo::id, details.parameter_sizedisplay_name.
  • ollama_rs crate may already expose a list_local_models() method — check before
    writing raw HTTP. If available, prefer that over manual reqwest call.
  • Cache with provider slug "ollama".
  • If Ollama is unreachable, return LlmError::Unavailable (do not cache error).

Acceptance Criteria

  • OllamaProvider::list_models_remote returns all pulled models.
  • display_name includes parameter size when available (e.g. "llama3.2 3.2B Q4_K_M").
  • Result is cached; second call within TTL returns cached data without HTTP.
  • Unreachable Ollama returns Err, does not overwrite valid cache.
  • Unit test with mock HTTP server or ollama_rs mock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    llmLLM provider related

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions