Skip to content

Commit c41c6ed

Browse files
committed
Add guidelines for model naming convention and provider strategy in CONTRIBUTING.md
1 parent b3eaaca commit c41c6ed

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

CONTRIBUTING.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,49 @@ git commit
4141
gh pr create --web
4242
```
4343

44+
## Model Naming Convention & Provider Strategy
45+
46+
When adding new providers to RubyLLM, please follow these guidelines:
47+
48+
### Normalized Model IDs
49+
50+
We use a consistent approach separating **what** (model) from **where** (provider):
51+
52+
```ruby
53+
# Default way (from the native provider)
54+
chat = RubyLLM.chat(model: "claude-3-5-sonnet")
55+
56+
# Same model via different provider
57+
chat = RubyLLM.chat(model: "claude-3-5-sonnet", provider: :bedrock)
58+
```
59+
60+
### Implementing a Provider
61+
62+
If you're adding a new provider:
63+
64+
1. **Use normalized model IDs** - Don't include provider prefixes in the model ID itself
65+
2. **Add provider mapping** - Map the normalized IDs to your provider's specific format internally
66+
3. **Preserve capabilities** - Ensure models accessed through your provider report the same capabilities as their native counterparts
67+
4. **Update models.json** - Include your provider's models in models.json
68+
5. **Update aliases.json** - Add entries to aliases.json for models accessible through your provider
69+
6. **Implement refresh mechanism** - Ensure your provider supports the `list_models` method for refreshing
70+
71+
### Model Aliases
72+
73+
For providers that use complex model identifiers (like Bedrock's `anthropic.claude-3-5-sonnet-20241022-v2:0:200k`), add mappings to the global aliases.json file:
74+
75+
```json
76+
{
77+
"claude-3-5-sonnet": {
78+
"anthropic": "claude-3-5-sonnet-20241022",
79+
"bedrock": "anthropic.claude-3-5-sonnet-20241022-v2:0:200k",
80+
"openrouter": "anthropic/claude-3.5-sonnet"
81+
}
82+
}
83+
```
84+
85+
This allows users to use consistent model names regardless of provider.
86+
4487
## Running Tests
4588

4689
Tests automatically use VCR to record and replay HTTP interactions, so you don't need real API keys for testing:

0 commit comments

Comments
 (0)