You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the PRs adding new providers – it's great to see Ruby LLM expanding! As we add support for meta-providers like Bedrock (#50) and OpenRouter (#29), which resell access to models from OpenAI, Anthropic, etc., we need a consistent approach to model names.
The Problem
Right now, we're at risk of inconsistent naming like:
claude-3-5-sonnet-20241022 (direct from Anthropic)
This creates an unnecessary cognitive burden and makes switching providers harder than it needs to be.
The Ruby LLM Way
We'll implement a cleaner approach separating what (model) from where (provider):
# Default way (from the native provider)chat=RubyLLM.chat(model: "claude-3-5-sonnet")# Same model via different providerchat=RubyLLM.chat(model: "claude-3-5-sonnet",provider: :bedrock)
This has several benefits:
Clean API - Model names stay simple and consistent
Provider flexibility - Switch providers without changing model references
Future-proof - New providers can be added without disrupting existing code
Managing models.json
For all providers, including those with large model catalogs like OpenRouter, Ollama, and HuggingFace:
Comprehensive models.json - We'll maintain a comprehensive models.json file that includes models from all supported providers
Easy refreshing - Users can update their local models catalog with RubyLLM.models.refresh! when needed
Regular updates - We'll keep the distributed models.json up-to-date through automated processes
This approach provides the best balance of simplicity, usability, and maintainability.
Model Aliases
To handle provider-specific model identifiers and versions, we'll implement a global model alias system:
Global aliases.json - We'll maintain a central aliases.json file mapping friendly model names to provider-specific identifiers
Provider mapping - Each provider implementation will use these aliases to map standard names to their specific format
This allows users to use consistent model names regardless of provider:
# These all use the same logical model through different providerschat1=RubyLLM.chat(model: "claude-3-5-sonnet")# Uses Anthropic directlychat2=RubyLLM.chat(model: "claude-3-5-sonnet",provider: :bedrock)# Uses via AWS Bedrockchat3=RubyLLM.chat(model: "claude-3-5-sonnet",provider: :openrouter)# Uses via OpenRouter
If a model can't be found with the provided ID and provider, a ModelNotFoundError will be raised with an informative message. Your implementation should make this error helpful by suggesting available alternatives.
When the same model has multiple versions and context windows e.g.
Question - When Bedrock provides four versions of the same model, what should aliases.json and models.json look like? For example, claude-3-5-sonnet-20241022-v2:0 has these model ids available in Bedrock:
Thanks for the PRs adding new providers – it's great to see Ruby LLM expanding! As we add support for meta-providers like Bedrock (#50) and OpenRouter (#29), which resell access to models from OpenAI, Anthropic, etc., we need a consistent approach to model names.
The Problem
Right now, we're at risk of inconsistent naming like:
claude-3-5-sonnet-20241022
(direct from Anthropic)anthropic.claude-3-5-sonnet-20241022-v2:0:200k
(via Bedrock)anthropic/claude-3.5-sonnet
(via OpenRouter)This creates an unnecessary cognitive burden and makes switching providers harder than it needs to be.
The Ruby LLM Way
We'll implement a cleaner approach separating what (model) from where (provider):
This has several benefits:
Managing models.json
For all providers, including those with large model catalogs like OpenRouter, Ollama, and HuggingFace:
RubyLLM.models.refresh!
when neededThis approach provides the best balance of simplicity, usability, and maintainability.
Model Aliases
To handle provider-specific model identifiers and versions, we'll implement a global model alias system:
aliases.json
file mapping friendly model names to provider-specific identifiersExample aliases.json structure:
This allows users to use consistent model names regardless of provider:
If a model can't be found with the provided ID and provider, a
ModelNotFoundError
will be raised with an informative message. Your implementation should make this error helpful by suggesting available alternatives.When the same model has multiple versions and context windows e.g.
We default all aliases to the biggest context window, and the main alias (without date) to the latest version:
Implementation Guidelines for Contributors
If you're adding a new provider:
list_models
method for refreshingFor meta-providers (like Bedrock) that access models from existing providers:
This keeps Ruby LLM's API clean and intuitive while giving users the flexibility to choose how they access their models.
The text was updated successfully, but these errors were encountered: