Replies: 1 comment
-
The "Unexpected Response: 404 (Not Found)" error typically indicates that the specified collection does not exist in Qdrant or the Qdrant server is not accessible at the provided URL. Here are a few steps to resolve this issue:
from langchain_community.document_loaders import TextLoader
from langchain_openai import OpenAIEmbeddings
from langchain_qdrant import QdrantVectorStore
from langchain_text_splitters import CharacterTextSplitter
from langchain_qdrant import FastEmbedSparse, RetrievalMode
# Load and split documents
loader = TextLoader("test_file.txt")
documents = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
docs = text_splitter.split_documents(documents)
# Initialize embeddings
embedding = OpenAIEmbeddings()
sparse_embeddings = FastEmbedSparse(model_name="Qdrant/bm25")
# Qdrant server URL
url = "http://localhost:6333"
# Create or access the Qdrant collection
qdrant = QdrantVectorStore.from_documents(
docs,
embedding=embedding,
url=url,
sparse_embedding=sparse_embeddings,
collection_name="Hybrid_TEST",
retrieval_mode=RetrievalMode.HYBRID,
force_recreate=True,
)
# Perform similarity search
query = "what is ?"
similar_docs = qdrant.similarity_search_with_score(query)
print(similar_docs)
By following these steps, you should be able to resolve the "404 (Not Found)" error and get the similarity search results [1][2]. |
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
When i pass the query, i am not getting the reponse. Currently I am getting the reponse as
"qdrant_client.http.exceptions.UnexpectedResponse: Unexpected Response: 404 (Not Found)
Raw response content:
b'' "
System Info
langchain==0.2.10
langchain-community==0.2.9
langchain-core==0.2.22
langchain-openai==0.1.17
langchain-qdrant==0.1.2
langchain-text-splitters==0.2.2
Beta Was this translation helpful? Give feedback.
All reactions