v2

latestOpenAPI 3.1.02026-07-2670186350.6 KB
functions

Update Function

Update a function, this will create a new revision of the function

patch/functions/{function_id}

Path parameters

function_idstring uuid required

Unique identifier of the function given as a UUID

Unique identifier of the function given as a UUID

Request body

namestring nullable

The name of the function. Must be unique within the project and can only contain letters, numbers, underscores and hyphens.

descriptionstring nullable

Optional description of the function. This is used to describe the function to a user.

instructionsstring nullable

The instructions for the function, this is the prompt that will be sent to the model to complete the task. Recommended to be concise and to the point

input_schemaobject nullable

Optional input schema for the function. Can preferably include field descriptions to allow the model to reason about the input variables. Schema is validated against the input data and issues an error if it does not match. With the Opper SDKs you can define these schemas through libraries like Pydantic and Zod. For schemas with definitions, prefer using '$defs' and '#/$defs/...' references.

output_schemaobject nullable

Optional output schema for the function. Can preferably include field descriptions to allow the model to reason about the output variables. Schema is validated against the output data and issues an error if it does not match. With the Opper SDKs you can define these schemas through libraries like Pydantic and Zod. For schemas with definitions, prefer using '$defs' and '#/$defs/...' references.

configurationobject nullable

Optional configuration for the function.Configuration is a dictionary of key-value pairs that can be used to override the default configuration for the function.

Example request

{
  "name": "my-function",
  "description": "This function is used to add two numbers and return the result.",
  "instructions": "You are a calculator that adds two numbers and returns the result.",
  "input_schema": {
    "properties": {
      "x": {
        "title": "X",
        "type": "integer"
      },
      "y": {
        "title": "Y",
        "type": "integer"
      }
    },
    "required": [
      "x",
      "y"
    ],
    "title": "OpperInputExample",
    "type": "object"
  },
  "output_schema": {
    "properties": {
      "sum": {
        "title": "Sum",
        "type": "integer"
      }
    },
    "required": [
      "sum"
    ],
    "title": "OpperOutputExample",
    "type": "object"
  },
  "configuration": {
    "beta.invocation.input_validation.enabled": false,
    "beta.invocation.xml_mode.enabled": false,
    "invocation.cache.ttl": 0,
    "invocation.few_shot.count": 3,
    "invocation.structured_generation.max_attempts": 5
  }
}

Response

Successful Response

namestring required

The name of the function. Must be unique within the project and can only contain letters, numbers, underscores and hyphens.

descriptionstring nullable

Optional description of the function. This is used to describe the function to a user.

instructionsstring required

The instructions for the function, this is the prompt that will be sent to the model to complete the task. Recommended to be concise and to the point

input_schemaobject nullable

Optional input schema for the function. Can preferably include field descriptions to allow the model to reason about the input variables. Schema is validated against the input data and issues an error if it does not match. With the Opper SDKs you can define these schemas through libraries like Pydantic and Zod. For schemas with definitions, prefer using '$defs' and '#/$defs/...' references.

output_schemaobject nullable

Optional output schema for the function. Can preferably include field descriptions to allow the model to reason about the output variables. Schema is validated against the output data and issues an error if it does not match. With the Opper SDKs you can define these schemas through libraries like Pydantic and Zod. For schemas with definitions, prefer using '$defs' and '#/$defs/...' references.

idstring uuid required

The ID of the function

dataset_idstring uuid nullable

The ID of the dataset associated with the function

revision_idstring uuid nullable

The ID of the latest revision of the function

observer_enabledboolean

Whether the observer is enabled for this function. When enabled, the observer monitors and evaluates all generations.

is_v3boolean

Whether this function has been executed through the v3 API

Example response

{
  "name": "my-function",
  "description": "This function is used to add two numbers and return the result.",
  "instructions": "You are a calculator that adds two numbers and returns the result.",
  "input_schema": {
    "properties": {
      "x": {
        "title": "X",
        "type": "integer"
      },
      "y": {
        "title": "Y",
        "type": "integer"
      }
    },
    "required": [
      "x",
      "y"
    ],
    "title": "OpperInputExample",
    "type": "object"
  },
  "output_schema": {
    "properties": {
      "sum": {
        "title": "Sum",
        "type": "integer"
      }
    },
    "required": [
      "sum"
    ],
    "title": "OpperOutputExample",
    "type": "object"
  }
}