-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add qdrant example with agentic rag under vectordb * consistent with other vector db examples
- Loading branch information
1 parent
0cc85f2
commit 6fc246c
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |