feat: (tool router) adds extension name in vector db & search tool (#2855)

This commit is contained in:
Wendy Tang
2025-06-13 10:28:02 -07:00
committed by GitHub
parent 9368a242ce
commit de5fc9b450
5 changed files with 119 additions and 37 deletions
+8 -6
View File
@@ -12,18 +12,20 @@ pub fn vector_search_tool() -> Tool {
Format a query to search for the most relevant tools based on the user's messages.
Pay attention to the keywords in the user's messages, especially the last message and potential tools they are asking for.
This tool should be invoked when the user's messages suggest they are asking for a tool to be run.
Examples:
- {"User": "what is the weather in Tokyo?", "Query": "weather in Tokyo"}
- {"User": "read this pdf file for me", "Query": "read pdf file"}
- {"User": "run this command ls -l in the terminal", "Query": "run command in terminal ls -l"}
You have the list of extension names available to you in your system prompt.
Use the extension_name parameter to filter tools by the appropriate extension.
For example, if the user is asking to list the files in the current directory, you filter for the "developer" extension.
Example: {"User": "list the files in the current directory", "Query": "list files in current directory", "Extension Name": "developer", "k": 5}
Extension name is not optional, it is required.
"#}
.to_string(),
json!({
"type": "object",
"required": ["query"],
"required": ["query", "extension_name"],
"properties": {
"query": {"type": "string", "description": "The query to search for the most relevant tools based on the user's messages"},
"k": {"type": "integer", "description": "The number of tools to retrieve (defaults to 5)", "default": 5}
"k": {"type": "integer", "description": "The number of tools to retrieve (defaults to 5)", "default": 5},
"extension_name": {"type": "string", "description": "Name of the extension to filter tools by"}
}
}),
Some(ToolAnnotations {