Hello Agno community! What’s the best way to create a knowledge base using an existing Qdrant collection that wasn’t created with Agno? I have a collection I created directly with Qdrant’s API and would like to use it with Agno’s knowledge base features.
Hey @Southern_Push2935! We have a cookbook that will showcase your usecase
let me know if this is something that will help you
1 Like
Hi @manthanguptaa - Thank you for the help!
I’m testing it out but having an issue - I don’t see the tool calls in the output even though I have show_tool_calls=True
, so I can’t tell if it’s responding with its own knowledge or actually using the retriever. Here’s my simplified code:
from agno.agent import Agent
from agno.models.anthropic import Claude
from agno.embedder.ollama import OllamaEmbedder
from qdrant_client import QdrantClient
from typing import Optional
embedder = OllamaEmbedder(id="mxbai-embed-large", host='[HOST_URL]')
def retriever(
query: str, agent: Optional[Agent] = None, num_documents: int = 5, **kwargs
) -> Optional[list[dict]]:
try:
qdrant_client = QdrantClient(url="[QDRANT_URL]")
query_embedding = embedder.get_embedding(query)
results = qdrant_client.query_points(
collection_name="my-collection",
query=query_embedding,
limit=num_documents,
)
results_dict = results.model_dump()
if "points" in results_dict:
return results_dict["points"]
else:
return None
except Exception as e:
print(f"Error retrieving documents: {e}")
return None
agent = Agent(
name="My Agent",
retriever=retriever,
search_knowledge=True,
show_tool_calls=True,
model=Claude(id="claude-3-5-sonnet-latest", temperature=0.1),
markdown=True
)
agent.print_response("Test query")