Skip to content

chore: Upgrade default model to command-r-08-2024 #1691

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

Merged
merged 3 commits into from
May 5, 2025

Conversation

vblagoje
Copy link
Member

@vblagoje vblagoje commented May 2, 2025

Why:

This PR upgrades the Cohere integration to use the command-r-08-2024 chat model. Compared to command-r, the command-r-08-2024 model seems to have more modern tool support and it works well with Haystack Agent. The old command-r had issues with resolving tools with OpenAI tool JSON format which we use. This description has been updated after we found out that command-r-08-2024 works well with our tooling architecture. The discussion below refers to command-r-plus which we though of using but have since found an update to command-r that is command-r-08-2024 - which works well.

What:

  • Updated the Cohere integration to reference command-r-08-2024 instead of command-r.
  • Adjusted associated test cases to validate against the updated model.

How can it be used:

No changes needed from the user—new pipelines using Cohere will default to the upgraded model automatically.

How did you test it:

  • Ran unit tests to validate output structure and model invocation.
  • Confirmed compatibility with existing tool use cases and RAG patterns.

Notes for the reviewer:

  • Focus on verifying model name substitution and test coverage.

@vblagoje vblagoje requested a review from a team as a code owner May 2, 2025 12:48
@vblagoje vblagoje requested review from davidsbatista and removed request for a team May 2, 2025 12:49
@github-actions github-actions bot added integration:cohere type:documentation Improvements or additions to documentation labels May 2, 2025
@vblagoje vblagoje requested review from julian-risch and removed request for davidsbatista May 2, 2025 12:51
@vblagoje
Copy link
Member Author

vblagoje commented May 2, 2025

@julian-risch in addition manually verified to work nicely with agents.

Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the costs of command-r-plus are about ten times as high as costs of command-r, I don't think it's a good idea to change the default model. Users might be surprised by the increase of costs, no?
image

@julian-risch
Copy link
Member

Updating only the usage example and the https://haystack.deepset.ai/integrations/cohere integration page seems good to me though.

@vblagoje
Copy link
Member Author

vblagoje commented May 2, 2025

Ok, I don't mind, but command-r is two generations behind and command-r-plus cost is inline with top of the line models from various providers

@vblagoje
Copy link
Member Author

vblagoje commented May 2, 2025

We can leave this PR around and trigger integration - when needed

@julian-risch
Copy link
Member

julian-risch commented May 2, 2025

Let's get an opinion from another team member. We could release a new major version cohere-v5.0.0 with that change.

And we could also briefly explain the change in the weekly announcement https://github.com/deepset-ai/devrel-board/issues/604

@davidsbatista
Copy link
Contributor

What about a warning, just something in the stdout warning the user that this current release changed the default model, and the price is 10x more? We would then remove it in the next release.

@vblagoje
Copy link
Member Author

vblagoje commented May 2, 2025

Yes, no problem, new piece of information: we should also investigate the situation why command-r doesn't work with our agent while command-r-plus and command-a do. Including multiple tool calls.

Traceback (most recent call last):
  File "/Users/vblagoje/workspace/itinerary-agent/itinerary_agent.py", line 100, in <module>
    main()
  File "/Users/vblagoje/workspace/itinerary-agent/itinerary_agent.py", line 83, in main
    result = agent.run(
  File "/Users/vblagoje/miniconda3/envs/mcp_test/lib/python3.10/site-packages/haystack/components/agents/agent.py", line 255, in run
    llm_messages = Pipeline._run_component(
  File "/Users/vblagoje/miniconda3/envs/mcp_test/lib/python3.10/site-packages/haystack/core/pipeline/pipeline.py", line 62, in _run_component
    raise PipelineRuntimeError.from_exception(component_name, instance.__class__, error) from error
haystack.core.errors.PipelineRuntimeError: The following component failed to run:
Component name: 'chat_generator'
Component type: 'CohereChatGenerator'
Error: status_code: 422, body: {'message': 'No valid tool call or response generated'}

This one I found confusing because we do test for tool calling in cohere with command-r using actual live model yet agent doesn't like this format. Could be something simple, some setting, I'll open a new issue. Here it is: #1693

@vblagoje
Copy link
Member Author

vblagoje commented May 2, 2025

What about a warning, just something in the stdout warning the user that this current release changed the default model, and the price is 10x more? We would then remove it in the next release.

It is very common that such old models are cheap and new ones are more expensive. See the price chat above - nothing out of the ordinary here requiring warnings IMHO

@davidsbatista
Copy link
Contributor

Even if all other models have the same base price as the new default, we should make clear to the user that this integration has changed, and the default model cost is now 10x the previous default.

@davidsbatista
Copy link
Contributor

Maybe a release note is enough, but 10x is a big difference!

@vblagoje vblagoje changed the title chore: Upgrade default model to command-r-plus chore: Upgrade default model to command-r-08-2024 May 5, 2025
@vblagoje vblagoje requested a review from julian-risch May 5, 2025 13:02
@vblagoje
Copy link
Member Author

vblagoje commented May 5, 2025

@julian-risch and @davidsbatista I've updated description to reflect the finding that the command-r-08-2024 works well with out tooling architecture. And it is most likely that the old model, command-r, although compatible with V2 API, isn't actually updated to handle the new tooling format - I could not get it to work with multiple tool definitions in a new OpenAI tool definition format.

Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍
command-r is an alias for command-r-03-2024 (Cohere docs)
and while command-r-03-2024 is not deprecated yet, support for models fine-tuned with Command-R-03-2024 ended on March 08, 2025. (Cohere docs)
For that reason, I believe it's a good idea to update our default from command-r-03-2024 to command-r-08-2024. And my understanding is that the price doesn't change at all, which is good.

@vblagoje vblagoje merged commit e830011 into main May 5, 2025
10 checks passed
@vblagoje vblagoje deleted the new_default_chat_cohere_model branch May 5, 2025 14:16
@vblagoje
Copy link
Member Author

vblagoje commented May 5, 2025

Included in https://pypi.org/project/cohere-haystack/4.1.0/ release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration:cohere type:documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants