mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-13 14:50:00 +00:00
fix(docs): handle collection not found error on RAG tutorial when qdrant is selected as vectorStore (#32099)
In [Rag Part 1 Tutorial](https://python.langchain.com/docs/tutorials/rag/), when QDrant vector store is selected, the sample code does not work It fails with error `ValueError: Collection test not found` So, this fix is creating that collection and ensuring its dimension size is matching the selection the embedding size of the selected LLM Model --------- Co-authored-by: Mason Daugherty <mason@langchain.dev> Co-authored-by: Mason Daugherty <github@mdrxy.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
f9b4e501a8
commit
155e3740bc
@ -77,7 +77,7 @@ export default function VectorStoreTabs(props) {
|
||||
{
|
||||
value: "Qdrant",
|
||||
label: "Qdrant",
|
||||
text: `from langchain_qdrant import QdrantVectorStore\nfrom qdrant_client import QdrantClient\n${useFakeEmbeddings ? fakeEmbeddingsString : ""}\nclient = QdrantClient(":memory:")\n${vectorStoreVarName} = QdrantVectorStore(\n client=client,\n collection_name="test",\n embedding=embeddings,\n)`,
|
||||
text: `from qdrant_client.models import Distance, VectorParams\nfrom langchain_qdrant import QdrantVectorStore\nfrom qdrant_client import QdrantClient\n${useFakeEmbeddings ? fakeEmbeddingsString : ""}\nclient = QdrantClient(":memory:")\n\nvector_size = len(embeddings.embed_query("sample text"))\n\nif not client.collection_exists("test"):\n client.create_collection(\n collection_name="test",\n vectors_config=VectorParams(size=vector_size, distance=Distance.COSINE)\n )\n${vectorStoreVarName} = QdrantVectorStore(\n client=client,\n collection_name="test",\n embedding=embeddings,\n)`,
|
||||
packageName: "langchain-qdrant",
|
||||
default: false,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user