Prompt sets

This chapter focuses on services for the prompt sets.

get Get all prompt sets

A GET to /prompt-sets returns all the prompt sets.

HTTP request

GET /api/rest/latest/prompt-sets HTTP/1.1
Accept: application/json
Host: localhost:8080

Query parameters

Parameter Description

page

number of the page to retrieve (optional)

size

size of the page to retrieve (optional)

sort

which attributes of the returned entities should be sorted on (optional)

fields

which fields of the elements should be returned (optional)

type

which type of the element should be returned (optional)

HTTP response

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

{
  "_embedded" : {
    "prompt-sets" : [ {
      "_type" : "prompt-set",
      "id" : 3,
      "name" : "First prompt set",
      "description" : "Description of the first 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/3"
        }
      }
    }, {
      "_type" : "prompt-set",
      "id" : 4,
      "name" : "Second prompt set",
      "description" : "Description of the second 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/4"
        }
      }
    }, {
      "_type" : "prompt-set",
      "id" : 5,
      "name" : "Third prompt set",
      "description" : "Description of the third 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/5"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/prompt-sets?page=0&size=20"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 3,
    "totalPages" : 1,
    "number" : 0
  }
}

Response fields

Path Type Description

_embedded.prompt-sets

Array

the list of elements for that page

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements

page.totalPages

Number

how many pages can be browsed

page.number

Number

the page number

_links

Object

related links

Relation Description

first

link to the first page (optional)

prev

link to the previous page (optional)

self

link to this page

next

link to the next page (optional)

last

link to the last page (optional)

get Get prompt set

A GET to /prompt-sets/{id} returns the prompt set with the given id.

HTTP request

GET /api/rest/latest/prompt-sets/3 HTTP/1.1
Accept: application/json
Host: localhost:8080

Path parameters

Table 1. /api/rest/latest/prompt-sets/{id}
Parameter Description

id

the id of the prompt set

HTTP response

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

{
  "_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"
  },
  "prompts" : [ {
    "_type" : "prompt",
    "id" : 1,
    "name" : "First prompt",
    "system_prompt_template" : "A system prompt template",
    "user_prompt_template" : "A user prompt template",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/prompts/1"
      }
    }
  } ],
  "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"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

the id of the prompt set

name

String

the name of the prompt set

description

String

the description of the prompt set

ai_usage

Object

the artificial intelligence usage of the prompt set in SquashTM

prompts

Array

the prompts of the prompt set

created_by

String

user who created the entity

created_on

String

timestamp of the creation (ISO 8601)

last_modified_by

String

user who modified the entity the most recently

last_modified_on

String

timestamp of last modification (ISO 8601)

_links

Object

related links

Relation Description

self

link to this prompt set

post Create prompt set

A POST to /prompt-sets creates a new prompt set.

HTTP request

POST /api/rest/latest/prompt-sets HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 133
Host: localhost:8080

{
  "name" : "New prompt set",
  "description" : "Description of the new prompt set",
  "ai_usage" : "CLASSIC_TEST_CASE_GENERATION"
}

Request fields

Path Type Description

name

String

the name of the prompt set

description

String

the description of the prompt set

ai_usage

String

the artificial intelligence usage of the prompt set in SquashTM

HTTP response

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

{
  "_type" : "prompt-set",
  "id" : 6,
  "name" : "New prompt set",
  "description" : "Description of the new 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"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

the id of the prompt set

name

String

the name of the prompt set

description

String

the description of the prompt set

ai_usage

Object

the artificial intelligence usage of the prompt set in SquashTM

created_by

String

user who created the entity

created_on

String

timestamp of the creation (ISO 8601)

last_modified_by

String

user who modified the entity the most recently

last_modified_on

String

timestamp of last modification (ISO 8601)

_links

Object

related links

Relation Description

self

link to this prompt set

patch Modify a prompt-set

A PATCH to /prompt-sets/{id} modifies the prompt set with the given id.

HTTP request

PATCH /api/rest/latest/prompt-sets/4 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 96
Host: localhost:8080

{
  "name" : "A renamed prompt set",
  "description" : "Updated description of the prompt set"
}

Path parameters

Table 1. /api/rest/latest/prompt-sets/{id}
Parameter Description

id

the id of the prompt set

Request fields

Path Type Description

name

String

the name of the prompt set

description

String

the description of the prompt set

HTTP response

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

{
  "_type" : "prompt-set",
  "id" : 4,
  "name" : "A renamed prompt set",
  "description" : "Updated description of the prompt set",
  "ai_usage" : {
    "id" : 1,
    "usage" : "CLASSIC_TEST_CASE_GENERATION"
  },
  "prompts" : [ ],
  "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/4"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

the id of the prompt set

name

String

the name of the prompt set

description

String

the description of the prompt set

ai_usage

Object

the artificial intelligence usage of the prompt set in SquashTM

prompts

Array

the prompts of the prompt set

created_by

String

user who created the entity

created_on

String

timestamp of the creation (ISO 8601)

last_modified_by

String

user who modified the entity the most recently

last_modified_on

String

timestamp of last modification (ISO 8601)

_links

Object

related links

Relation Description

self

link to this prompt set

delete Delete prompt set

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

HTTP request

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

Path parameters

Table 1. /api/rest/latest/prompt-sets/{ids}
Parameter Description

ids

list of prompt set IDs to delete

HTTP response

HTTP/1.1 204 No Content