evalution
    Preparing search index...

    Variable promptsConst

    prompts: <Prompts extends Record<string, (...args: any[]) => Prompt>>(
        __namedParameters: PromptsHelperOptions,
        factory: (providers: Providers) => Prompts,
    ) => (provided?: Partial<Providers>) => Prompts = ...

    Helper for defining Evalution prompt modules using the Vercel AI SDK.

    The first argument is a PromptsHelperOptions containing an id that, combined with each prompt's name, forms a globally-unique prompt ID. This ID is attached to every span the prompt produces so runtime traces can be resolved back to the prompt. Choose a stable, unique value for this id and do not change it.

    The second argument is a factory function that receives a Providers object and returns a record of prompt-building functions. Each key in the returned record is the prompt name, and each value is a function that returns a Vercel AI SDK config object (generateText / streamText parameters) with experimental_telemetry automatically populated. The Providers object lazily imports provider singletons (e.g. openai from @ai-sdk/openai) on first access, so only the providers you destructure need to be installed. You can override individual providers by passing a Partial<{@link Providers}> to the function returned by prompts.

    Type Declaration

    import { prompts } from "@evalution/vercel-ai-sdk";

    export default prompts(
    { id: "greeting" }, // <- global, unique ID for this group of prompts

    // destructure provider functions you need here instead of importing them
    ({ openai }) => ({

    // "simple" is the prompt name; result is passed to `generateText`
    simple: () => ({
    model: openai('gpt-4o'),
    system: 'You are a helpful assistant',
    messages: [{ role: 'user', content: 'Hello!' }],
    }),
    }));