from langchain.vectorstores import FAISS
from langchain.schema import Document
docs = [
Document(page_content="Paris is the capital of France."),
Document(page_content="Berlin is the capital of Germany."),
Document(page_content="Tokyo is the capital of Japan.")
]
embeddings = OpenAIEmbeddings(openai_api_key="")
vectorstore = FAISS.from_documents(docs, embeddings)
query = "What is the capital of Germany?"
results = vectorstore.similarity_search(query, k=2)
print(results) # Expected: at least one Document about Berlin, but this prints []
< /code>
среда: < /p>
- langchain===0.0.297
3.9.16 < /li>
< /ul>
Ожидаемое поведение: searnity_search < /code> должен вернуть документ о Берлине или, по крайней мере, непустые списка. векторы (без ошибок при строительстве).
Подробнее здесь: https://stackoverflow.com/questions/797 ... ated-index