Prompts
This chapter focuses on services for the prompts.
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
| Parameter | Description |
|---|---|
|
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 |
|---|---|---|
|
|
the type of the entity |
|
|
the id of the prompt |
|
|
the name of the prompt |
|
|
the system prompt template of the prompt |
|
|
the user prompt template of the prompt |
|
|
the prompt set of the prompt |
|
|
related links |
Links
| Relation | Description |
|---|---|
|
link to this prompt |
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 |
|---|---|---|
|
|
the name of the prompt |
|
|
the id of the prompt set |
|
|
the system prompt template of the prompt |
|
|
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 |
|---|---|---|
|
|
the type of the entity |
|
|
the id of the prompt |
|
|
the name of the prompt |
|
|
the system prompt template of the prompt |
|
|
the user prompt template of the prompt |
|
|
the prompt set of the prompt |
|
|
related links |
Links
| Relation | Description |
|---|---|
|
link to this prompt |
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
| Parameter | Description |
|---|---|
|
the id of the prompt |
Request fields
| Path | Type | Description |
|---|---|---|
|
|
the name of the prompt |
|
|
the system prompt template of the prompt |
|
|
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 |
|---|---|---|
|
|
the type of the entity |
|
|
the id of the prompt |
|
|
the name of the prompt |
|
|
the system prompt template of the prompt |
|
|
the user prompt template of the prompt |
|
|
the prompt set of the prompt |
|
|
related links |
Links
| Relation | Description |
|---|---|
|
link to this prompt |
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
| Parameter | Description |
|---|---|
|
list of prompt IDs to delete |
HTTP response
HTTP/1.1 204 No Content