llama-stack icon indicating copy to clipboard operation
llama-stack copied to clipboard

Tools api with a stub provider impl

Open dineshyv opened this issue 11 months ago • 0 comments

This PR adds a new Tools api and does all the plumbing needed to implement the tools api in distribution and changes needed to route the tool runtime calls to the provider.

Test plan:

curl -X POST "http://localhost:5000/alpha/tools/register" \
  -H "Content-Type: application/json" \
  -d '{
    "tool_id": "example-tool",
    "name": "Example Tool",
    "description": "This is an example tool",
    "parameters": [
      {
        "name": "param1",
        "type_hint": "string",
        "description": "First parameter description",
        "required": true
      }
    ],
    "returns": {
      "type_hint": "string",
      "description": "Description of what the tool returns"
    },
    "provider_metadata": {},
    "tool_prompt_format": "json"
  }'

 curl -X GET http://localhost:5000/alpha/tools/list | jq .

  {
    "identifier": "example-tool",
    "provider_resource_id": "example-tool",
    "provider_id": "meta-reference",
    "type": "tool",
    "name": "Example Tool",
    "description": "This is an example tool",
    "parameters": [
      {
        "name": "param1",
        "type_hint": "string",
        "description": "First parameter description",
        "required": true,
        "default": null
      }
    ],
    "returns": {
      "type_hint": "string",
      "description": "Description of what the tool returns"
    },
    "provider_metadata": {},
    "tool_prompt_format": "json"
  }
]

dineshyv avatar Dec 16 '24 20:12 dineshyv