Skip to content

feat(llm): wire list_models_remote into AnyProvider, RouterProvider, ModelOrchestrator #996

@bug-ops

Description

@bug-ops

Parent Epic

#991

Depends On

#992 #993 #994 #995

Summary

Propagate list_models_remote through the dispatcher layer so callers always
get the full model list regardless of which AnyProvider variant is active.

Changes

AnyProvider

Add delegation via the existing delegate_provider! macro:

// any.rs
impl LlmProvider for AnyProvider {
    async fn list_models_remote(&self) -> Result<Vec<ModelInfo>, LlmError> {
        delegate_provider!(self, |p| p.list_models_remote().await)
    }
}

RouterProvider

Aggregate models from all fallback providers, deduplicating by id:

async fn list_models_remote(&self) -> Result<Vec<ModelInfo>, LlmError> {
    let mut seen = std::collections::HashSet::new();
    let mut result = Vec::new();
    for provider in &self.providers {
        if let Ok(models) = provider.list_models_remote().await {
            for m in models {
                if seen.insert(m.id.clone()) {
                    result.push(m);
                }
            }
        }
    }
    Ok(result)
}

ModelOrchestrator

Aggregate across all registered sub-providers, tagging each ModelInfo
with the sub-provider name in display_name prefix when ambiguous:

async fn list_models_remote(&self) -> Result<Vec<ModelInfo>, LlmError> {
    // iterate self.providers (HashMap<String, SubProvider>)
    // collect and deduplicate
}

Acceptance Criteria

  • AnyProvider::list_models_remote delegates to inner variant.
  • RouterProvider returns union of all providers, no duplicates.
  • ModelOrchestrator returns union of all sub-providers.
  • All existing unit tests pass.
  • Integration test: AnyProvider::Ollamalist_models_remote hits mock Ollama.

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