Our Python SDK got smarter. We developed a Typscript SDK too. We are updating our SDK code blocks. Python SDKhere.Typscript SDKhere.
Description
Patronus AI APIProduct context

Create Product Context Revision

POST
/v1/product-context-revision
/v1/product-context-revision

The Authorization access token

Authorization

X-API-KEY<token>

In: header

Request Body

application/jsonRequired

project_id
Required
Project Id

Format: "uuid"

product_context_idProduct Context Id

product_context_nameProduct Context Name

product_context_descriptionProduct Context Description

prompt_revision_id
Required
Prompt Revision Id

Format: "uuid"

product_description
Required
Product Description

Minimum length: 1Maximum length: 100000

product_context
Required
Product Context

metadataMetadata

Optional JSON metadata to associate with this revision

create_only_if_not_existsCreate Only If Not Exists

If true, creation will fail if a product context with the same name already exists in the project. Only applies when creating a new product context (not providing product_context_id).

Default: false
curl -X POST "https://api.patronus.ai/v1/product-context-revision" \
  -H "X-API-KEY: <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
    "product_context_id": "7a3c3bc0-75c1-4519-a22b-593b97c3c46c",
    "product_context_name": "string",
    "product_context_description": "string",
    "prompt_revision_id": "3e4170fb-ad54-4811-b2d7-694231666063",
    "product_description": "string",
    "product_context": {},
    "metadata": {},
    "create_only_if_not_exists": false
  }'

Successful Response

{
  "product_context_revision": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "product_context_definition_id": "b886aafa-c94b-4ef3-b996-993f5c4a9f75",
    "product_context_definition_name": "string",
    "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
    "revision": 0,
    "prompt_revision_id": "3e4170fb-ad54-4811-b2d7-694231666063",
    "product_description": "string",
    "product_context": {},
    "metadata": {},
    "labels": [
      "string"
    ],
    "created_at": "2019-08-24T14:15:22Z"
  }
}