langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

community[minor]: Adds BedrockCohereEmbeddings class + tests

Open vishalseshagiri opened this issue 10 months ago • 4 comments

  • 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

vishalseshagiri avatar Apr 22 '24 07:04 vishalseshagiri

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

vercel[bot] avatar Apr 22 '24 07:04 vercel[bot]

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

jacoblee93 avatar Apr 22 '24 21:04 jacoblee93

@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

vishal-oogway avatar Apr 22 '24 22:04 vishal-oogway

FYI: This will easily run into the 96 max document limit in the AWS API. We had to add batching logic to the calls to avoid errors.

tomi-bigpi avatar Jun 29 '24 20:06 tomi-bigpi