Genkit JS API reference
    Preparing search index...

    Interface PluginOptions

    interface PluginOptions {
        apiKey?: string | false;
        baseURL?: string | null;
        dangerouslyAllowBrowser?: boolean;
        defaultHeaders?: Headers;
        defaultQuery?: DefaultQuery;
        fetch?: Fetch;
        httpAgent?: Agent;
        initializer?: (client: OpenAI) => Promise<ResolvableAction[]>;
        listActions?: (
            client: OpenAI,
        ) => Promise<ActionMetadata<z.ZodTypeAny, z.ZodTypeAny, z.ZodTypeAny>[]>;
        maxRetries?: number;
        name: string;
        organization?: string | null;
        project?: string | null;
        resolver?: (
            client: OpenAI,
            actionType:
                | "custom"
                | "prompt"
                | "model"
                | "tool"
                | "dynamic-action-provider"
                | "embedder"
                | "evaluator"
                | "executable-prompt"
                | "flow"
                | "indexer"
                | "background-model"
                | "check-operation"
                | "cancel-operation"
                | "reranker"
                | "retriever"
                | "tool.v2"
                | "util"
                | "resource",
            actionName: string,
        ) => ResolvableAction | Promise<(ResolvableAction | undefined)> | undefined;
        timeout?: number;
    }

    Hierarchy

    • Partial<Omit<ClientOptions, "apiKey">>
      • PluginOptions
    Index

    Properties

    apiKey?: string | false
    baseURL?: string | null

    Override the default base URL for the API, e.g., "https://api.example.com/v2/"

    Defaults to process.env['OPENAI_BASE_URL'].

    dangerouslyAllowBrowser?: boolean

    By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. Only set this option to true if you understand the risks and have appropriate mitigations in place.

    defaultHeaders?: Headers

    Default headers to include with every request to the API.

    These can be removed in individual requests by explicitly setting the header to undefined or null in request options.

    defaultQuery?: DefaultQuery

    Default query parameters to include with every request to the API.

    These can be removed in individual requests by explicitly setting the param to undefined in request options.

    fetch?: Fetch

    Specify a custom fetch function implementation.

    If not provided, we use node-fetch on Node.js and otherwise expect that fetch is defined globally.

    httpAgent?: Agent

    An HTTP agent used to manage HTTP(S) connections.

    If not provided, an agent will be constructed by default in the Node.js environment, otherwise no agent is used.

    initializer?: (client: OpenAI) => Promise<ResolvableAction[]>
    listActions?: (
        client: OpenAI,
    ) => Promise<ActionMetadata<z.ZodTypeAny, z.ZodTypeAny, z.ZodTypeAny>[]>
    maxRetries?: number

    The maximum number of times that the client will retry a request in case of a temporary failure, like a network error or a 5XX error from the server.

    2
    
    name: string
    organization?: string | null

    Defaults to process.env['OPENAI_ORG_ID'].

    project?: string | null

    Defaults to process.env['OPENAI_PROJECT_ID'].

    resolver?: (
        client: OpenAI,
        actionType:
            | "custom"
            | "prompt"
            | "model"
            | "tool"
            | "dynamic-action-provider"
            | "embedder"
            | "evaluator"
            | "executable-prompt"
            | "flow"
            | "indexer"
            | "background-model"
            | "check-operation"
            | "cancel-operation"
            | "reranker"
            | "retriever"
            | "tool.v2"
            | "util"
            | "resource",
        actionName: string,
    ) => ResolvableAction | Promise<(ResolvableAction | undefined)> | undefined
    timeout?: number

    The maximum amount of time (in milliseconds) that the client should wait for a response from the server before timing out a single request.

    Note that request timeouts are retried by default, so in a worst-case scenario you may wait much longer than this timeout before the promise succeeds or fails.