Is your feature request related to a problem? Please describe.
Support for AWS Bedrock has been provided for PromptModel nodes, it could be usefull to provide it also from the EmbeddingRetriever as AWS BedRock provide not only access to LLM but also Embedding EndPoint (Cohere or AWS Titan), for Haystack v1.x
Describe the solution you'd like
For example in the YAML pipeline file :
- name: Retriever
type: EmbeddingRetriever
params:
document_store: DocumentStore
embedding_model: text-embedding-ada-002
top_k: 3
batch_size: 8
max_seq_len: 1536
api_key: ${RETRIEVER_PARAMS_API_KEY}
We could change the embedding_model string to somethings like aws-titan or aws-cohere and provide AWS credentials as model_kwargs just like the PromptModel
Describe alternatives you've considered
Implementing it myself using a Hacky way that relies on LiteLLM to make call to AWS Bedrock by creating a custom EmbeddingRetriever component. Here is the idea:
- Create a
_BedRockEmbeddingEncoder that inherits from _OpenAIEmbeddingEncoder and add this to the _EMBEDDING_ENCODERS dict with an override of the embed method
- Creating a BedrockEmbedding class that inherits from EmbeddingRetriever
- Simply set at initialisation of the class a modified
_EMBEDDING_ENCODERS dict that contains the new AWS-BedRock encoders
Additional context
I wanted to use LiteLLM because it provides a unified API to almost ALL LLM providers. I think it's a great backend.
Is your feature request related to a problem? Please describe.
Support for AWS Bedrock has been provided for PromptModel nodes, it could be usefull to provide it also from the EmbeddingRetriever as AWS BedRock provide not only access to LLM but also Embedding EndPoint (Cohere or AWS Titan), for Haystack v1.x
Describe the solution you'd like
For example in the YAML pipeline file :
We could change the
embedding_modelstring to somethings likeaws-titanoraws-cohereand provide AWS credentials asmodel_kwargsjust like thePromptModelDescribe alternatives you've considered
Implementing it myself using a Hacky way that relies on LiteLLM to make call to AWS Bedrock by creating a custom
EmbeddingRetrievercomponent. Here is the idea:_BedRockEmbeddingEncoderthat inherits from_OpenAIEmbeddingEncoderand add this to the_EMBEDDING_ENCODERSdict with an override of theembedmethod_EMBEDDING_ENCODERSdict that contains the new AWS-BedRock encodersAdditional context
I wanted to use LiteLLM because it provides a unified API to almost ALL LLM providers. I think it's a great backend.