Rafiki Worker API Reference
    Preparing search index...

    Variable QueryResponseSchemaConst

    QueryResponseSchema: ZodObject<
        {
            messages: ZodArray<
                ZodObject<
                    {
                        content: ZodOptional<
                            ZodUnion<
                                [
                                    ZodArray<
                                        ZodObject<
                                            {
                                                content: ...;
                                                id: ...;
                                                input: ...;
                                                is_error: ...;
                                                name: ...;
                                                signature: ...;
                                                text: ...;
                                                thinking: ...;
                                                tool_use_id: ...;
                                                type: ...;
                                            },
                                            "strict",
                                            ZodTypeAny,
                                            {
                                                content?: ...;
                                                id?: ...;
                                                input?: ...;
                                                is_error?: ...;
                                                name?: ...;
                                                signature?: ...;
                                                text?: ...;
                                                thinking?: ...;
                                                tool_use_id?: ...;
                                                type: ...;
                                            },
                                            {
                                                content?: ...;
                                                id?: ...;
                                                input?: ...;
                                                is_error?: ...;
                                                name?: ...;
                                                signature?: ...;
                                                text?: ...;
                                                thinking?: ...;
                                                tool_use_id?: ...;
                                                type: ...;
                                            },
                                        >,
                                        "many",
                                    >,
                                    ZodString,
                                    ZodNull,
                                ],
                            >,
                        >;
                        role: ZodOptional<ZodEnum<["user", "assistant"]>>;
                        type: ZodOptional<
                            ZodEnum<["user", "assistant", "system", "result", "stream_event"]>,
                        >;
                    },
                    "passthrough",
                    ZodTypeAny,
                    objectOutputType<
                        {
                            content: ZodOptional<
                                ZodUnion<
                                    [
                                        ZodArray<ZodObject<(...), (...), (...), (...), (...)>, "many">,
                                        ZodString,
                                        ZodNull,
                                    ],
                                >,
                            >;
                            role: ZodOptional<ZodEnum<["user", "assistant"]>>;
                            type: ZodOptional<
                                ZodEnum<["user", "assistant", "system", "result", "stream_event"]>,
                            >;
                        },
                        ZodTypeAny,
                        "passthrough",
                    >,
                    objectInputType<
                        {
                            content: ZodOptional<
                                ZodUnion<
                                    [
                                        ZodArray<ZodObject<(...), (...), (...), (...), (...)>, "many">,
                                        ZodString,
                                        ZodNull,
                                    ],
                                >,
                            >;
                            role: ZodOptional<ZodEnum<["user", "assistant"]>>;
                            type: ZodOptional<
                                ZodEnum<["user", "assistant", "system", "result", "stream_event"]>,
                            >;
                        },
                        ZodTypeAny,
                        "passthrough",
                    >,
                >,
                "many",
            >;
            ok: ZodBoolean;
            session_id: ZodOptional<ZodNullable<ZodString>>;
            summary: ZodObject<
                {
                    duration_api_ms: ZodOptional<ZodNullable<ZodNumber>>;
                    duration_ms: ZodOptional<ZodNullable<ZodNumber>>;
                    is_complete: ZodBoolean;
                    is_error: ZodOptional<ZodNullable<ZodBoolean>>;
                    num_turns: ZodOptional<ZodNullable<ZodNumber>>;
                    openai_trace_id: ZodOptional<ZodNullable<ZodString>>;
                    result: ZodOptional<ZodNullable<ZodString>>;
                    session_id: ZodOptional<ZodNullable<ZodString>>;
                    structured_output: ZodOptional<ZodNullable<ZodUnknown>>;
                    subtype: ZodOptional<ZodNullable<ZodString>>;
                    text: ZodOptional<ZodNullable<ZodString>>;
                    total_cost_usd: ZodOptional<ZodNullable<ZodNumber>>;
                    trace_id: ZodOptional<ZodNullable<ZodString>>;
                    usage: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodUnknown>>>;
                },
                "strict",
                ZodTypeAny,
                {
                    duration_api_ms?: number
                    | null;
                    duration_ms?: number | null;
                    is_complete: boolean;
                    is_error?: boolean | null;
                    num_turns?: number | null;
                    openai_trace_id?: string | null;
                    result?: string | null;
                    session_id?: string | null;
                    structured_output?: unknown;
                    subtype?: string | null;
                    text?: string | null;
                    total_cost_usd?: number | null;
                    trace_id?: string | null;
                    usage?: Record<string, unknown> | null;
                },
                {
                    duration_api_ms?: number
                    | null;
                    duration_ms?: number | null;
                    is_complete: boolean;
                    is_error?: boolean | null;
                    num_turns?: number | null;
                    openai_trace_id?: string | null;
                    result?: string | null;
                    session_id?: string | null;
                    structured_output?: unknown;
                    subtype?: string | null;
                    text?: string | null;
                    total_cost_usd?: number | null;
                    trace_id?: string | null;
                    usage?: Record<string, unknown> | null;
                },
            >;
        },
        "strict",
        ZodTypeAny,
        {
            messages: objectOutputType<
                {
                    content: ZodOptional<
                        ZodUnion<
                            [
                                ZodArray<
                                    ZodObject<
                                        {
                                            content: ...;
                                            id: ...;
                                            input: ...;
                                            is_error: ...;
                                            name: ...;
                                            signature: ...;
                                            text: ...;
                                            thinking: ...;
                                            tool_use_id: ...;
                                            type: ...;
                                        },
                                        "strict",
                                        ZodTypeAny,
                                        {
                                            content?: ...;
                                            id?: ...;
                                            input?: ...;
                                            is_error?: ...;
                                            name?: ...;
                                            signature?: ...;
                                            text?: ...;
                                            thinking?: ...;
                                            tool_use_id?: ...;
                                            type: ...;
                                        },
                                        {
                                            content?: ...;
                                            id?: ...;
                                            input?: ...;
                                            is_error?: ...;
                                            name?: ...;
                                            signature?: ...;
                                            text?: ...;
                                            thinking?: ...;
                                            tool_use_id?: ...;
                                            type: ...;
                                        },
                                    >,
                                    "many",
                                >,
                                ZodString,
                                ZodNull,
                            ],
                        >,
                    >;
                    role: ZodOptional<ZodEnum<["user", "assistant"]>>;
                    type: ZodOptional<
                        ZodEnum<["user", "assistant", "system", "result", "stream_event"]>,
                    >;
                },
                ZodTypeAny,
                "passthrough",
            >[];
            ok: boolean;
            session_id?: string
            | null;
            summary: {
                duration_api_ms?: number | null;
                duration_ms?: number | null;
                is_complete: boolean;
                is_error?: boolean | null;
                num_turns?: number | null;
                openai_trace_id?: string | null;
                result?: string | null;
                session_id?: string | null;
                structured_output?: unknown;
                subtype?: string | null;
                text?: string | null;
                total_cost_usd?: number | null;
                trace_id?: string | null;
                usage?: Record<string, unknown> | null;
            };
        },
        {
            messages: objectInputType<
                {
                    content: ZodOptional<
                        ZodUnion<
                            [
                                ZodArray<
                                    ZodObject<
                                        {
                                            content: ...;
                                            id: ...;
                                            input: ...;
                                            is_error: ...;
                                            name: ...;
                                            signature: ...;
                                            text: ...;
                                            thinking: ...;
                                            tool_use_id: ...;
                                            type: ...;
                                        },
                                        "strict",
                                        ZodTypeAny,
                                        {
                                            content?: ...;
                                            id?: ...;
                                            input?: ...;
                                            is_error?: ...;
                                            name?: ...;
                                            signature?: ...;
                                            text?: ...;
                                            thinking?: ...;
                                            tool_use_id?: ...;
                                            type: ...;
                                        },
                                        {
                                            content?: ...;
                                            id?: ...;
                                            input?: ...;
                                            is_error?: ...;
                                            name?: ...;
                                            signature?: ...;
                                            text?: ...;
                                            thinking?: ...;
                                            tool_use_id?: ...;
                                            type: ...;
                                        },
                                    >,
                                    "many",
                                >,
                                ZodString,
                                ZodNull,
                            ],
                        >,
                    >;
                    role: ZodOptional<ZodEnum<["user", "assistant"]>>;
                    type: ZodOptional<
                        ZodEnum<["user", "assistant", "system", "result", "stream_event"]>,
                    >;
                },
                ZodTypeAny,
                "passthrough",
            >[];
            ok: boolean;
            session_id?: string
            | null;
            summary: {
                duration_api_ms?: number | null;
                duration_ms?: number | null;
                is_complete: boolean;
                is_error?: boolean | null;
                num_turns?: number | null;
                openai_trace_id?: string | null;
                result?: string | null;
                session_id?: string | null;
                structured_output?: unknown;
                subtype?: string | null;
                text?: string | null;
                total_cost_usd?: number | null;
                trace_id?: string | null;
                usage?: Record<string, unknown> | null;
            };
        },
    > = ...

    Runtime schema for public /query and internal Modal query responses.