From the course: Level up LLM applications development with LangChain and OpenAI

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Querying the vector store

Querying the vector store

- [Instructor] So previously we have set up the vector store and now the goal is to query this vector store to perform similarity search. So we're going to first define a query. For example, we want to ask "Where did Harrison work?" And then we're going to run and allow to actually return a list of documents we're going to run from the vector store. Literally we're going to run this method, which is similarity search, like this, and then pass query as a parameter. Then you're going to have here this parameter, which is top_k, which is optional, which will allow to return the top most relevant results based on the given query. And so next we're going to print the results and allow to return just the first of the list, and return specifically the content value for every document object. So that's going to return a list of document objects. And every document has one attribute, which is page_content. You also have metadata for your information. So we are interested in this value. So…

Contents