PATCH
/
prompt-version
/
{id}
curl --request PATCH \
  --url https://api.tela.com/prompt-version/{id} \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "<string>",
  "content": "<string>",
  "markdownContent": "<string>",
  "configuration": {
    "model": "<string>",
    "temperature": 123,
    "type": "chat",
    "structuredOutput": {
      "enabled": true,
      "schema": {}
    }
  },
  "variables": [
    {
      "name": "<string>",
      "type": "file",
      "required": true,
      "description": "<string>",
      "processingOptions": {
        "allowMultimodal": true
      }
    }
  ],
  "promoted": true,
  "draft": true,
  "messages": {
    "role": "user",
    "content": "<string>",
    "index": 123
  }
}'
{
  "id": "<string>",
  "promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "title": "<string>",
  "content": "<string>",
  "markdownContent": "<string>",
  "configuration": {
    "model": "<string>",
    "temperature": 123,
    "type": "chat",
    "structuredOutput": {
      "enabled": true,
      "schema": {}
    }
  },
  "variables": [
    {
      "name": "<string>",
      "type": "file",
      "required": true,
      "description": "<string>",
      "processingOptions": {
        "allowMultimodal": true
      }
    }
  ],
  "promoted": true,
  "draft": true,
  "messages": {
    "role": "user",
    "content": "<string>",
    "index": 123
  },
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z"
}

Update a Prompt Version

This endpoint updates an existing prompt version with new configuration, variables, or content.

URL Parameters

ParameterTypeDescription
idstringThe ID of the prompt version to update

Request Body

The request body may include any of the following fields to update:

ParameterTypeDescription
titlestringThe title of the prompt version (max 256 characters)
contentstringPlain text content of the prompt
markdownContentstringMarkdown content of the prompt
configurationobjectConfiguration settings for the prompt version
variablesarrayAn array of variable objects used in the prompt
promotedbooleanWhether this version is promoted
draftbooleanWhether this version is a draft
messagesarray/objectMessages for chat-type prompts

Examples

const promptVersionId = 'version_uuid'
const updateData = {
  title: 'Document Analysis v2.1',
  configuration: {
    temperature: 0.5 // Updating just the temperature
  },
  promoted: true,
  draft: false
}

const response = await fetch(`https://api.tela.ai/prompt-version/${promptVersionId}`, {
  method: 'PATCH',
  headers: {
    'Authorization': `Bearer ${process.env.TELA_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(updateData)
})

const updatedVersion = await response.json()
console.log(updatedVersion)

Response

The response includes the updated prompt version object with the changes applied.

{
  "id": "version_uuid",
  "promptId": "prompt_uuid",
  "title": "Document Analysis v2.1",
  "content": "Analyze the following document and answer the question.",
  "markdownContent": "# Document Analysis\n\nAnalyze the following document and answer the question.",
  "configuration": {
    "model": "claude-3-opus-20240229",
    "temperature": 0.5, 
    "type": "chat"
  },
  "variables": [
    {
      "name": "document",
      "type": "file",
      "required": true,
      "description": "The document to analyze"
    },
    {
      "name": "query",
      "type": "text",
      "required": true,
      "description": "The specific question about the document"
    }
  ],
  "promoted": true,
  "draft": false,
  "messages": [
    {
      "role": "system",
      "content": "You are a document analysis assistant."
    },
    {
      "role": "user",
      "content": "Please analyze the document {{document}} and answer this question: {{query}}"
    }
  ],
  "createdAt": "2024-04-01T12:00:00.000Z",
  "updatedAt": "2024-04-15T14:30:00.000Z"
}

Update Variables Example

const promptVersionId = 'version_uuid'
const updateData = {
  variables: [
    {
      name: 'document',
      type: 'file',
      required: true,
      description: 'The document to analyze'
    },
    {
      name: 'query',
      type: 'text',
      required: true,
      description: 'The specific question about the document'
    },
    {
      name: 'format',
      type: 'text',
      required: false,
      description: 'Preferred format for the analysis (bullet points, paragraph, etc.)'
    }
  ]
}

const response = await fetch(`https://api.tela.ai/prompt-version/${promptVersionId}`, {
  method: 'PATCH',
  headers: {
    'Authorization': `Bearer ${process.env.TELA_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(updateData)
})

const updatedVersion = await response.json()
console.log(updatedVersion)

Path Parameters

id
string
required

Body

application/json

Response

200 - application/json

Prompt version updated successfully

The response is of type object.