langchainjs
langchainjs copied to clipboard
community[minor]: Adds BedrockCohereEmbeddings class + tests
- 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 theBedrockCohereEmbeddings
class since it'll have access to the protected_embedText
function, which has no meaning in the context of theBedrockCohereEmbeddings
class
- Adds missing async keyword in the
BedrockEmbeddings.embedQuery
function
Fixes #3315
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 |
@efriis this is the direction we're heading in Python right?
@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
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.