Skip to content

Add Cohere Provider support #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f52d211
Add Cohere API key configuration
infinityrobot Jul 7, 2025
9cef065
Add base Cohere Provider
infinityrobot Jul 7, 2025
552d894
Add Cohere Capabilities and Models modules
infinityrobot Jul 7, 2025
42b18c3
Add initial Cohere Chat and Embeddings module implementations
infinityrobot Jul 7, 2025
21bfcd4
Add Cohere model support to model and alias rake tasks
infinityrobot Jul 7, 2025
84e17c3
Add Cohere models support to Chat and Vision model specs
infinityrobot Jul 7, 2025
5aa271f
Refactor Embeddings spec to use Constant and custom model dimensions
infinityrobot Jul 7, 2025
eda8151
Add skipped specs for image embeddings to note for future support
infinityrobot Jul 7, 2025
b4fa7a8
Skip Cohere vision model when using remote images in specs
infinityrobot Jul 7, 2025
f6b3511
Add Cohere API key config to documentation
infinityrobot Jul 7, 2025
ddabbab
Remove accidental extend of in progress Cohere::Reranking module
infinityrobot Jul 7, 2025
4ee3228
Update models.json
infinityrobot Jul 7, 2025
c8e659c
Update aliases.json
infinityrobot Jul 7, 2025
0ecbec9
Update VCRs for Cohere model specs
infinityrobot Jul 7, 2025
d41ba45
Fix Parsera nil model ID handling in models.rb
infinityrobot Jul 7, 2025
8c57040
Update available model docs
infinityrobot Jul 7, 2025
b5a6865
Remove empty line in Cohere models module
infinityrobot Jul 7, 2025
7de8301
Remove Rerank reference from Cohere module comment
infinityrobot Jul 7, 2025
3aeaa5f
Add Cohere logos to documentation
infinityrobot Jul 8, 2025
fe9856d
Merge remote-tracking branch 'upstream/main' into add-cohere-provider
infinityrobot Jul 18, 2025
209ae93
Run rake models:update models:docs aliases:generate
infinityrobot Jul 18, 2025
f0083c3
Update Cohere embeddings implementation for updates made in #267
infinityrobot Jul 18, 2025
0cded6f
Rerun Cohere VCRs
infinityrobot Jul 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/bedrock-color.svg" alt="Bedrock" class="logo-medium">
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/bedrock-text.svg" alt="Bedrock" class="logo-small">
&nbsp;
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/cohere-color.svg" alt="Cohere" class="logo-medium">
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/cohere-text.svg" alt="Cohere" class="logo-medium">
&nbsp;
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/deepseek-color.svg" alt="DeepSeek" class="logo-medium">
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/deepseek-text.svg" alt="DeepSeek" class="logo-small">
&nbsp;
Expand Down
1 change: 1 addition & 0 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RubyLLM.configure do |config|
config.anthropic_api_key = ENV.fetch('ANTHROPIC_API_KEY', nil)
config.gemini_api_key = ENV.fetch('GEMINI_API_KEY', nil)
config.deepseek_api_key = ENV.fetch('DEEPSEEK_API_KEY', nil)
config.cohere_api_key = ENV.fetch('COHERE_API_KEY', nil)
config.openrouter_api_key = ENV.fetch('OPENROUTER_API_KEY', nil)
config.ollama_api_base = ENV.fetch('OLLAMA_API_BASE', nil)
config.bedrock_api_key = ENV.fetch('AWS_ACCESS_KEY_ID', nil)
Expand Down
2 changes: 2 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ RubyLLM.configure do |config|
config.anthropic_api_key = ENV.fetch('ANTHROPIC_API_KEY', nil)
config.gemini_api_key = ENV.fetch('GEMINI_API_KEY', nil)
config.deepseek_api_key = ENV.fetch('DEEPSEEK_API_KEY', nil)
config.cohere_api_key = ENV.fetch('COHERE_API_KEY', nil)
config.openrouter_api_key = ENV.fetch('OPENROUTER_API_KEY', nil)
config.ollama_api_base = ENV.fetch('OLLAMA_API_BASE', nil)

Expand Down Expand Up @@ -104,6 +105,7 @@ Set the corresponding `*_api_key` attribute for each provider you want to enable
* `anthropic_api_key`
* `gemini_api_key`
* `deepseek_api_key`
* `cohere_api_key`
* `openrouter_api_key`
* `bedrock_api_key`, `bedrock_secret_key`, `bedrock_region`, `bedrock_session_token` (See AWS documentation for standard credential methods if not set explicitly).

Expand Down
400 changes: 241 additions & 159 deletions docs/guides/available-models.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/guides/rails.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ RubyLLM.configure do |config|
# Add other provider configurations as needed
config.anthropic_api_key = ENV['ANTHROPIC_API_KEY']
config.gemini_api_key = ENV['GEMINI_API_KEY']
config.cohere_api_key = ENV['COHERE_API_KEY']
# ...
end
```
Expand Down
4 changes: 4 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ A delightful Ruby way to work with AI through a unified interface to Anthropic,
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/bedrock-color.svg" alt="Bedrock" class="logo-medium">
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/bedrock-text.svg" alt="Bedrock" class="logo-small">
</div>
<div class="provider-logo">
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/cohere-color.svg" alt="Cohere" class="logo-medium">
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/cohere-text.svg" alt="Cohere" class="logo-medium">
</div>
<div class="provider-logo">
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/deepseek-color.svg" alt="DeepSeek" class="logo-medium">
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/deepseek-text.svg" alt="DeepSeek" class="logo-small">
Expand Down
1 change: 1 addition & 0 deletions lib/ruby_llm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def logger
RubyLLM::Provider.register :anthropic, RubyLLM::Providers::Anthropic
RubyLLM::Provider.register :gemini, RubyLLM::Providers::Gemini
RubyLLM::Provider.register :deepseek, RubyLLM::Providers::DeepSeek
RubyLLM::Provider.register :cohere, RubyLLM::Providers::Cohere
RubyLLM::Provider.register :bedrock, RubyLLM::Providers::Bedrock
RubyLLM::Provider.register :openrouter, RubyLLM::Providers::OpenRouter
RubyLLM::Provider.register :ollama, RubyLLM::Providers::Ollama
Expand Down
12 changes: 12 additions & 0 deletions lib/ruby_llm/aliases.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@
"openrouter": "anthropic/claude-sonnet-4",
"bedrock": "us.anthropic.claude-sonnet-4-20250514-v1:0"
},
"command-r": {
"cohere": "command-r-08-2024",
"openrouter": "cohere/command-r-08-2024"
},
"command-r-plus": {
"cohere": "command-r-plus-08-2024",
"openrouter": "cohere/command-r-plus-08-2024"
},
"command-r7b": {
"cohere": "command-r7b-12-2024",
"openrouter": "cohere/command-r7b-12-2024"
},
"deepseek-chat": {
"deepseek": "deepseek-chat",
"openrouter": "deepseek/deepseek-chat"
Expand Down
1 change: 1 addition & 0 deletions lib/ruby_llm/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Configuration
:anthropic_api_key,
:gemini_api_key,
:deepseek_api_key,
:cohere_api_key,
:bedrock_api_key,
:bedrock_secret_key,
:bedrock_region,
Expand Down
Loading