POST
/
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.create(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,
        },
    })

    # 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 create a prompt.

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.