Skip to content

Replace hardcoded PROVIDER_CAPABILITIES with database-driven capabilities #383

@lbedner

Description

@lbedner

Summary

The hardcoded PROVIDER_CAPABILITIES dict in app/services/ai/models/__init__.py is redundant now that we have the LLM catalog database tables.

Current State

Hardcoded dict with:

  • supports_streaming
  • supports_function_calling
  • supports_vision
  • free_tier_available
PROVIDER_CAPABILITIES = {
    AIProvider.OPENAI: ProviderCapabilities(
        provider=AIProvider.OPENAI,
        supports_streaming=True,
        supports_function_calling=True,
        supports_vision=True,
        free_tier_available=False,
    ),
    # ... etc
}

Proposed Solution

  1. Add capability fields to LLMVendor table (or create LLMVendorCapability table)
  2. Populate capabilities via the LLM sync ETL from OpenRouter/LiteLLM metadata
  3. Replace get_provider_capabilities() to query database instead of hardcoded dict
  4. Update ai providers CLI command to use database-driven capabilities
  5. Remove PROVIDER_CAPABILITIES dict and ProviderCapabilities model

Benefits

  • Single source of truth (database)
  • Capabilities auto-update with LLM sync
  • No need to manually maintain hardcoded values
  • Extensible for new providers without code changes

Files to Modify

  • app/services/ai/models/__init__.py.j2 / .jinja
  • app/services/ai/models/llm/llm_vendor.py
  • app/services/ai/etl/llm_sync_service.py
  • app/cli/ai.py.j2 / .jinja

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions