Constimport { 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!' }],
}),
}));
Helper for defining Evalution prompt modules using the Vercel AI SDK.
The first argument is a PromptsHelperOptions containing an
idthat, 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 thisidand 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/streamTextparameters) withexperimental_telemetryautomatically populated. TheProvidersobject lazily imports provider singletons (e.g.openaifrom@ai-sdk/openai) on first access, so only the providers you destructure need to be installed. You can override individual providers by passing aPartial<{@link Providers}>to the function returned byprompts.