Use this file to discover all available pages before exploring further.
Compatibility: Only available on Node.js.
Qdrant is a vector similarity search engine. It provides a production-ready service with a convenient API to store, search, and manage points - vectors with an additional payload.This guide provides a quick overview for getting started with Qdrant vector stores. For detailed documentation of all QdrantVectorStore features and configurations head to the API reference.
To use Qdrant vector stores, you’ll need to set up a Qdrant instance and install the @langchain/qdrant integration package.This guide will also use OpenAI embeddings, which require you to install the @langchain/openai integration package. You can also use other supported embeddings models if you wish.
After installing the required dependencies, run a Qdrant instance with Docker on your computer by following the Qdrant setup instructions. Note the URL your container runs on.
import type { Document } from "@langchain/core/documents";const document1: Document = { pageContent: "The powerhouse of the cell is the mitochondria", metadata: { source: "https://example.com" }};const document2: Document = { pageContent: "Buildings are made out of brick", metadata: { source: "https://example.com" }};const document3: Document = { pageContent: "Mitochondria are made out of lipids", metadata: { source: "https://example.com" }};const document4: Document = { pageContent: "The 2024 Olympics are in Paris", metadata: { source: "https://example.com" }}const documents = [document1, document2, document3, document4];await vectorStore.addDocuments(documents);
Top-level document ids and deletion are currently not supported.
Once your vector store has been created and the relevant documents have been added you will most likely wish to query it during the running of your chain or agent.
* The powerhouse of the cell is the mitochondria [{"source":"https://example.com"}]* Mitochondria are made out of lipids [{"source":"https://example.com"}]
See this page for more on Qdrant filter syntax. Note that all values must be prefixed with metadata.If you want to execute a similarity search and receive the corresponding scores you can run:
* [SIM=0.165] The powerhouse of the cell is the mitochondria [{"source":"https://example.com"}]* [SIM=0.148] Mitochondria are made out of lipids [{"source":"https://example.com"}]
[ Document { pageContent: 'The powerhouse of the cell is the mitochondria', metadata: { source: 'https://example.com' }, id: undefined }, Document { pageContent: 'Mitochondria are made out of lipids', metadata: { source: 'https://example.com' }, id: undefined }]