Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Promptfoo Promptfoo Prompt Suggestions

From Leeroopedia
Revision as of 13:43, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Promptfoo_Promptfoo_Prompt_Suggestions.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Prompt_Engineering, LLM_Integration
Last Updated 2026-02-14 07:45 GMT

Overview

Concrete tool for generating prompt variants by calling an LLM to suggest alternative phrasings of a given prompt.

Description

The Prompt_Suggestions module (suggestions.ts) provides the generatePrompts() function that uses the default OpenAI suggestions provider to create prompt variants. Given an input prompt, it sends it to the LLM with a system message requesting variants, and returns the generated alternatives along with token usage statistics.

Usage

Called from the web UI or CLI when users request automatic prompt suggestions or improvements.

Code Reference

Source Location

Signature

export async function generatePrompts(
  prompt: string,
  _num: number,
): Promise<GeneratePromptsOutput>

Import

import { generatePrompts } from './suggestions';

I/O Contract

Inputs

Name Type Required Description
prompt string Yes The original prompt to generate variants for
_num number Yes Number of variants requested (currently returns 1)

Outputs

Name Type Description
prompts string[] Array of generated prompt variants
error string Error message if generation failed
tokensUsed TokenUsage Token consumption statistics

Usage Examples

import { generatePrompts } from './suggestions';

const result = await generatePrompts('Summarize the following text: {{text}}', 1);

if (result.prompts) {
  console.log('Suggested variant:', result.prompts[0]);
}
console.log('Tokens used:', result.tokensUsed);

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment