(prompts)
- list - List all prompts
- create - Create a prompt
- retrieve - Retrieve a prompt
- update - Update a prompt
- delete - Delete a prompt
- list_versions - List all prompt versions
- get_version - Retrieve a prompt version
Returns a list of your prompts. The prompts are returned sorted by creation date, with the most recent prompts appearing first
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.prompts.list()
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
limit |
Optional[float] | ➖ | A limit on the number of objects to be returned. Limit can range between 1 and 50, and the default is 10 |
starting_after |
Optional[str] | ➖ | A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, ending with 01JJ1HDHN79XAS7A01WB3HYSDB , your subsequent call can include after=01JJ1HDHN79XAS7A01WB3HYSDB in order to fetch the next page of the list. |
ending_before |
Optional[str] | ➖ | A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, starting with 01JJ1HDHN79XAS7A01WB3HYSDB , your subsequent call can include before=01JJ1HDHN79XAS7A01WB3HYSDB in order to fetch the previous page of the list. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.GetAllPromptsResponseBody
Error Type | Status Code | Content Type |
---|---|---|
models.APIError | 4XX, 5XX | */* |
Create a prompt
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.prompts.create(request={
"display_name": "Jed6",
"prompt_config": {
"messages": [
{
"role": "system",
"content": "<value>",
},
{
"role": "system",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://well-worn-formation.biz",
},
},
{
"type": "text",
"text": "<value>",
},
{
"type": "text",
"text": "<value>",
},
],
},
{
"role": "assistant",
"content": "<value>",
},
],
},
"path": "Customer Service/Billing/Refund",
})
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
request |
models.CreatePromptRequestBody | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.CreatePromptResponseBody
Error Type | Status Code | Content Type |
---|---|---|
models.APIError | 4XX, 5XX | */* |
Retrieves a prompt object
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.prompts.retrieve(id="<id>")
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
id |
str | ✔️ | Unique identifier of the prompt |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.GetOnePromptResponseBody
Error Type | Status Code | Content Type |
---|---|---|
models.APIError | 4XX, 5XX | */* |
Update a prompt
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.prompts.update(id="<id>", path="Customer Service/Billing/Refund")
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
str | ✔️ | Unique identifier of the prompt | |
owner |
Optional[str] | ➖ | N/A | |
domain_id |
Optional[str] | ➖ | N/A | |
created |
Optional[str] | ➖ | N/A | |
updated |
Optional[str] | ➖ | N/A | |
created_by_id |
OptionalNullable[str] | ➖ | N/A | |
updated_by_id |
OptionalNullable[str] | ➖ | N/A | |
display_name |
Optional[str] | ➖ | The prompt’s name, meant to be displayable in the UI. | |
description |
OptionalNullable[str] | ➖ | The prompt’s description, meant to be displayable in the UI. Use this field to optionally store a long form explanation of the prompt for your own purpose | |
prompt_config |
Optional[models.UpdatePromptPromptConfig] | ➖ | A list of messages compatible with the openAI schema | |
metadata |
Optional[models.UpdatePromptMetadata] | ➖ | N/A | |
path |
Optional[str] | ➖ | The path where the entity is stored in the project structure. The first element of the path always represents the project name. Any subsequent path element after the project will be created as a folder in the project if it does not exists. | Customer Service/Billing/Refund |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.UpdatePromptResponseBody
Error Type | Status Code | Content Type |
---|---|---|
models.UpdatePromptPromptsResponseBody | 404 | application/json |
models.APIError | 4XX, 5XX | */* |
Delete a prompt
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
orq.prompts.delete(id="<id>")
# Use the SDK ...
Parameter | Type | Required | Description |
---|---|---|---|
id |
str | ✔️ | Unique identifier of the prompt |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
models.APIError | 4XX, 5XX | */* |
Returns a list of your prompt versions. The prompt versions are returned sorted by creation date, with the most recent prompt versions appearing first
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.prompts.list_versions(prompt_id="<id>")
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
prompt_id |
str | ✔️ | N/A |
limit |
Optional[float] | ➖ | A limit on the number of objects to be returned. Limit can range between 1 and 50, and the default is 10 |
starting_after |
Optional[str] | ➖ | A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, ending with 01JJ1HDHN79XAS7A01WB3HYSDB , your subsequent call can include after=01JJ1HDHN79XAS7A01WB3HYSDB in order to fetch the next page of the list. |
ending_before |
Optional[str] | ➖ | A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, starting with 01JJ1HDHN79XAS7A01WB3HYSDB , your subsequent call can include before=01JJ1HDHN79XAS7A01WB3HYSDB in order to fetch the previous page of the list. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.ListPromptVersionsResponseBody
Error Type | Status Code | Content Type |
---|---|---|
models.APIError | 4XX, 5XX | */* |
Retrieves a specific version of a prompt by its ID and version ID.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.prompts.get_version(prompt_id="<id>", version_id="<id>")
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
prompt_id |
str | ✔️ | The unique identifier of the prompt |
version_id |
str | ✔️ | The unique identifier of the prompt version |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.GetPromptVersionResponseBody
Error Type | Status Code | Content Type |
---|---|---|
models.GetPromptVersionPromptsResponseBody | 404 | application/json |
models.APIError | 4XX, 5XX | */* |