.ipynb
.pdf
Qdrant
Qdrant#
This notebook shows how to use functionality related to the Qdrant vector database.
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Qdrant
from langchain.document_loaders import TextLoader
from langchain.document_loaders import TextLoader
loader = TextLoader('../../state_of_the_union.txt')
documents = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
docs = text_splitter.split_documents(documents)
embeddings = OpenAIEmbeddings()
host = "<---host name here --->"
api_key = "<---api key here--->"
qdrant = Qdrant.from_documents(docs, embeddings, host=host, prefer_grpc=True, api_key=api_key)
query = "What did the president say about Ketanji Brown Jackson"
docs = qdrant.similarity_search(query)
docs[0]
previous
Pinecone
next
Redis
By Harrison Chase
    
      © Copyright 2023, Harrison Chase.
      
  Last updated on Mar 22, 2023.