mirror of
https://github.com/katanemo/plano.git
synced 2026-04-25 00:36:34 +02:00
Adding support for wildcard models in the model_providers config (#696)
* cleaning up plano cli commands * adding support for wildcard model providers * fixing compile errors * fixing bugs related to default model provider, provider hint and duplicates in the model provider list * fixed cargo fmt issues * updating tests to always include the model id * using default for the prompt_gateway path * fixed the model name, as gpt-5-mini-2025-08-07 wasn't in the config * making sure that all aliases and models match the config * fixed the config generator to allow for base_url providers LLMs to include wildcard models * re-ran the models list utility and added a shell script to run it * updating docs to mention wildcard model providers * updated provider_models.json to yaml, added that file to our docs for reference * updating the build docs to use the new root-based build --------- Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-342.local>
This commit is contained in:
parent
8428b06e22
commit
2941392ed1
42 changed files with 1748 additions and 202 deletions
|
|
@ -26,7 +26,7 @@ All providers are configured in the ``llm_providers`` section of your ``plano_co
|
|||
|
||||
**Common Configuration Fields:**
|
||||
|
||||
- ``model``: Provider prefix and model name (format: ``provider/model-name``)
|
||||
- ``model``: Provider prefix and model name (format: ``provider/model-name`` or ``provider/*`` for wildcard expansion)
|
||||
- ``access_key``: API key for authentication (supports environment variables)
|
||||
- ``default``: Mark a model as the default (optional, boolean)
|
||||
- ``name``: Custom name for the provider instance (optional)
|
||||
|
|
@ -108,7 +108,11 @@ OpenAI
|
|||
.. code-block:: yaml
|
||||
|
||||
llm_providers:
|
||||
# Latest models (examples - use any OpenAI chat model)
|
||||
# Configure all OpenAI models with wildcard
|
||||
- model: openai/*
|
||||
access_key: $OPENAI_API_KEY
|
||||
|
||||
# Or configure specific models
|
||||
- model: openai/gpt-5.2
|
||||
access_key: $OPENAI_API_KEY
|
||||
default: true
|
||||
|
|
@ -116,7 +120,6 @@ OpenAI
|
|||
- model: openai/gpt-5
|
||||
access_key: $OPENAI_API_KEY
|
||||
|
||||
# Use any model name from OpenAI's API
|
||||
- model: openai/gpt-4o
|
||||
access_key: $OPENAI_API_KEY
|
||||
|
||||
|
|
@ -156,17 +159,29 @@ Anthropic
|
|||
.. code-block:: yaml
|
||||
|
||||
llm_providers:
|
||||
# Latest models (examples - use any Anthropic chat model)
|
||||
# Configure all Anthropic models with wildcard
|
||||
- model: anthropic/*
|
||||
access_key: $ANTHROPIC_API_KEY
|
||||
|
||||
# Or configure specific models
|
||||
- model: anthropic/claude-opus-4-5
|
||||
access_key: $ANTHROPIC_API_KEY
|
||||
|
||||
- model: anthropic/claude-sonnet-4-5
|
||||
access_key: $ANTHROPIC_API_KEY
|
||||
|
||||
# Use any model name from Anthropic's API
|
||||
- model: anthropic/claude-haiku-4-5
|
||||
access_key: $ANTHROPIC_API_KEY
|
||||
|
||||
# Override specific model with custom routing
|
||||
- model: anthropic/*
|
||||
access_key: $ANTHROPIC_API_KEY
|
||||
|
||||
- model: anthropic/claude-sonnet-4-20250514
|
||||
access_key: $ANTHROPIC_PROD_API_KEY
|
||||
routing_preferences:
|
||||
- name: code_generation
|
||||
|
||||
DeepSeek
|
||||
~~~~~~~~
|
||||
|
||||
|
|
@ -694,6 +709,93 @@ Configure multiple instances of the same provider:
|
|||
access_key: $OPENAI_DEV_KEY
|
||||
name: openai-dev
|
||||
|
||||
Wildcard Model Configuration
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Automatically configure all available models from a provider using wildcard patterns. Plano expands wildcards at configuration load time to include all known models from the provider's registry.
|
||||
|
||||
**Basic Wildcard Usage:**
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
llm_providers:
|
||||
# Expand to all OpenAI models
|
||||
- model: openai/*
|
||||
access_key: $OPENAI_API_KEY
|
||||
|
||||
# Expand to all Anthropic Claude models
|
||||
- model: anthropic/*
|
||||
access_key: $ANTHROPIC_API_KEY
|
||||
|
||||
# Expand to all Mistral models
|
||||
- model: mistral/*
|
||||
access_key: $MISTRAL_API_KEY
|
||||
|
||||
**How Wildcards Work:**
|
||||
|
||||
1. **Known Providers** (OpenAI, Anthropic, DeepSeek, Mistral, Groq, Gemini, Together AI, xAI, Moonshot, Zhipu):
|
||||
|
||||
- Expands at config load time to all models in Plano's provider registry
|
||||
- Creates entries for both canonical (``openai/gpt-4``) and short names (``gpt-4``)
|
||||
- Enables the ``/v1/models`` endpoint to list all available models
|
||||
- **View complete model list**: `provider_models.yaml <../../includes/provider_models.yaml>`_
|
||||
|
||||
2. **Unknown/Custom Providers** (e.g., ``custom-provider/*``):
|
||||
|
||||
- Stores as a wildcard pattern for runtime matching
|
||||
- Requires ``base_url`` and ``provider_interface`` configuration
|
||||
- Matches model requests dynamically (e.g., ``custom-provider/any-model-name``)
|
||||
- Does not appear in ``/v1/models`` endpoint
|
||||
|
||||
**Overriding Wildcard Models:**
|
||||
|
||||
You can configure specific models with custom settings even when using wildcards. Specific configurations take precedence and are excluded from wildcard expansion:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
llm_providers:
|
||||
# Expand to all Anthropic models
|
||||
- model: anthropic/*
|
||||
access_key: $ANTHROPIC_API_KEY
|
||||
|
||||
# Override specific model with custom settings
|
||||
# This model will NOT be included in the wildcard expansion above
|
||||
- model: anthropic/claude-sonnet-4-20250514
|
||||
access_key: $ANTHROPIC_PROD_API_KEY
|
||||
routing_preferences:
|
||||
- name: code_generation
|
||||
priority: 1
|
||||
|
||||
# Another specific override
|
||||
- model: anthropic/claude-3-haiku-20240307
|
||||
access_key: $ANTHROPIC_DEV_API_KEY
|
||||
|
||||
**Custom Provider Wildcards:**
|
||||
|
||||
For providers not in Plano's registry, wildcards enable dynamic model routing:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
llm_providers:
|
||||
# Custom LiteLLM deployment
|
||||
- model: litellm/*
|
||||
base_url: https://litellm.example.com
|
||||
provider_interface: openai
|
||||
passthrough_auth: true
|
||||
|
||||
# Custom provider with all models
|
||||
- model: custom-provider/*
|
||||
access_key: $CUSTOM_API_KEY
|
||||
base_url: https://api.custom-provider.com
|
||||
provider_interface: openai
|
||||
|
||||
**Benefits:**
|
||||
|
||||
- **Simplified Configuration**: One line instead of listing dozens of models
|
||||
- **Future-Proof**: Automatically includes new models as they're released
|
||||
- **Flexible Overrides**: Customize specific models while using wildcards for others
|
||||
- **Selective Expansion**: Control which models get custom configurations
|
||||
|
||||
Default Model Configuration
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue