AttributeError: 'function' object has no attribute 'embed_query' using Langchain FAISS vectorstore

73 views Asked by At

I'm following AWS Bedrock workshop here - https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/03_QuestionAnswering/01_qa_w_rag_claude.ipynb. Everything is working fine until I go to the following:

from langchain.chains.question_answering import load_qa_chain
from langchain.vectorstores import FAISS
from langchain.indexes import VectorstoreIndexCreator
from langchain.indexes.vectorstore import VectorStoreIndexWrapper

vectorstore_faiss = FAISS.from_documents(
    docs,
    bedrock_embeddings,
)

wrapper_store_faiss = VectorStoreIndexWrapper(vectorstore=vectorstore_faiss)
query = """Is it possible that I get sentenced to jail due to failure in filings?"""

query_embedding = vectorstore_faiss.embedding_function.embed_query(query)

I get the following error on the last line:

AttributeError: 'function' object has no attribute 'embed_query'

I get the following error on the last line:

AttributeError: 'function' object has no attribute 'embed_query'
0

There are 0 answers