PUT
/
api
/
v1
/
prompts
import os
from syllable_sdk import SyllableSDK


with SyllableSDK(
    api_key_header=os.getenv("SYLLABLESDK_API_KEY_HEADER", ""),
) as ss_client:

    res = ss_client.prompts.update(request={
        "name": "Weather Agent Prompt",
        "description": "Prompt for a weather agent.",
        "type": "prompt_v1",
        "context": "You are a weather agent. Answer the user's questions about weather and nothing else.",
        "tools": [
            "summary",
            "hangup",
        ],
        "llm_config": {
            "version": "2024-05-13",
            "api_version": "2024-06-01",
            "temperature": 1,
            "seed": 123,
        },
        "id": 1,
        "edit_comments": "Updated prompt text to include requirement to not answer questions that aren't about weather.",
    })

    # Handle response
    print(res)
{
  "name": "Weather Agent Prompt",
  "description": "Prompt for a weather agent.",
  "type": "prompt_v1",
  "context": "You are a weather agent. Answer the user's questions about weather and nothing else.",
  "tools": "hangup",
  "llm_config": {
    "model": "gpt-4o",
    "provider": "openai",
    "version": "2024-08-06"
  },
  "id": 1,
  "edit_comments": "Updated prompt text to include requirement to not answer questions that aren't about weather.",
  "last_updated": "2024-01-01T12:00:00Z",
  "last_updated_by": "user@email.com",
  "agent_count": 5,
  "tools_full": [
    {
      "name": "Weather Fetcher",
      "definition": {
        "endpoint": {
          "argument_location": "query",
          "method": "get",
          "url": "https://api.open-meteo.com/v1/forecast"
        },
        "tool": {
          "function": {
            "description": "Get the weather for a city",
            "name": "get_weather",
            "parameters": {
              "properties": {
                "latitude": {
                  "description": "Latitude of the city",
                  "type": "number"
                },
                "longitude": {
                  "description": "Longitude of the city",
                  "type": "number"
                },
                "current": {
                  "default": "temperature_2m,relative_humidity_2m,precipitation,rain,showers",
                  "description": "Information to retrieve from the open-meteo API, comma-separated",
                  "type": "string"
                }
              },
              "required": [
                "latitude",
                "longitude",
                "current"
              ],
              "type": "object"
            }
          },
          "type": "function"
        },
        "type": "endpoint"
      },
      "service_id": 1,
      "id": 1,
      "last_updated_comments": "Updated to use new API endpoint",
      "service_name": "<string>",
      "prompts_info": [
        {
          "id": 1,
          "name": "Test Prompt"
        }
      ],
      "agents_info": [
        {
          "id": 1,
          "name": "Test Agent"
        }
      ],
      "last_updated": "2023-11-07T05:31:56Z",
      "last_updated_by": "user@email.com"
    }
  ]
}

Authorizations

Syllable-API-Key
string
header
required

Body

application/json

Request model to update an existing prompt.

name
string
required

The prompt name

Example:

"Weather Agent Prompt"

type
string
required

The type of the prompt

Example:

"prompt_v1"

llm_config
object
required

The configuration for the LLM that the prompt uses

id
integer
required

The internal ID of the prompt

Example:

1

description
string | null

The description of the prompt

Example:

"Prompt for a weather agent."

context
string | null

The prompt text that will be sent to the LLM at the beginning of the conversation

Example:

"You are a weather agent. Answer the user's questions about weather and nothing else."

tools
string[]

Names of tools to which the prompt has access

Example:
["summary", "hangup"]
edit_comments
string | null

The comments for the most recent edit to the prompt

Example:

"Updated prompt text to include requirement to not answer questions that aren't about weather."

include_default_tools
boolean
default:true

Whether to include the default tools (hangup, summary) in the list of tools for the prompt. If you remove one of the default tools from your prompt, you might want to disable this option so that the tool is not added again when updated.

Example:

true

Response

200
application/json
Successful Response

Response model for prompt operations. A prompt defines the behavior of an agent by delivering instructions to the LLM about how the agent should behave. A prompt can be linked to one or more agents. A prompt can also be linked to tools to allow an agent using it to use those tools. For more information, see Console docs.

name
string
required

The prompt name

Example:

"Weather Agent Prompt"

type
string
required

The type of the prompt

Example:

"prompt_v1"

llm_config
object
required

The configuration for the LLM that the prompt uses

id
integer
required

The internal ID of the prompt

Example:

1

last_updated
string | null
required

The last updated date of the prompt

Example:

"2024-01-01T12:00:00Z"

description
string | null

The description of the prompt

Example:

"Prompt for a weather agent."

context
string | null

The prompt text that will be sent to the LLM at the beginning of the conversation

Example:

"You are a weather agent. Answer the user's questions about weather and nothing else."

tools
string[]
deprecated

Names of the tools to which the prompt has access (DEPRECATED - use information from full tools field instead)

Example:

"hangup"

edit_comments
string | null

The comments for the most recent edit to the prompt

Example:

"Updated prompt text to include requirement to not answer questions that aren't about weather."

last_updated_by
string | null

Email address of the user who most recently updated the prompt

Example:

"user@email.com"

agent_count
integer | null

The number of agents using the prompt

Example:

5

tools_full
object[] | null

Full definitions of tools to which the prompt has access

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.