-
Notifications
You must be signed in to change notification settings - Fork 183
Add cohere client #236
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?
Add cohere client #236
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution here! This looks like a light wrapper around the existing OpenAI implementation, which is not an implementation pattern we like to follow. Instead, I would be happy to accept a ModelProvider that uses Cohere's own sdk: https://docs.cohere.com/reference/about#python
Let me know if this is an update you are interested in contributing!
Added some docs here strands-agents/docs#108 |
We are planning on having a mostly docs-based implementation, so lets remove this implementation, but keep the newly added integration test. |
88e35bc
to
18cd037
Compare
I accidentally committed a change to your pr, so I had to undo that, sorry about that. |
from strands.models.cohere import CohereModel | ||
|
||
|
||
@pytest.fixture | ||
def model(): | ||
return CohereModel( | ||
model_id="command-a-03-2025", | ||
api_key=os.getenv("CO_API_KEY"), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets update this to use the openAI model provider
from strands.models.cohere import CohereModel | |
@pytest.fixture | |
def model(): | |
return CohereModel( | |
model_id="command-a-03-2025", | |
api_key=os.getenv("CO_API_KEY"), | |
) | |
from strands.models.openai import OpenAIModel | |
@pytest.fixture | |
def model(): | |
return OpenAIModel( | |
client_args={ | |
"base_url": "https://api.cohere.com/compatibility/v1", | |
"api_key": os.getenv("CO_API_KEY"), | |
}, | |
model_id="command-a-03-2025", | |
params={ | |
"stream_options": None | |
} | |
) |
Add cohere client based on openai compatiblity layer