Skip to content
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

community[minor]: Adds BedrockCohereEmbeddings class + tests #5167

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vishalseshagiri
Copy link

@vishalseshagiri vishalseshagiri commented Apr 22, 2024

  • Adds BedrockCohereEmbeddings class and associated tests, adds async keyword to BedrockEmbeddings.embedQuery function - Code credits to @BrianErikson (Most of the application code comes from their thread here). Some notes about the chosen design.
    • Consciously chose not to add conditions (to support Cohere embeddings) within the BedrockEmbeddings class to avoid making it brittle and unreadable.
    • Avoided extending the BedrockEmbeddings class in the BedrockCohereEmbeddings class since it'll have access to the protected _embedText function, which has no meaning in the context of the BedrockCohereEmbeddings class
  • Adds missing async keyword in the BedrockEmbeddings.embedQuery function

Fixes #3315

…eyword to BedrockEmbeddings.embedQuery function
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 22, 2024
Copy link

vercel bot commented Apr 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2024 7:16am
langchainjs-docs ❌ Failed (Inspect) Apr 22, 2024 7:16am

@dosubot dosubot bot added auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features auto:improvement Medium size change to existing code to handle new use-cases labels Apr 22, 2024
@@ -0,0 +1,84 @@
/* eslint-disable no-process-env */
Copy link

Choose a reason for hiding this comment

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

Hey team, I've reviewed the PR and noticed that the added code explicitly accesses and requires specific environment variables using process.env. I've flagged this for your attention to ensure the handling of environment variables aligns with best practices. Keep up the great work!

@jacoblee93 jacoblee93 changed the title Adds BedrockCohereEmbeddings class + tests community[minor]: Adds BedrockCohereEmbeddings class + tests Apr 22, 2024
@jacoblee93
Copy link
Collaborator

@efriis this is the direction we're heading in Python right?

@jacoblee93 jacoblee93 added the question Further information is requested label Apr 22, 2024
@vishal-oogway
Copy link

@efriis this is the direction we're heading in Python right?

Ooh looks like that's not the direction in Python https://github.com/langchain-ai/langchain/blob/master/libs/community/langchain_community/embeddings/bedrock.py#L144-L148. I can refactor it to mimic it, if that's the expectation @jacoblee93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features auto:improvement Medium size change to existing code to handle new use-cases question Further information is requested size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support New Bedrock Embeddings (Cohere)
3 participants