Skip to content

Commit

Permalink
cookbook vectordb: Qdrant (#1515)
Browse files Browse the repository at this point in the history
* add qdrant example with agentic rag under vectordb

* consistent with other vector db examples
  • Loading branch information
lucifertrj authored Dec 12, 2024
1 parent 0cc85f2 commit 6fc246c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cookbook/vectordb/qdrant_db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# pip install qdrant-client
from phi.vectordb.qdrant import Qdrant
from phi.agent import Agent
from phi.knowledge.pdf import PDFUrlKnowledgeBase

# run qdrant client locally
"""
- Run the docker image: docker pull qdrant/qdrant
- Then, run the service:
docker run -p 6333:6333 -p 6334:6334 \
-v $(pwd)/qdrant_storage:/qdrant/storage:z \
qdrant/qdrant
"""
COLLECTION_NAME = "thai-recipes"

vector_db = Qdrant(
collection=COLLECTION_NAME,
url="http://localhost:6333"
)

knowledge_base = PDFUrlKnowledgeBase(
urls=["https://phi-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"],
vector_db=vector_db,
)

knowledge_base.load(recreate=False) # Comment out after first run

# Create and use the agent
agent = Agent(knowledge_base=knowledge_base, use_tools=True, show_tool_calls=True)
agent.print_response("List down the ingredients to make Massaman Gai", markdown=True)

0 comments on commit 6fc246c

Please sign in to comment.