POST
/
functions
/
{function_id}
/
call
/
stream
/
{revision_id}
import requests

url = "https://api.opper.ai/v2/functions/{function_id}/call/stream/{revision_id}"

payload = {
    "input": "<any>",
    "parent_span_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "examples": [
        {
            "comment": "Adds two numbers",
            "input": {
                "x": 1,
                "y": 3
            },
            "output": {"sum": 4}
        }
    ],
    "tags": {"tag": "value"}
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
{
  "data": {
    "delta": "Hello! How can I assist you today?",
    "span_id": "123e4567-e89b-12d3-a456-426614174000"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

function_id
string
required

The id of the function to call

revision_id
string
required

The id of the revision to call

Body

application/json

Response

200
text/event-stream

Server-Sent Events stream of function execution chunks

Server-Sent Event following the SSE specification