Interface PromptConfig<I, O, CustomOptions>

Configuration for a prompt action.

interface PromptConfig<
    I extends ZodTypeAny = ZodTypeAny,
    O extends ZodTypeAny = ZodTypeAny,
    CustomOptions extends ZodTypeAny = ZodTypeAny,
> {
    config?: TypeOf<CustomOptions>;
    context?: ActionContext;
    description?: string;
    docs?:
        | {
            content: (
                | { media?: undefined; text: string }
                | { media: { contentType?: string; url: string }; text?: undefined }
            )[];
            metadata?: Record<string, any>;
        }[]
        | DocsResolver<TypeOf<I>, any>;
    input?: { jsonSchema?: JSONSchema7; schema?: I };
    maxTurns?: number;
    messages?:
        | string
        | {
            content: (
                | {
                    custom?: Record<string, unknown>;
                    data?: unknown;
                    media?: undefined;
                    metadata?: Record<string, unknown>;
                    text: string;
                    toolRequest?: undefined;
                    toolResponse?: undefined;
                }
                | {
                    custom?: Record<string, unknown>;
                    data?: unknown;
                    media: { contentType?: string; url: string };
                    metadata?: Record<string, unknown>;
                    text?: undefined;
                    toolRequest?: undefined;
                    toolResponse?: undefined;
                }
                | {
                    custom?: Record<string, unknown>;
                    data?: unknown;
                    media?: undefined;
                    metadata?: Record<string, unknown>;
                    text?: undefined;
                    toolRequest: { input?: unknown; name: string; ref?: string };
                    toolResponse?: undefined;
                }
                | {
                    custom?: Record<string, unknown>;
                    data?: unknown;
                    media?: undefined;
                    metadata?: Record<string, unknown>;
                    text?: undefined;
                    toolRequest?: undefined;
                    toolResponse: { name: string; output?: unknown; ref?: string };
                }
                | {
                    custom?: Record<string, unknown>;
                    data?: unknown;
                    media?: undefined;
                    metadata?: Record<string, unknown>;
                    text?: undefined;
                    toolRequest?: undefined;
                    toolResponse?: undefined;
                }
                | {
                    custom: Record<string, any>;
                    data?: unknown;
                    media?: undefined;
                    metadata?: Record<string, unknown>;
                    text?: undefined;
                    toolRequest?: undefined;
                    toolResponse?: undefined;
                }
            )[];
            metadata?: Record<string, unknown>;
            role: "user" | "model" | "tool" | "system";
        }[]
        | MessagesResolver<TypeOf<I>, any>;
    metadata?: Record<string, any>;
    model?: ModelArgument<CustomOptions>;
    name: string;
    output?: OutputOptions<O>;
    prompt?:
        | string
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text: string;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media: { contentType?: string; url: string };
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest: { input?: unknown; name: string; ref?: string };
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse: { name: string; output?: unknown; ref?: string };
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom: Record<string, any>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | (
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text: string;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media: { contentType?: string; url: string };
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest: { input?: unknown; name: string; ref?: string };
                toolResponse?: undefined;
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse: { name: string; output?: unknown; ref?: string };
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
            | {
                custom: Record<string, any>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
        )[]
        | PartsResolver<TypeOf<I>, any>;
    returnToolRequests?: boolean;
    system?:
        | string
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text: string;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media: { contentType?: string; url: string };
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest: { input?: unknown; name: string; ref?: string };
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse: { name: string; output?: unknown; ref?: string };
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom: Record<string, any>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | (
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text: string;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media: { contentType?: string; url: string };
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest: { input?: unknown; name: string; ref?: string };
                toolResponse?: undefined;
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse: { name: string; output?: unknown; ref?: string };
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
            | {
                custom: Record<string, any>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
        )[]
        | PartsResolver<TypeOf<I>, any>;
    toolChoice?: ToolChoice;
    tools?: ToolArgument<ZodTypeAny, ZodTypeAny>[];
    use?: ModelMiddleware[];
    variant?: string;
}

Type Parameters

Properties

context?: ActionContext
description?: string
docs?:
    | {
        content: (
            | { media?: undefined; text: string }
            | { media: { contentType?: string; url: string }; text?: undefined }
        )[];
        metadata?: Record<string, any>;
    }[]
    | DocsResolver<TypeOf<I>, any>
input?: { jsonSchema?: JSONSchema7; schema?: I }
maxTurns?: number
messages?:
    | string
    | {
        content: (
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text: string;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media: { contentType?: string; url: string };
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest: { input?: unknown; name: string; ref?: string };
                toolResponse?: undefined;
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse: { name: string; output?: unknown; ref?: string };
            }
            | {
                custom?: Record<string, unknown>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
            | {
                custom: Record<string, any>;
                data?: unknown;
                media?: undefined;
                metadata?: Record<string, unknown>;
                text?: undefined;
                toolRequest?: undefined;
                toolResponse?: undefined;
            }
        )[];
        metadata?: Record<string, unknown>;
        role: "user" | "model" | "tool" | "system";
    }[]
    | MessagesResolver<TypeOf<I>, any>
metadata?: Record<string, any>
name: string
output?: OutputOptions<O>
prompt?:
    | string
    | {
        custom?: Record<string, unknown>;
        data?: unknown;
        media?: undefined;
        metadata?: Record<string, unknown>;
        text: string;
        toolRequest?: undefined;
        toolResponse?: undefined;
    }
    | {
        custom?: Record<string, unknown>;
        data?: unknown;
        media: { contentType?: string; url: string };
        metadata?: Record<string, unknown>;
        text?: undefined;
        toolRequest?: undefined;
        toolResponse?: undefined;
    }
    | {
        custom?: Record<string, unknown>;
        data?: unknown;
        media?: undefined;
        metadata?: Record<string, unknown>;
        text?: undefined;
        toolRequest: { input?: unknown; name: string; ref?: string };
        toolResponse?: undefined;
    }
    | {
        custom?: Record<string, unknown>;
        data?: unknown;
        media?: undefined;
        metadata?: Record<string, unknown>;
        text?: undefined;
        toolRequest?: undefined;
        toolResponse: { name: string; output?: unknown; ref?: string };
    }
    | {
        custom?: Record<string, unknown>;
        data?: unknown;
        media?: undefined;
        metadata?: Record<string, unknown>;
        text?: undefined;
        toolRequest?: undefined;
        toolResponse?: undefined;
    }
    | {
        custom: Record<string, any>;
        data?: unknown;
        media?: undefined;
        metadata?: Record<string, unknown>;
        text?: undefined;
        toolRequest?: undefined;
        toolResponse?: undefined;
    }
    | (
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text: string;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media: { contentType?: string; url: string };
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest: { input?: unknown; name: string; ref?: string };
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse: { name: string; output?: unknown; ref?: string };
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom: Record<string, any>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
    )[]
    | PartsResolver<TypeOf<I>, any>
returnToolRequests?: boolean
system?:
    | string
    | {
        custom?: Record<string, unknown>;
        data?: unknown;
        media?: undefined;
        metadata?: Record<string, unknown>;
        text: string;
        toolRequest?: undefined;
        toolResponse?: undefined;
    }
    | {
        custom?: Record<string, unknown>;
        data?: unknown;
        media: { contentType?: string; url: string };
        metadata?: Record<string, unknown>;
        text?: undefined;
        toolRequest?: undefined;
        toolResponse?: undefined;
    }
    | {
        custom?: Record<string, unknown>;
        data?: unknown;
        media?: undefined;
        metadata?: Record<string, unknown>;
        text?: undefined;
        toolRequest: { input?: unknown; name: string; ref?: string };
        toolResponse?: undefined;
    }
    | {
        custom?: Record<string, unknown>;
        data?: unknown;
        media?: undefined;
        metadata?: Record<string, unknown>;
        text?: undefined;
        toolRequest?: undefined;
        toolResponse: { name: string; output?: unknown; ref?: string };
    }
    | {
        custom?: Record<string, unknown>;
        data?: unknown;
        media?: undefined;
        metadata?: Record<string, unknown>;
        text?: undefined;
        toolRequest?: undefined;
        toolResponse?: undefined;
    }
    | {
        custom: Record<string, any>;
        data?: unknown;
        media?: undefined;
        metadata?: Record<string, unknown>;
        text?: undefined;
        toolRequest?: undefined;
        toolResponse?: undefined;
    }
    | (
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text: string;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media: { contentType?: string; url: string };
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest: { input?: unknown; name: string; ref?: string };
            toolResponse?: undefined;
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse: { name: string; output?: unknown; ref?: string };
        }
        | {
            custom?: Record<string, unknown>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
        | {
            custom: Record<string, any>;
            data?: unknown;
            media?: undefined;
            metadata?: Record<string, unknown>;
            text?: undefined;
            toolRequest?: undefined;
            toolResponse?: undefined;
        }
    )[]
    | PartsResolver<TypeOf<I>, any>
toolChoice?: ToolChoice
variant?: string