aws-samples / amazon-bedrock-workshop

This is a workshop designed for Amazon Bedrock a foundational model service.
https://catalog.us-east-1.prod.workshops.aws/amazon-bedrock/en-US
MIT No Attribution
1.45k stars 624 forks source link

'BedrockEmbeddings' object is not callable #142

Closed haiderghaleb closed 6 months ago

haiderghaleb commented 11 months ago

Hey everyone,

I'm facing issues while running 01_qa_w_rag_claude.ipynb, everything is configured correcting and running until the step of

query_embedding = vectorstore_faiss.embedding_function(query)
np.array(query_embedding)

when I run it, I get the below error:

[amazon-bedrock-workshop/03_QuestionAnswering/01_qa_w_rag_claude.ipynb] Cell 22 line 1
----> [1](amazon-bedrock-workshop/03_QuestionAnswering/01_qa_w_rag_claude.ipynb#X30sZmlsZQ%3D%3D?line=0) query_embedding = vectorstore_faiss.embedding_function(query)
      [2](amazon-bedrock-workshop/03_QuestionAnswering/01_qa_w_rag_claude.ipynb#X30sZmlsZQ%3D%3D?line=1) np.array(query_embedding)

TypeError: 'BedrockEmbeddings' object is not callable

I tried to see how to fix the issue, but there was no solution.

Does anyone know how to fix this issue?

BehnooshParsa commented 11 months ago

I changed the code to the following and it worked. query_embedding = vectorstore_faiss.embedding_function.embed_query(query)

rsgrewal-aws commented 10 months ago

@BehnooshParsa could you please raise a PR for the fix

egor-miasnikov commented 10 months ago

PR https://github.com/aws-samples/amazon-bedrock-workshop/pull/156

w601sxs commented 6 months ago

Closing this; please refer to the latest bedrock workshop update and reopen if still relevant