This guide shows you how to implement semantic search using LangChain and similarity search.
setup.py
file.
Before writing any code, install the necessary dependencies:
setup.py
file with some boilerplate code:
userProvided
source which requires to specify the size of the vectors in a dimensions
field. The default model used by OpenAIEmbeddings()
is text-embedding-ada-002
, which has 1,536 dimensions.
search.py
file to make a semantic search query: searching for documents using similarity search.
search.py
. If everything is working correctly, you should see an output like this: