PUT
/
api
/
v1
/
prompts
/
Python (SDK)
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": [],
        "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,
  "version_number": 1,
  "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

Examples:

"Weather Agent Prompt"

type
string
required

The type of the prompt

Examples:

"prompt_v1"

llm_config
object
required

The configuration for the LLM that the prompt uses

id
integer
required

The internal ID of the prompt

Examples:

1

description
string | null

The description of the prompt

Examples:

"Prompt for a weather agent."

context
string | null

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

Examples:

"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

Examples:
[]
edit_comments
string | null

The comments for the most recent edit to the prompt

Examples:

"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) 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.

Examples:

true

Response

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

Examples:

"Weather Agent Prompt"

type
string
required

The type of the prompt

Examples:

"prompt_v1"

llm_config
object
required

The configuration for the LLM that the prompt uses

id
integer
required

The internal ID of the prompt

Examples:

1

last_updated
string | null
required

The last updated date of the prompt

Examples:

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

description
string | null

The description of the prompt

Examples:

"Prompt for a weather agent."

context
string | null

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

Examples:

"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)

Examples:

"hangup"

"summary"

edit_comments
string | null

The comments for the most recent edit to the prompt

Examples:

"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

Examples:

"user@email.com"

agent_count
integer | null

The number of agents using the prompt

Examples:

5

version_number
integer | null

The version number of the current version of the prompt

Examples:

1

tools_full
ToolResponse · object[] | null

Full definitions of tools to which the prompt has access