import os
from syllable_sdk import SyllableSDK, models
with SyllableSDK(
api_key_header=os.getenv("SYLLABLESDK_API_KEY_HEADER", ""),
) as ss_client:
res = ss_client.tools.create(request=models.ToolCreateRequest(
name="Weather Fetcher",
definition=models.ToolDefinition(
type=models.ToolDefinitionType.ENDPOINT,
tool=models.InternalTool(
function=models.ToolFunction(
name="get_weather",
description="Get the weather for a city",
parameters={
},
),
),
endpoint=models.ToolHTTPEndpoint(
url="https://api.example.com",
method=models.ToolHTTPMethod.DELETE,
argument_location=models.ToolArgumentLocation.PATH,
),
defaults="<value>",
static_parameters=[
models.StaticToolParameter(
name="temperature_unit",
description="Whether the temperature information should be fetched in Celsius or Fahrenheit",
required=False,
type=models.StaticToolParameterType.STRING,
default="fahrenheit",
),
],
),
service_id=1,
))
# Handle response
print(res){
"name": "<string>",
"definition": {
"tool": {
"function": {
"name": "<string>",
"description": "<string>",
"parameters": "<unknown>"
},
"type": "function"
},
"type": "endpoint",
"endpoint": {
"url": "<string>",
"method": "get",
"argument_location": "body"
},
"context": {
"task": {
"id": "<string>",
"config": {},
"variables": [
{
"name": "<string>",
"value": "<unknown>",
"value_from": {
"expression": "<string>",
"type": "cel"
},
"type": "string",
"description": "<string>",
"title": "<string>",
"format": "<string>",
"pattern": "<string>",
"enum": [
"<string>"
],
"examples": [
"<unknown>"
]
}
],
"metadata": {
"priority": 123,
"parent_tool_name": "<string>"
},
"tool": {
"name": "<string>",
"description": "<string>"
},
"type": "expression",
"version": "v1alpha",
"inputs": [
{
"name": "<string>",
"type": "string",
"description": "<string>",
"title": "<string>",
"format": "<string>",
"pattern": "<string>",
"enum": [
"<string>"
],
"examples": [
"<unknown>"
],
"required": true
}
],
"expression": {
"expression": "<string>",
"type": "cel"
},
"output": "<unknown>",
"on": {
"start": [
{
"name": "<string>",
"value": "<unknown>",
"value_from": {
"expression": "<string>",
"type": "cel"
},
"if": {
"expression": "<string>",
"type": "cel"
},
"action": "set"
}
],
"submit": [
{
"name": "<string>",
"value": "<unknown>",
"value_from": {
"expression": "<string>",
"type": "cel"
},
"if": {
"expression": "<string>",
"type": "cel"
},
"action": "set"
}
]
}
}
},
"defaults": "<unknown>",
"static_parameters": [
{
"default": "fahrenheit",
"description": "Whether the temperature information should be fetched in Celsius or Fahrenheit",
"name": "temperature_unit",
"required": false,
"type": "string"
}
],
"result": "<unknown>",
"options": {
"propagate_tool_result": false
}
},
"service_id": 123,
"id": 123,
"last_updated": "2023-11-07T05:31:56Z",
"last_updated_by": "<string>",
"last_updated_comments": "Updated to use new API endpoint",
"service_name": "<string>",
"prompts_info": [
{
"id": 123,
"name": "<string>"
}
],
"agents_info": [
{
"id": 123,
"name": "<string>"
}
]
}Create a new tool
import os
from syllable_sdk import SyllableSDK, models
with SyllableSDK(
api_key_header=os.getenv("SYLLABLESDK_API_KEY_HEADER", ""),
) as ss_client:
res = ss_client.tools.create(request=models.ToolCreateRequest(
name="Weather Fetcher",
definition=models.ToolDefinition(
type=models.ToolDefinitionType.ENDPOINT,
tool=models.InternalTool(
function=models.ToolFunction(
name="get_weather",
description="Get the weather for a city",
parameters={
},
),
),
endpoint=models.ToolHTTPEndpoint(
url="https://api.example.com",
method=models.ToolHTTPMethod.DELETE,
argument_location=models.ToolArgumentLocation.PATH,
),
defaults="<value>",
static_parameters=[
models.StaticToolParameter(
name="temperature_unit",
description="Whether the temperature information should be fetched in Celsius or Fahrenheit",
required=False,
type=models.StaticToolParameterType.STRING,
default="fahrenheit",
),
],
),
service_id=1,
))
# Handle response
print(res){
"name": "<string>",
"definition": {
"tool": {
"function": {
"name": "<string>",
"description": "<string>",
"parameters": "<unknown>"
},
"type": "function"
},
"type": "endpoint",
"endpoint": {
"url": "<string>",
"method": "get",
"argument_location": "body"
},
"context": {
"task": {
"id": "<string>",
"config": {},
"variables": [
{
"name": "<string>",
"value": "<unknown>",
"value_from": {
"expression": "<string>",
"type": "cel"
},
"type": "string",
"description": "<string>",
"title": "<string>",
"format": "<string>",
"pattern": "<string>",
"enum": [
"<string>"
],
"examples": [
"<unknown>"
]
}
],
"metadata": {
"priority": 123,
"parent_tool_name": "<string>"
},
"tool": {
"name": "<string>",
"description": "<string>"
},
"type": "expression",
"version": "v1alpha",
"inputs": [
{
"name": "<string>",
"type": "string",
"description": "<string>",
"title": "<string>",
"format": "<string>",
"pattern": "<string>",
"enum": [
"<string>"
],
"examples": [
"<unknown>"
],
"required": true
}
],
"expression": {
"expression": "<string>",
"type": "cel"
},
"output": "<unknown>",
"on": {
"start": [
{
"name": "<string>",
"value": "<unknown>",
"value_from": {
"expression": "<string>",
"type": "cel"
},
"if": {
"expression": "<string>",
"type": "cel"
},
"action": "set"
}
],
"submit": [
{
"name": "<string>",
"value": "<unknown>",
"value_from": {
"expression": "<string>",
"type": "cel"
},
"if": {
"expression": "<string>",
"type": "cel"
},
"action": "set"
}
]
}
}
},
"defaults": "<unknown>",
"static_parameters": [
{
"default": "fahrenheit",
"description": "Whether the temperature information should be fetched in Celsius or Fahrenheit",
"name": "temperature_unit",
"required": false,
"type": "string"
}
],
"result": "<unknown>",
"options": {
"propagate_tool_result": false
}
},
"service_id": 123,
"id": 123,
"last_updated": "2023-11-07T05:31:56Z",
"last_updated_by": "<string>",
"last_updated_comments": "Updated to use new API endpoint",
"service_name": "<string>",
"prompts_info": [
{
"id": 123,
"name": "<string>"
}
],
"agents_info": [
{
"id": 123,
"name": "<string>"
}
]
}Request model to create a tool.
The name of the tool
The definition of the tool
Show child attributes
The tool definition to be used by the OpenAI API.
Show child attributes
The tool function definition, including the JSON Schema of its parameters.
Always function.
"function"The action to take when the LLM calls the tool.
action, endpoint, context, log "endpoint"
The configuration for an HTTP API call.
Show child attributes
The endpoint URL of the external service to call.
The HTTP method to use for the service call.
get, post, put, delete How to pass the arguments to the request.
body, form, path, query The configuration for a context tool.
Show child attributes
Task implementation details
Show child attributes
A unique identifier for the task.
Show child attributes
The name of the property.
Initial value of the variable.
Expression to compute initial value (mutually exclusive with value).
string, number, integer, boolean, object, array, null "expression""v1alpha"Show child attributes
The name of the property.
string, number, integer, boolean, object, array, null Actions to execute when the configured events occur.
Show child attributes
Actions to execute on the first input from the user.
Show child attributes
Destination path to mutate (e.g. output.foo).
Initial value of the variable.
Expression to compute initial value (mutually exclusive with value).
"set"Actions to execute when the tool/step is submitted by the LLM.
Show child attributes
Destination path to mutate (e.g. output.foo).
Initial value of the variable.
Expression to compute initial value (mutually exclusive with value).
"set"The default values for the parameters of the function/tool call.
Parameters for the tool whose values should be set at config time (i.e., not provided by the LLM).
Show child attributes
The name of the parameter - must be unique within the tool.
Whether the parameter is required to have a value assigned.
The expected type for the parameter.
string, int, boolean, data_source_list The description of the parameter.
"Whether the temperature information should be fetched in celsius or fahrenheit."
The default value for the parameter. If type is string, must be a string. If type is int, must be an int. If type is boolean, must be a boolean. If type is data_source_list, must be a list of strings (data source names).
"fahrenheit"
[
{
"default": "fahrenheit",
"description": "Whether the temperature information should be fetched in Celsius or Fahrenheit",
"name": "temperature_unit",
"required": false,
"type": "string"
}
]The optional result of the tool call.
Internal ID of the service to which the tool belongs
Successful Response
Response model for tool operations. A tool is a function that an agent can call to perform actions like accessing databases, making API calls, or processing data. For an agent to have access to a tool, the prompt associated with that agent should be linked to the tool and include instructions to use it. For more information, see Console docs.
The name of the tool
The definition of the tool
Show child attributes
The tool definition to be used by the OpenAI API.
Show child attributes
The tool function definition, including the JSON Schema of its parameters.
Always function.
"function"The action to take when the LLM calls the tool.
action, endpoint, context, log "endpoint"
The configuration for an HTTP API call.
Show child attributes
The endpoint URL of the external service to call.
The HTTP method to use for the service call.
get, post, put, delete How to pass the arguments to the request.
body, form, path, query The configuration for a context tool.
Show child attributes
Task implementation details
Show child attributes
A unique identifier for the task.
Show child attributes
The name of the property.
Initial value of the variable.
Expression to compute initial value (mutually exclusive with value).
string, number, integer, boolean, object, array, null "expression""v1alpha"Show child attributes
The name of the property.
string, number, integer, boolean, object, array, null Actions to execute when the configured events occur.
Show child attributes
Actions to execute on the first input from the user.
Show child attributes
Destination path to mutate (e.g. output.foo).
Initial value of the variable.
Expression to compute initial value (mutually exclusive with value).
"set"Actions to execute when the tool/step is submitted by the LLM.
Show child attributes
Destination path to mutate (e.g. output.foo).
Initial value of the variable.
Expression to compute initial value (mutually exclusive with value).
"set"The default values for the parameters of the function/tool call.
Parameters for the tool whose values should be set at config time (i.e., not provided by the LLM).
Show child attributes
The name of the parameter - must be unique within the tool.
Whether the parameter is required to have a value assigned.
The expected type for the parameter.
string, int, boolean, data_source_list The description of the parameter.
"Whether the temperature information should be fetched in celsius or fahrenheit."
The default value for the parameter. If type is string, must be a string. If type is int, must be an int. If type is boolean, must be a boolean. If type is data_source_list, must be a list of strings (data source names).
"fahrenheit"
[
{
"default": "fahrenheit",
"description": "Whether the temperature information should be fetched in Celsius or Fahrenheit",
"name": "temperature_unit",
"required": false,
"type": "string"
}
]The optional result of the tool call.
Internal ID of the service to which the tool belongs
The internal ID of the tool
The timestamp of the most recent update to the tool
The email of the user who last updated the tool
Comments for the most recent edit to the tool.
"Updated to use new API endpoint"
The name of the service to which the tool belongs