Tela SDK for JavaScript
    Preparing search index...

    Interface BatchParams

    Configuration options for batch execution.

    Batch executions are always asynchronous and return results via output file. Unlike single executions, batches do not support streaming or synchronous modes.

    interface BatchParams {
        label?: string;
        messages?: { content: string; role: string }[];
        override?: {
            functions?: {
                description?: string;
                id: string;
                name: string;
                parameters?: {
                    properties: Record<string, unknown>;
                    required?: string[];
                    type: "object";
                };
            }[];
            model?: string;
            temperature?: number;
            type: "chat"
            | "completion";
        };
        pollingInterval?: string
        | number;
        pollingTimeout?: string | number;
        tags?: string[];
        webhook?: BatchWebhookConfig;
        webhookUrl?: string;
    }

    Hierarchy

    Index

    Properties

    label?: string

    Optional label for this execution when using applicationId. This label can be used to identify or categorize the execution. Note: This field is only applicable when applicationId is provided.

    messages?: { content: string; role: string }[]

    An array of previous messages in the conversation. Each message should have a 'role' (e.g., 'user', 'assistant') and 'content'.

    override?: {
        functions?: {
            description?: string;
            id: string;
            name: string;
            parameters?: {
                properties: Record<string, unknown>;
                required?: string[];
                type: "object";
            };
        }[];
        model?: string;
        temperature?: number;
        type: "chat"
        | "completion";
    }

    Override default settings specified in the canvas. This allows for fine-tuning the completion behavior for this specific request.

    Type Declaration

    • Optionalfunctions?: {
          description?: string;
          id: string;
          name: string;
          parameters?: {
              properties: Record<string, unknown>;
              required?: string[];
              type: "object";
          };
      }[]

      An array of functions that the model can call. This allows for more structured and interactive completions.

    • Optionalmodel?: string

      The specific model to use for this completion. If not specified, the default model set in the canvas will be used.

    • Optionaltemperature?: number

      Controls randomness in the output. Values between 0 and 1. Lower values make the output more focused and deterministic.

    • type: "chat" | "completion"

      Specifies whether to use a chat or completion model.

    pollingInterval?: string | number

    Time (in milliseconds if number) between polling attempts (e.g. "1s", "1m", "1h", "1d"). Controls how frequently the SDK checks batch completion status.

    "1s"
    
    pollingTimeout?: string | number

    Maximum time (in milliseconds if number) to wait for completion before timing out (e.g. "1s", "1m", "1h", "1d"). After timeout, polling stops but the batch continues processing on the server.

    "1m"
    
    tags?: string[]

    Optional array of tags to associate with this execution. Tags can be used for filtering, categorization, and analytics.

    Webhook configuration for batch completion notifications. Supports both URL and custom headers to forward.

    webhook: {
    url: 'https://example.com/webhook',
    headers: {
    'user-id': '12345',
    'session': 'abc-xyz'
    }
    }
    webhookUrl?: string

    Optional webhook URL to receive completion notifications. The server will POST to this URL when the batch completes, fails, or is canceled.

    Use the webhook parameter instead for more configuration options.

    // Old way (deprecated)
    const batch = canvas.createBatch({
    webhookUrl: 'https://example.com/webhook'
    })

    // New way (recommended)
    const batch = canvas.createBatch({
    webhook: {
    url: 'https://example.com/webhook',
    headers: { 'user-id': '12345' }
    }
    })