-
Notifications
You must be signed in to change notification settings - Fork 516
feat: add Cohere embedding integration #1305
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: develop
Are you sure you want to change the base?
Conversation
Documentation preview |
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.
Pull Request Overview
This PR adds Cohere as a new embedding provider to the NeMo Guardrails framework, enabling users to use Cohere's embedding models for document encoding tasks.
- Implements CohereEmbeddingModel class with both synchronous and asynchronous encoding methods
- Adds comprehensive test coverage for the new Cohere integration
- Updates documentation to include Cohere in the supported embedding providers table
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
nemoguardrails/embeddings/providers/cohere.py | Implements the CohereEmbeddingModel class with sync/async encoding capabilities |
nemoguardrails/embeddings/providers/init.py | Registers the new Cohere embedding provider in the system |
tests/test_embeddings_cohere.py | Adds comprehensive test coverage for Cohere embedding functionality |
tests/test_configs/with_cohere_embeddings/config.yml | Test configuration file for Cohere embeddings setup |
tests/test_configs/with_cohere_embeddings/config.co | Test flow configuration for validating Cohere integration |
docs/user-guides/configuration-guide.md | Updates documentation to include Cohere in supported providers table |
Comments suppressed due to low confidence (1)
tests/test_embeddings_cohere.py:70
- Function name
test_live_query
is duplicated. This function should have a distinct name liketest_live_query_sync
to differentiate it from the async version on line 52.
def test_live_query(app):
# async_client_var.set(async_client) | ||
# | ||
# # Make embedding request to Cohere API | ||
# embeddings = await async_client.embed(texts=documents, model=self.model, input_type=self.input_type).embeddings |
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.
The commented-out async implementation should be removed or properly documented with a TODO/FIXME comment explaining when it might be re-enabled, rather than leaving dead code in the implementation.
Copilot uses AI. Check for mistakes.
@bwook00 Thank you for your PR 🎉 Would you please enable pre-commits and apply it? Please see contributing guidelines. once it is enabled you can do:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1305 +/- ##
===========================================
- Coverage 70.45% 70.40% -0.05%
===========================================
Files 161 162 +1
Lines 16214 16241 +27
===========================================
+ Hits 11423 11434 +11
- Misses 4791 4807 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Description
Add Cohere Embedding provider
@Pouyanpi,
I added it along with #1304.
(It probably conflicts with 1304)
Checklist