POST /{workspace}/{project}/{prompt}/{environment}

Get completion for stored prompt. The response format is the same as OpenAI Chat completion response.

Request

  • Base URL
    https://api.langtail.com
  • Auth
    none declared. Required headers: X-API-Key

Path parameters

workspacestring required
Example:workspace

Your workspace URL slug

projectstring required
Example:project

Your project URL slug

promptstring required
Example:prompt

Your prompt URL slug

environmentstring required
Example:production

Your environment URL slug

Headers

X-API-Keystring required
Example:<LANGTAIL_API_KEY>

Your Langtail API Key

Request body

variablesobject

A mapping of variable names to their values. Will be injected in your saved prompt template.

streamboolean
modelstring

Overrides the model of deployed prompt.

max_tokensnumber

Overrides the max tokens of deployed prompt. The maximum number of tokens that can be generated in the completion.

temperaturenumber

Overrides the temperature of deployed prompt. What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

top_pnumber

Overrides the top_p of deployed prompt. An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.

presence_penaltynumber

Overrides the presence_penalty of deployed prompt.

frequency_penaltynumber

Overrides the frequency_penalty of deployed prompt.

userstring

A unique identifier representing your end-user

doNotRecordboolean

If true, potentially sensitive data like the prompt and response will not be recorded in the logs

metadataobject

Additional custom data that will be stored for this request

seednumber

A seed is used to generate reproducible results

Example request

{
  "variables": {
    "variableName": "Your Value"
  },
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "user": "user_123",
  "metadata": {
    "my_identifier": "my-custom-ID"
  },
  "seed": 123
}

Response

Chat completion response from OpenAI - see https://platform.openai.com/docs/api-reference/chat/object for more details.

idstring required

A unique identifier for the chat completion.

objectstring required

The object type, which is always chat.completion.

creatednumber required

The Unix timestamp (in seconds) of when the chat completion was created.

modelstring required

The model used for the chat completion.

Example response

{
  "choices": [
    {
      "message": {
        "content": "I'm sorry, but I'm not able to fulfill this request."
      }
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.