Skip to content

Commit 155e374

Browse files
YasienDwiebmdrxyCopilot
authored
fix(docs): handle collection not found error on RAG tutorial when qdrant is selected as vectorStore (langchain-ai#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>
1 parent f9b4e50 commit 155e374

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/src/theme/VectorStoreTabs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default function VectorStoreTabs(props) {
7777
{
7878
value: "Qdrant",
7979
label: "Qdrant",
80-
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)`,
80+
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)`,
8181
packageName: "langchain-qdrant",
8282
default: false,
8383
},

0 commit comments

Comments
 (0)