feat: REST API support for tool creation (#1219)
Co-authored-by: cpacker <packercharles@gmail.com>
This commit is contained in:
@@ -348,3 +348,29 @@ def test_presets(client, agent):
|
||||
# List all presets and make sure the preset is NOT in the list
|
||||
all_presets = client.list_presets()
|
||||
assert new_preset.id not in [p.id for p in all_presets], (new_preset, all_presets)
|
||||
|
||||
|
||||
def test_tools(client, agent):
|
||||
|
||||
# load a function
|
||||
file_path = "tests/data/functions/dump_json.py"
|
||||
module_name = "dump_json"
|
||||
|
||||
# list functions
|
||||
response = client.list_tools()
|
||||
orig_tools = response.tools
|
||||
print(orig_tools)
|
||||
|
||||
# add the tool
|
||||
create_tool_response = client.create_tool(name=module_name, file_path=file_path)
|
||||
print(create_tool_response)
|
||||
|
||||
# list functions
|
||||
response = client.list_tools()
|
||||
new_tools = response.tools
|
||||
assert module_name in [tool.name for tool in new_tools]
|
||||
# assert len(new_tools) == len(orig_tools) + 1
|
||||
|
||||
# TODO: add a function to a preset
|
||||
|
||||
# TODO: add a function to an agent
|
||||
|
||||
Reference in New Issue
Block a user