llama-stack/llama_stack/apis
Dinesh Yeduguru c8be0bf1c9
Tools API with brave and MCP providers (#639)
This PR adds a new Tools api and adds two tool runtime providers: brave
and MCP.

Test plan:
```
curl -X POST 'http://localhost:5000/alpha/toolgroups/register' \
-H 'Content-Type: application/json' \
-d '{ "tool_group_id": "simple_tool",
  "tool_group": {
    "type": "model_context_protocol",
    "endpoint": {"uri": "http://localhost:56000/sse"}
  },
  "provider_id": "model-context-protocol"
}'

 curl -X POST 'http://localhost:5000/alpha/toolgroups/register' \
-H 'Content-Type: application/json' \
-d '{
  "tool_group_id": "search", "provider_id": "brave-search",
  "tool_group": {
    "type": "user_defined",
    "tools": [
      {
        "name": "brave_search",
        "description": "A web search tool",
        "parameters": [
          {
            "name": "query",
            "parameter_type": "string",
            "description": "The query to search"
          }
        ],
        "metadata": {},
        "tool_prompt_format": "json"
      }
    ]
  }
}'

 curl -X GET http://localhost:5000/alpha/tools/list | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   662  100   662    0     0   333k      0 --:--:-- --:--:-- --:--:--  646k
[
  {
    "identifier": "brave_search",
    "provider_resource_id": "brave_search",
    "provider_id": "brave-search",
    "type": "tool",
    "tool_group": "search",
    "description": "A web search tool",
    "parameters": [
      {
        "name": "query",
        "parameter_type": "string",
        "description": "The query to search"
      }
    ],
    "metadata": {},
    "tool_prompt_format": "json"
  },
  {
    "identifier": "fetch",
    "provider_resource_id": "fetch",
    "provider_id": "model-context-protocol",
    "type": "tool",
    "tool_group": "simple_tool",
    "description": "Fetches a website and returns its content",
    "parameters": [
      {
        "name": "url",
        "parameter_type": "string",
        "description": "URL to fetch"
      }
    ],
    "metadata": {
      "endpoint": "http://localhost:56000/sse"
    },
    "tool_prompt_format": "json"
  }
]

curl -X POST 'http://localhost:5000/alpha/tool-runtime/invoke' \
-H 'Content-Type: application/json' \
-d '{
    "tool_name": "fetch",
    "args": {
        "url": "http://google.com/"
    }
}'

 curl -X POST 'http://localhost:5000/alpha/tool-runtime/invoke' \
-H 'Content-Type: application/json' -H 'X-LlamaStack-ProviderData: {"api_key": "<KEY>"}' \
-d '{
    "tool_name": "brave_search",
    "args": {
        "query": "who is meta ceo"
    }
}'
```
2024-12-19 21:25:17 -08:00
..
agents Update the "InterleavedTextMedia" type (#635) 2024-12-17 11:18:31 -08:00
batch_inference Update the "InterleavedTextMedia" type (#635) 2024-12-17 11:18:31 -08:00
common Update URL type to avoid string-ifying and creating complexity 2024-12-17 22:50:11 -08:00
datasetio [tests] add client-sdk pytests & delete client.py (#638) 2024-12-16 12:04:56 -08:00
datasets Update the "InterleavedTextMedia" type (#635) 2024-12-17 11:18:31 -08:00
eval Update the "InterleavedTextMedia" type (#635) 2024-12-17 11:18:31 -08:00
eval_tasks Add version to REST API url (#478) 2024-11-18 22:44:14 -08:00
inference Register Message and ResponseFormat 2024-12-18 10:32:25 -08:00
inspect [tests] add client-sdk pytests & delete client.py (#638) 2024-12-16 12:04:56 -08:00
memory Update the "InterleavedTextMedia" type (#635) 2024-12-17 11:18:31 -08:00
memory_banks [tests] add client-sdk pytests & delete client.py (#638) 2024-12-16 12:04:56 -08:00
models [tests] add client-sdk pytests & delete client.py (#638) 2024-12-16 12:04:56 -08:00
post_training [2/n][torchtune integration] implement job management and return training artifacts (#593) 2024-12-13 15:00:04 -08:00
safety Update the "InterleavedTextMedia" type (#635) 2024-12-17 11:18:31 -08:00
scoring [tests] add client-sdk pytests & delete client.py (#638) 2024-12-16 12:04:56 -08:00
scoring_functions [/scoring] add ability to define aggregation functions for scoring functions & refactors (#597) 2024-12-11 10:03:42 -08:00
shields [tests] add client-sdk pytests & delete client.py (#638) 2024-12-16 12:04:56 -08:00
synthetic_data_generation Update the "InterleavedTextMedia" type (#635) 2024-12-17 11:18:31 -08:00
telemetry Update Telemetry API so OpenAPI generation can work (#640) 2024-12-16 13:00:14 -08:00
tools Tools API with brave and MCP providers (#639) 2024-12-19 21:25:17 -08:00
__init__.py API Updates (#73) 2024-09-17 19:51:35 -07:00
resource.py Tools API with brave and MCP providers (#639) 2024-12-19 21:25:17 -08:00
version.py Fix the pyopenapi generator avoid potential circular imports 2024-11-18 23:37:52 -08:00