Prompts

This chapter focuses on services for the prompts.

get Get prompt

A GET to /prompts/{id} returns the prompt with the given id.

HTTP request

GET /api/rest/latest/prompts/1 HTTP/1.1
Accept: application/json
Host: localhost:8080

Path parameters

Table 1. /api/rest/latest/prompts/{id}
Parameter Description

id

the id of the prompt

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 833

{
  "_type" : "prompt",
  "id" : 1,
  "name" : "First prompt",
  "system_prompt_template" : "A system prompt template",
  "user_prompt_template" : "A user prompt template",
  "prompt_set" : {
    "_type" : "prompt-set",
    "id" : 3,
    "name" : "Testing prompt set",
    "description" : "This prompt set will be used for testing purposes",
    "ai_usage" : {
      "id" : 1,
      "usage" : "CLASSIC_TEST_CASE_GENERATION"
    },
    "created_by" : "admin",
    "created_on" : "2020-04-06T10:00:00.000+00:00",
    "last_modified_by" : "admin",
    "last_modified_on" : "2020-04-06T10:00:00.000+00:00",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/prompt-sets/3"
      }
    }
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/prompts/1"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

the id of the prompt

name

String

the name of the prompt

system_prompt_template

String

the system prompt template of the prompt

user_prompt_template

String

the user prompt template of the prompt

prompt_set

Object

the prompt set of the prompt

_links

Object

related links

Relation Description

self

link to this prompt

post Create prompt

A POST to /prompts creates a new prompt.

HTTP request

POST /api/rest/latest/prompts HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 160
Host: localhost:8080

{
  "name" : "New prompt",
  "prompt_set_id" : 6,
  "system_prompt_template" : "A system prompt template",
  "user_prompt_template" : "A user prompt template"
}

Request fields

Path Type Description

name

String

the name of the prompt

prompt_set_id

Number

the id of the prompt set

system_prompt_template

String

the system prompt template of the prompt

user_prompt_template

String

the user prompt template of the prompt

HTTP response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 805

{
  "_type" : "prompt",
  "id" : 1,
  "name" : "First prompt",
  "system_prompt_template" : "A system prompt template",
  "user_prompt_template" : "A user prompt template",
  "prompt_set" : {
    "_type" : "prompt-set",
    "id" : 6,
    "name" : "Prompt set",
    "description" : "Description of the prompt set",
    "ai_usage" : {
      "id" : 1,
      "usage" : "CLASSIC_TEST_CASE_GENERATION"
    },
    "created_by" : "admin",
    "created_on" : "2020-04-06T10:00:00.000+00:00",
    "last_modified_by" : "admin",
    "last_modified_on" : "2020-04-06T10:00:00.000+00:00",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/prompt-sets/6"
      }
    }
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/prompts/1"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

the id of the prompt

name

String

the name of the prompt

system_prompt_template

String

the system prompt template of the prompt

user_prompt_template

String

the user prompt template of the prompt

prompt_set

Object

the prompt set of the prompt

_links

Object

related links

Relation Description

self

link to this prompt

patch Modify a prompt

A PATCH to /prompts/{id} modifies the prompt with the given id.

HTTP request

PATCH /api/rest/latest/prompts/4 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 155
Host: localhost:8080

{
  "name" : "A renamed prompt",
  "system_prompt_template" : "Updated system prompt template",
  "user_prompt_template" : "Updated user prompt template"
}

Path parameters

Table 1. /api/rest/latest/prompts/{id}
Parameter Description

id

the id of the prompt

Request fields

Path Type Description

name

String

the name of the prompt

system_prompt_template

String

the system prompt template of the prompt

user_prompt_template

String

the user prompt template of the prompt

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 821

{
  "_type" : "prompt",
  "id" : 4,
  "name" : "A renamed prompt",
  "system_prompt_template" : "Updated system prompt template",
  "user_prompt_template" : "Updated user prompt template",
  "prompt_set" : {
    "_type" : "prompt-set",
    "id" : 6,
    "name" : "Prompt set",
    "description" : "Description of the prompt set",
    "ai_usage" : {
      "id" : 1,
      "usage" : "CLASSIC_TEST_CASE_GENERATION"
    },
    "created_by" : "admin",
    "created_on" : "2020-04-06T10:00:00.000+00:00",
    "last_modified_by" : "admin",
    "last_modified_on" : "2020-04-06T10:00:00.000+00:00",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/prompt-sets/6"
      }
    }
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/prompts/4"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

the id of the prompt

name

String

the name of the prompt

system_prompt_template

String

the system prompt template of the prompt

user_prompt_template

String

the user prompt template of the prompt

prompt_set

Object

the prompt set of the prompt

_links

Object

related links

Relation Description

self

link to this prompt

delete Delete prompt

A DELETE to /prompts/{ids} deletes one or several prompt(s) with the given id(s).

HTTP request

DELETE /api/rest/latest/prompts/3 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

Path parameters

Table 1. /api/rest/latest/prompts/{ids}
Parameter Description

ids

list of prompt IDs to delete

HTTP response

HTTP/1.1 204 No Content