Using Langchain4j with OpenSearch Service Collections

0

Wonder if it is possible to use Langchain4j with OpenSearch Service Collections. Based off of the Langchain4j documentation there is a way to use the OpenSearch Embedding store: https://github.com/langchain4j/langchain4j-examples/blob/main/opensearch-example/src/main/java/OpenSearchEmbeddingStoreExample.java.

I am trying to do this, but with the Amazon OpenSearch service Collections. I have a collection and index created. Right now, here is a snippet of my code from lambda

EmbeddingStore<TextSegment> embeddingStore = OpenSearchEmbeddingStore.builder()
                    .serverUrl(<MY_OPENSEARCH_ENDPOINTt>)
                    .build();

I have no problem creating and building the embedding store, but once I try to do embeddingStore.add(), I am getting this error: Request failed: [Forbidden] 403 Forbidden. What permissions do I need to have within my Collection and Lambda in order to allow me to add text to the embeddingStore?

Within my lambda, I have these permissions: - Effect: Allow Action: - aoss:* Resource: "*"

demandé il y a 2 mois83 vues
1 réponse
2

Hello,

Upon examining the code, I cannot see any provisions for sending a signed request. As you are encountering a 403 error, which typically indicates an authentication issue, rather than the library being incapable of sending a signed request, I would kindly request that you verify your ability to send a signed request using Langchain4j.

Signed Request to OpenSearch Serverless: https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-clients.html

Additionally, I have observed that there is already an open feature request to support OpenSearch Serverless: https://github.com/langchain4j/langchain4j/issues/1324

Furthermore, I have found an online documentation resource that demonstrates how to establish a connection with Python: https://caylent.com/blog/building-a-rag-with-open-search-serverless-and-lang-chain

Thank you!

AWS
INGÉNIEUR EN ASSISTANCE TECHNIQUE
répondu il y a 2 mois
profile picture
EXPERT
vérifié il y a 2 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions