-
What are the best practices for Parlant if I want to add a Vector Database to my bot? Would defining a vector database lookup as a tool suffice? Also, is there a way to provide more context (ie. a description) for each tool, or does the LLM use the tool name exclusively to decide what tool to call? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It sounds like you want to add knowledge retrieval for your agent. Your intuition is correct: this is done through creating a tool. In tool code, you can basically do whatever you want, including accessing a vector DB. You can also define your tool such that the LLM produces the query with which you'll retrieve docs from the DB, simply through adding a named parameter to your tool. Regarding more context, yes this is possible. While we're actually in the process of adding more structure around this (see #260), you can already describe your tool and its parameters in detail via the tool function's docstring. For example: @tool
async def knowledgebase_lookup(context: ToolContext, query: str) -> ToolResult:
"""Looks up information in the knowledge base using a free-text query
Args:
query: A natural language search query
"""
docs = get_docs_from_query(query)
return ToolResult(docs) |
Beta Was this translation helpful? Give feedback.
It sounds like you want to add knowledge retrieval for your agent. Your intuition is correct: this is done through creating a tool. In tool code, you can basically do whatever you want, including accessing a vector DB. You can also define your tool such that the LLM produces the query with which you'll retrieve docs from the DB, simply through adding a named parameter to your tool.
Regarding more context, yes this is possible. While we're actually in the process of adding more structure around this (see #260), you can already describe your tool and its parameters in detail via the tool function's docstring. For example: