evalution
    Preparing search index...

    Interface PromptProvider<TPrompt>

    A source of prompts that the playground can display and execute.

    Implement this interface to add a custom prompt source — for example, prompts stored in a database or fetched from a remote API. If you simply need to support a file format other than TypeScript, use FilePromptProvider with a custom PromptFileType.

    interface PromptProvider<TPrompt extends NormalizedPrompt = NormalizedPrompt> {
        description?: string;
        displayName?: string;
        icon?: string;
        id: string;
        addPrompt?(partial: Partial<TPrompt>): Promise<TPrompt | AddPromptContext>;
        execute(
            promptId: string,
            params: any[],
            options?: ExecuteOptions,
        ): Promise<void>;
        getAllPrompts(): Promise<TPrompt[]>;
        getModelCatalog?(): Promise<ModelCatalog>;
        getModelParameters?(): PropDefinition[];
        getPrompt(id: string): Promise<TPrompt | null>;
        renamePrompt?(promptId: string, newName: string): Promise<TPrompt>;
        setupTraceIngestion?(): Promise<TraceIngestor | undefined>;
        updatePromptProperties?(
            promptId: string,
            updates: NormalizedPromptUpdates,
        ): Promise<TPrompt>;
        watch?(callback: (event: PromptChangeEvent) => void): () => void;
    }

    Type Parameters

    Implemented by

    Index

    Properties

    description?: string

    Short description of what this provider offers.

    displayName?: string

    Human-readable name shown when choosing between providers.

    icon?: string

    SVG icon markup for this provider.

    id: string

    Uniquely identifies this provider when multiple providers are used.

    Methods

    • Executes a prompt.

      Parameters

      • promptId: string

        ID of the prompt to run.

      • params: any[]

        Positional arguments forwarded to the prompt function.

      • Optionaloptions: ExecuteOptions

        Optional execution settings; see ExecuteOptions.

      Returns Promise<void>

    • Returns the prompt with the given ID, or null if not found.

      Parameters

      • id: string

        The prompt's unique identifier.

      Returns Promise<TPrompt | null>

    • Renames a prompt and returns the updated prompt with its new ID.

      Optional — providers that do not support renaming may omit it.

      Parameters

      • promptId: string

        ID of the prompt to rename.

      • newName: string

        The new name for the prompt.

      Returns Promise<TPrompt>

    • Applies normalized updates to a prompt's source and returns the fresh prompt. Setting any field of updates to null removes the corresponding property from the underlying source.

      This method is optional; providers that do not support in-place editing may omit it.

      Parameters

      • promptId: string

        ID of the prompt to update.

      • updates: NormalizedPromptUpdates

        Updates expressed in the normalized vocabulary.

      Returns Promise<TPrompt>

    • Registers a callback that is invoked whenever a prompt changes. Returns a cleanup function that stops the watcher when called.

      Optional — providers that cannot detect live changes may omit it.

      Parameters

      Returns () => void

      A no-argument function that unregisters the watcher.