This guide explains how to integrate Promptfoo with TrueFoundry to enhance the evaluation and testing of your LLM applications.

What is Promptfoo?

Promptfoo is an open-source tool for testing and evaluating LLM outputs. It helps developers systematically test prompts, compare model outputs, and ensure consistent performance across different scenarios.

Key Features of Promptfoo

  1. Comprehensive LLM Testing: Promptfoo provides systematic testing capabilities for LLM applications, allowing you to evaluate prompt performance, model accuracy, and output consistency across multiple test cases.
  2. Multi-Model Comparison: Compare outputs across different LLM models and providers to identify the best performing model for your specific use case. The platform supports side-by-side comparisons and automated scoring to help make data-driven decisions about model selection.
  3. Advanced Evaluation Metrics: Built-in evaluation metrics and custom scoring functions help organizations measure LLM performance objectively. Promptfoo provides comprehensive analytics and reporting to track model performance, accuracy trends, and quality metrics across your LLM evaluation pipeline.

Adding Promptfoo Integration

To add Promptfoo to your TrueFoundry setup, follow these steps: Fill in the Guardrails Group Form
  • Name: Enter a name for your guardrails group.
  • Collaborators: Add collaborators who will have access to this group.
  • Promptfoo Config:
    • Name: Enter a name for the Promptfoo configuration.
    • Guard Type: Select the type of guard from the available options:
      • Guard Check: General content safety validation
      • PII Redaction: Personally Identifiable Information detection and redaction
      • Harmful Detection: Detection of harmful, violent, or inappropriate content
TrueFoundry interface for configuring Promptfoo with fields for name and guard type selection

Fill in the Promptfoo Form

Response Structure

The Promptfoo API returns a response with the following structure:

Validation Logic

TrueFoundry uses the Promptfoo response to determine content safety and compliance:
  • If the data.flagged is true, the request will be blocked and a 400 error is returned.
  • If the data.result is "failed", the content violates the configured guardrails and will be rejected.
  • Category scores are evaluated against configured thresholds, with scores of 1 indicating policy violations.
  • Content moderation results are logged for monitoring and compliance reporting.