Draft
Conversation
Collaborator
andreibondarev
commented
Nov 25, 2024
- Bump up cohere gem to ~> 1.0.1
- Enable Assistant support for Cohere
* Bump up cohere gem to ~> 1.0.1 * Enable Assistant support for Cohere
There was a problem hiding this comment.
Pull Request Overview
This PR upgrades the Cohere integration by bumping the cohere gem version to ~> 1.0.1 and enabling assistant support for Cohere. Key changes include:
- Updating response parsing in CohereResponse to match the new Cohere API schema.
- Adjusting the embed and chat methods in the Cohere wrapper.
- Introducing CohereMessage and a new Cohere adapter in the assistant module to support tool calls and message formatting.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/langchain/llm/response/cohere_response.rb | Adjusts response parsing and token calculation methods to conform with Cohere API changes. |
| lib/langchain/llm/cohere.rb | Upgrades the gem version and revises parameter handling in embed and chat methods. |
| lib/langchain/assistant/messages/cohere_message.rb | Introduces a new message class for Cohere with support for tool calls and role handling. |
| lib/langchain/assistant/llm/adapters/cohere.rb | Adds a Cohere adapter, including chat parameter construction and tool build logic. |
| lib/langchain/assistant/llm/adapter.rb | Updates the adapter selection logic to include the new Cohere adapter. |
| langchain.gemspec | Bumps the development dependency for cohere-ruby to ~> 1.0.1. |
Comments suppressed due to low confidence (1)
lib/langchain/llm/cohere.rb:88
- The removal of the mandatory check for an empty messages argument may lead to unexpected behavior if an empty array is passed. Consider adding validation to ensure that messages are provided.
def chat(params = {})
| # @param tool_choice [String] The tool choice | ||
| # @param parallel_tool_calls [Boolean] Whether to make parallel tool calls | ||
| # @return [Hash] The chat parameters | ||
| def build_chat_params( |
There was a problem hiding this comment.
Consider providing a default value for the 'parallel_tool_calls' parameter to avoid a potential ArgumentError when it is not supplied.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.