mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 08:26:21 +02:00
Feature/tool group (#484)
* Tech spec for tool group * Partial tool group implementation * Tool group tests
This commit is contained in:
parent
672e358b2f
commit
e74eb5d1ff
9 changed files with 1304 additions and 6 deletions
|
|
@ -63,6 +63,9 @@ def set_tool(
|
|||
collection : str,
|
||||
template : str,
|
||||
arguments : List[Argument],
|
||||
group : List[str],
|
||||
state : str,
|
||||
applicable_states : List[str],
|
||||
):
|
||||
|
||||
api = Api(url).config()
|
||||
|
|
@ -93,6 +96,12 @@ def set_tool(
|
|||
for a in arguments
|
||||
]
|
||||
|
||||
if group: object["group"] = group
|
||||
|
||||
if state: object["state"] = state
|
||||
|
||||
if applicable_states: object["applicable-states"] = applicable_states
|
||||
|
||||
values = api.put([
|
||||
ConfigValue(
|
||||
type="tool", key=f"{id}", value=json.dumps(object)
|
||||
|
|
@ -179,6 +188,23 @@ def main():
|
|||
help=f'Tool arguments in the form: name:type:description (can specify multiple)',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--group',
|
||||
nargs="*",
|
||||
help=f'Tool groups (e.g., read-only, knowledge, admin)',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--state',
|
||||
help=f'State to transition to after successful execution',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--applicable-states',
|
||||
nargs="*",
|
||||
help=f'States in which this tool is available',
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
|
|
@ -219,6 +245,9 @@ def main():
|
|||
collection=args.collection,
|
||||
template=args.template,
|
||||
arguments=arguments,
|
||||
group=args.group or [],
|
||||
state=args.state,
|
||||
applicable_states=getattr(args, 'applicable_states', None) or [],
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue