Prompt templates

The endpoints managing prompt template resources are located under the /prompts path.

PromptTemplate Object

PromptTemplate is an object used to define templates for generating prompts. It includes various properties to specify the role, name, status, and more.
A PromptTemplate is composed of several properties that define its characteristics and behavior in the generative AI model.

Properties

  • Name
    role
    Type
    string
    Description

    Role of the template, typically 'system'.

  • Name
    name
    Type
    string
    Description

    The name of the template, for instance, 'Haiku (fork)'.

  • Name
    status
    Type
    string
    Description

    Current status of the template, such as 'draft'.

  • Name
    parent
    Type
    string
    Description

    Identifier of the parent template, if applicable.

  • Name
    latest
    Type
    boolean
    Description

    Boolean indicating if this is the latest version.

  • Name
    version
    Type
    number
    Description

    Version number of the template.

  • Name
    content_type
    Type
    string
    Description

    Type of the content, e.g., 'jst'.

  • Name
    content
    Type
    string
    Description

    The content of the template in a specified format.

  • Name
    test_data
    Type
    JSONObject
    Description

    Test data used for validating the template's functionality.

  • Name
    inputSchema
    Type
    JSONSchema
    Description

    JSON Schema defining the required input for the template.

  • Name
    project
    Type
    string
    Description

    Project identifier associated with the template.

  • Name
    created_at
    Type
    Date
    Description

    Date and time when the template was created.

  • Name
    updated_at
    Type
    Date
    Description

    Date and time when the template was last updated.

  • Name
    id
    Type
    string
    Description

    Unique identifier of the template.

PromptTemplate
{
  "role": "system",
  "name": "Haiku (fork)",
  "status": "draft",
  "parent": "65577be3108a03f326f30f6a",
  "latest": false,
  "version": 1,
  "content_type": "jst",
  "content": "return `\n  You are a great poet, inspired and funny. Please write a inspiring or funny Haiku about the following topic: ${topic}.\n  Only write the haiku, nothing else, no comment.\n`",
  "test_data": {
    "topic": "",
    "mood": ""
  },
  "inputSchema": {
    "type": "object",
    "properties": {
      "topic": {
        "type": "string"
      },
      "mood": {
        "type": "string"
      }
    },
    "required": [
      "topic",
      "mood"
    ]
  },
  "project": "654df9de09676ad3b8631dc3",
  "created_at": "2023-11-21T07:00:13.588Z",
  "updated_at": "2023-11-21T07:00:13.588Z",
  "id": "655c557da963a422f6a9794c"
}

List prompt templates
GET /prompts

Get the list of prompt templates in the current project. \

Parameters

No parameters.

Returns

A list of prompt template references. An prompt template reference is a subset of the prompt template object.

Request

curl https://api.composableprompts.com/api/v1/prompts \
  -H "Accept: application/json"
  -H "Authorization: Bearer {token}"

Response

[
  {
    "role": "system",
    "name": "Contract Policy Check",
    "content_type": "jst",
    "test_data": {
      "contract": "",
      "policy": "",
      "customer_name": "",
      "service_description": ""
    },
    "inputSchema": {
      "type": "object",
      "properties": {
        "contract": {
          "type": "string"
        },
        "policy": {
          "type": "string"
        },
        "customer_name": {
          "type": "string"
        },
        "service_description": {
          "type": "string"
        }
      },
      "required": [
        "contract",
        "policy",
        "customer_name",
        "service_description"
      ]
    },
    "project": "654df9de09676ad3b8631dc3",
    "created_at": "2023-11-10T09:45:41.965Z",
    "updated_at": "2023-11-10T16:30:51.985Z",
    "last_published_at": "2023-11-10T16:24:15.434Z",
    "latest": false,
    "status": "draft",
    "version": 2,
    "id": "654dfbc509676ad3b8631e46"
  },
  ...
]

Retrieve a prompt template
GET /prompts/:promptId

Get a prompt template given its ID.

Parameters

No parameters.

Returns

A prompt template object.

Request

curl https://api.composableprompts.com/api/v1/prompts/654dfbc509676ad3b8631e46 \
  -H "Accept: application/json"
  -H "Authorization: Bearer {token}"

Response

{
  "role": "system",
  "name": "Contract Policy Check",
  "content_type": "jst",
  "content": "return `\nAs an expert legal assistant for the sales team, your task is to meticulously review the provided contract intended for a potential agreement with our client, \"${customer_name}\". The service under consideration for provision is described as follows: \"${service_description}\".\n\nPlease conduct a thorough analysis of the contract to ensure compliance with our company policies. Identify and enumerate any discrepancies, categorizing each issue's severity as 'low' for minor non-compliance, 'medium' for contradictions with 'should' items in our policy, and 'high' for direct violations of mandatory policy elements.\n\nYour role is to support the legal team by offering a preliminary assessment of this contract based on the provided policy guidelines. It is not necessary to include a disclaimer about not offering legal advice.\n\nBelow you will find our company's contract policy enclosed within <policy> tags and the contract to be reviewed enclosed within <contract> tags.\n\n<policy>\n${policy}\n</policy>\n\n<contract>\n${contract}\n</contract>\n\n`",
  "test_data": {
    "contract": "",
    "policy": "",
    "customer_name": "",
    "service_description": ""
  },
  "inputSchema": {
    "type": "object",
    "properties": {
      "contract": {
        "type": "string"
      },
      "policy": {
        "type": "string"
      },
      "customer_name": {
        "type": "string"
      },
      "service_description": {
        "type": "string"
      }
    },
    "required": [
      "contract",
      "policy",
      "customer_name",
      "service_description"
    ]
  },
  "project": "654df9de09676ad3b8631dc3",
  "created_at": "2023-11-10T09:45:41.965Z",
  "updated_at": "2023-11-10T16:30:51.985Z",
  "last_published_at": "2023-11-10T16:24:15.434Z",
  "latest": false,
  "status": "draft",
  "version": 2,
  "id": "654dfbc509676ad3b8631e46"
}

Was this page helpful?