Constructors

Methods

Constructors

Methods

  • Send a response.create event. Returns a typed StreamChannel<WsServerEvent> that yields validated server events until the response terminates.

    Parameters

    • payload: {
          input: unknown[];
          metadata?: Record<string, string>;
          model: string;
          previous_response_id?: null | string;
          store?: boolean;
          temperature?: number;
          tools?: unknown[];
          type: "response.create";
      }
      • input: unknown[]
      • Optional metadata?: Record<string, string>
      • model: string
      • Optional previous_response_id?: null | string
      • Optional store?: boolean
      • Optional temperature?: number
      • Optional tools?: unknown[]
      • type: "response.create"

    Returns StreamChannel<{
        response: {
            id: string;
        };
        type: "response.created";
    } | {
        item: {
            arguments: string;
            call_id: string;
            name: string;
            type: "function_call";
        } | {
            type: "message";
        } | {
            type: "reasoning";
        } | {
            type: "file";
        } | {
            type: "computer_call";
        } | {
            type: "web_search_call";
        };
        type: "response.output_item.done";
    } | {
        delta: string;
        type: "response.output_text.delta";
    } | {
        response: {
            id: string;
            usage?: {
                input_tokens: number;
                input_tokens_details: {
                    cached_tokens: number;
                };
                output_tokens: number;
                total_tokens: number;
            };
        };
        type: "response.completed";
    } | {
        response: {
            error?: {
                code?: string;
                message?: string;
            };
            id?: string;
        };
        type: "response.failed";
    } | {
        error?: {
            code?: string;
            message?: string;
            param?: string;
            type?: string;
        };
        message?: string;
        status?: number;
        type: "error";
    }, Error>