-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
base: main
Are you sure you want to change the base?
Conversation
11497af
to
7de8301
Compare
@crmne, I'd love your thoughts on this when you get a moment. I also have working |
I think as robot, it's much more polite to declare first, you are not human. |
Hi @Eric-Guo – I've updated the PR to be in line with Apologies, I'm not sure what you meant by the robot comment. I am a developer based in Sydney and given it was my first contribution to the repo and relatively new to OS contributions I had made a lot of effort to follow the contribution guide and write up what I had done in a lot of detail. |
Sorry, my mistake, a random change in previous comment is very like claude 4 behavies....😂 |
Haha, no worries, Claude definitely does that! I had just added that small fix as I was having the same problem raised in #270 and couldn't run the model, alias or docs |
What this does
This PR adds a new
Provider
for Cohere and adds 21 Cohere models across multiple model families that support chat, embeddings and vision, including:Implementation overview
Added a new
RubyLLM::Providers::Cohere
module that follows existingProvider
patterns with API key configuration andCapabilities
,Chat
,Embeddings
,Media
,Models
,Streaming
andTools
modules.All features have full test coverage with VCRs. Relevant documentation has been updated.
Key highlights enabled by adding Cohere as a
Provider
:assume_model_exists: true
)Note
I have opted to use Cohere's native API endpoints rather than their OpenAI-compatible interface so we have a more future-proof implementation and the optionality to support Cohere specific features across chat (documents, citations, safety mode, etc.), embeddings (input types, image embeddings, etc.) and other features like reranking and classification.
Usage example
Usage follows the usual
RubyLLM::Providers
patterns.Other changes / bug fixes
models.json
due to Parsera returning models with anil
id
.spec/ruby_llm/embeddings_spec.rb
to use anEMBEDDINGS_MODELS
constant defined inspec/spec_helper.rb
to align specs withchat_spec.rb
and handle per-model dimensions. The 768 previously hardcoded is invalid for Cohere modelsFuture plans
Note – this PR is the first in a series I intend to contribute. In the future I would love to also add support for the below features that I think would be useful to other RubyLLM users if you are open to it @crmne!
Type of change
Scope check
Quality check
overcommit --install
and all hooks passmodels.json
,aliases.json
)API changes
Related issues
No related issues.