mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 16:36:21 +02:00
Add more structured query support (#496)
* Updated tool cmd line * Added a CLI test
This commit is contained in:
parent
50c37407c5
commit
f1d08969ec
3 changed files with 443 additions and 12 deletions
|
|
@ -3,6 +3,7 @@ Configures and registers tools in the TrustGraph system.
|
|||
|
||||
This script allows you to define agent tools with various types including:
|
||||
- knowledge-query: Query knowledge bases
|
||||
- structured-query: Query structured data using natural language
|
||||
- text-completion: Text generation
|
||||
- mcp-tool: Reference to MCP (Model Context Protocol) tools
|
||||
- prompt: Prompt template execution
|
||||
|
|
@ -117,21 +118,29 @@ def main():
|
|||
description=__doc__,
|
||||
epilog=textwrap.dedent('''
|
||||
Valid tool types:
|
||||
knowledge-query - Query knowledge bases
|
||||
text-completion - Text completion/generation
|
||||
mcp-tool - Model Control Protocol tool
|
||||
prompt - Prompt template query
|
||||
knowledge-query - Query knowledge bases (fixed args)
|
||||
structured-query - Query structured data using natural language (fixed args)
|
||||
text-completion - Text completion/generation (fixed args)
|
||||
mcp-tool - Model Control Protocol tool (configurable args)
|
||||
prompt - Prompt template query (configurable args)
|
||||
|
||||
Note: Tools marked "(fixed args)" have predefined arguments and don't need
|
||||
--argument specified. Tools marked "(configurable args)" require --argument.
|
||||
|
||||
Valid argument types:
|
||||
string - String/text parameter
|
||||
string - String/text parameter
|
||||
number - Numeric parameter
|
||||
|
||||
Examples:
|
||||
%(prog)s --id weather_tool --name get_weather \\
|
||||
--type knowledge-query \\
|
||||
--description "Get weather information for a location" \\
|
||||
--argument location:string:"Location to query" \\
|
||||
--argument units:string:"Temperature units (C/F)"
|
||||
--collection weather_data
|
||||
|
||||
%(prog)s --id data_query_tool --name query_data \\
|
||||
--type structured-query \\
|
||||
--description "Query structured data using natural language" \\
|
||||
--collection sales_data
|
||||
|
||||
%(prog)s --id calc_tool --name calculate --type mcp-tool \\
|
||||
--description "Perform mathematical calculations" \\
|
||||
|
|
@ -164,7 +173,7 @@ def main():
|
|||
|
||||
parser.add_argument(
|
||||
'--type',
|
||||
help=f'Tool type, one of: knowledge-query, text-completion, mcp-tool, prompt',
|
||||
help=f'Tool type, one of: knowledge-query, structured-query, text-completion, mcp-tool, prompt',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
|
|
@ -174,7 +183,7 @@ def main():
|
|||
|
||||
parser.add_argument(
|
||||
'--collection',
|
||||
help=f'For knowledge-query type: collection to query',
|
||||
help=f'For knowledge-query and structured-query types: collection to query',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
|
|
@ -210,7 +219,7 @@ def main():
|
|||
try:
|
||||
|
||||
valid_types = [
|
||||
"knowledge-query", "text-completion", "mcp-tool", "prompt"
|
||||
"knowledge-query", "structured-query", "text-completion", "mcp-tool", "prompt"
|
||||
]
|
||||
|
||||
if args.id is None:
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ Displays the current agent tool configurations
|
|||
|
||||
Shows all configured tools including their types:
|
||||
- knowledge-query: Tools that query knowledge bases
|
||||
- structured-query: Tools that query structured data using natural language
|
||||
- text-completion: Tools for text generation
|
||||
- mcp-tool: References to MCP (Model Context Protocol) tools
|
||||
- prompt: Tools that execute prompt templates
|
||||
|
|
@ -40,8 +41,9 @@ def show_config(url):
|
|||
if tp == "mcp-tool":
|
||||
table.append(("mcp-tool", data["mcp-tool"]))
|
||||
|
||||
if tp == "knowledge-query":
|
||||
table.append(("collection", data["collection"]))
|
||||
if tp == "knowledge-query" or tp == "structured-query":
|
||||
if "collection" in data:
|
||||
table.append(("collection", data["collection"]))
|
||||
|
||||
if tp == "prompt":
|
||||
table.append(("template", data["template"]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue