Promptfoo

Promptfoo is a CLI and library for evaluating prompts, models, agents and retrieval applications

Texte original de la source · EN
Visiter le site

Voir en action

Interface du produit

Promptfoo: compare outputs and assertion failures side by side

Original documentation viewer image with twelve demonstration cases, Model A columns, outputs and assertion explanations. Passing percentages, token/latency figures and the 2025 eval ID belong to the author demo; they are not current-model rankings, real provider benchmarks or results of the separate recipes below.

Promptfoo: compare outputs and assertion failures side by side
Voir l’image entière
Licence

Full original license retained. Author interface previews, usage recipes and illustrative/expected output remain distinct from independently reproduced results. No source instructions, scripts, installations, models, API requests, accounts, memory writes, schedules, mail or browser tasks were executed. Native-resolution source image converted to lossless WebP with complete decoded RGBA equality; no crop, retouch, upscaling or replacement of source labels.

Copyright (c) Promptfoo 2025

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Interface du produit

Promptfoo: inspect pass rates and score distributions

Original documentation chart illustration for pass rate, score distribution and pairwise prompt scores. These figures explain viewer controls, not a measured benchmark or evidence that one named model is better. The complete source image is retained, with no invented underlying dataset.

Promptfoo: inspect pass rates and score distributions
Voir l’image entière
Licence

Full original license retained. Author interface previews, usage recipes and illustrative/expected output remain distinct from independently reproduced results. No source instructions, scripts, installations, models, API requests, accounts, memory writes, schedules, mail or browser tasks were executed. Native-resolution source image converted to lossless WebP with complete decoded RGBA equality; no crop, retouch, upscaling or replacement of source labels.

Copyright (c) Promptfoo 2025

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Exemple d’utilisation

Promptfoo: complete structured-output evaluation config

Complete author YAML for two math cases and alternative JSON response schemas. Keep only providers you can access, configure their keys and replace Azure host/deployment placeholders. Model names, API version and schema options are source configuration requiring current provider support; expected assertions are not passing test results. No evaluation was run.

Exemple d’entrée

# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
description: Multi-provider structured JSON outputs with schema validation

prompts:
  # Schema output with `steps` array
  - label: 'With step-by-step'
    raw: 'You are a helpful math tutor. Solve {{problem}}'
    config:
      response_format:
        type: json_schema
        json_schema:
          name: math_response
          strict: true
          schema:
            type: object
            properties:
              steps:
                type: array
                items:
                  type: object
                  properties:
                    explanation:
                      type: string
                    output:
                      type: string
                  required:
                    - explanation
                    - output
                  additionalProperties: false
              final_answer:
                type: string
            required:
              - steps
              - final_answer
            additionalProperties: false

  # Schema output without `steps` array
  - label: 'Without step-by-step'
    raw: 'You are a helpful math tutor. Solve {{problem}}'
    config:
      response_format:
        type: json_schema
        json_schema:
          name: math_response
          strict: true
          schema:
            type: object
            properties:
              final_answer:
                type: string
            required:
              - final_answer
            additionalProperties: false

providers:
  # OpenAI with structured outputs (response_format)
  - openai:chat:gpt-4o-mini

  # Azure OpenAI with structured outputs (response_format)
  - id: azure:chat:gpt-4o-2024-08-06
    config:
      apiHost: 'YOUR_ORG.openai.azure.com'
      apiVersion: '2024-08-01-preview'
      deploymentName: 'YOUR_DEPLOYMENT_NAME'

  # Anthropic with structured outputs (output_format) - with steps
  - id: anthropic:messages:claude-sonnet-5
    label: 'Anthropic (with steps)'
    config:
      max_tokens: 2048
      output_format:
        type: json_schema
        schema:
          type: object
          properties:
            steps:
              type: array
              items:
                type: object
                properties:
                  explanation:
                    type: string
                  output:
                    type: string
                required:
                  - explanation
                  - output
                additionalProperties: false
            final_answer:
              type: string
          required:
            - steps
            - final_answer
          additionalProperties: false

  # Anthropic with structured outputs (output_format) - without steps
  - id: anthropic:messages:claude-sonnet-5
    label: 'Anthropic (without steps)'
    config:
      max_tokens: 2048
      output_format:
        type: json_schema
        schema:
          type: object
          properties:
            final_answer:
              type: string
          required:
            - final_answer
          additionalProperties: false

defaultTest:
  assert:
    - type: is-json
    - type: javascript
      value: typeof output === 'object'

tests:
  - description: Solving for the number of dragons in a cave
    vars:
      problem: 'If a wizard has 8x dragons and finds 31 more in a cave, but only has room for 2 total, how many dragons must the wizard release? (8x + 31 = 2)'
    assert:
      - type: contains-any
        value:
          - -3.625
          - -29/8
          - '-3.625'
          - '-29/8'
  - description: Calculating the area of a perfectly square pizza
    vars:
      problem: 'A perfectly square pizza has a side length of sqrt(x) meters. If the side length is 4.9 meters, what is the area in square meters? (sqrt(x) = 4.9)'
    assert:
      - type: contains-any
        value:
          - 24.01
          - '24.01'
Licence

Full original license retained. Author interface previews, usage recipes and illustrative/expected output remain distinct from independently reproduced results. No source instructions, scripts, installations, models, API requests, accounts, memory writes, schedules, mail or browser tasks were executed. Complete source files/blocks retained. Only outer fences or documented indentation removed; multi-file recipes use editorial path labels and fences, with each separate binding in the review. Source versions/model aliases, template syntax and placeholders are unchanged.

Copyright (c) Promptfoo 2025

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Exemple d’utilisation

Promptfoo: evaluate separate multi-turn conversation threads

Complete paired YAML and prompt.json Nunjucks template. Save both files together, configure provider access and run in the matching Promptfoo setup. The .json file intentionally contains template loops, not standalone JSON. Conversation IDs separate the example threads; no model answers, factual accuracy or current provider compatibility were verified here.

Exemple d’entrée

examples/config-multi-turn/promptfooconfig.yaml

```yaml
# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
description: Multi-turn conversation evaluation and testing

prompts:
  - id: file://prompt.json
    label: multi-turn-conversation
providers:
  - openai:gpt-4.1-mini

# Set up the system message for all tests
defaultTest:
  vars:
    system_message: You are a helpful assistant

# Test out conversations with multiple turns
tests:
  # First conversation about Facebook
  - vars:
      question: Who founded Facebook?
    metadata:
      conversationId: facebook_thread
  - vars:
      question: Where does he live?
    metadata:
      conversationId: facebook_thread
  - vars:
      question: Which state is that in?
    metadata:
      conversationId: facebook_thread

  # Second conversation about weather (runs independently)
  - vars:
      question: What's the weather like in San Francisco?
    metadata:
      conversationId: weather_thread
  - vars:
      question: Do I need an umbrella today?
    metadata:
      conversationId: weather_thread

  # Third conversation about food (runs independently)
  - vars:
      question: Whats a good recipe for pasta?
    metadata:
      conversationId: food_thread
  - vars:
      question: How long should I cook it?
    metadata:
      conversationId: food_thread

```

examples/config-multi-turn/prompt.json

```text
[
  {
    "role": "system",
    "content": "{{ system_message }}"
  },
  {% for completion in _conversation %}
    {
      "role": "user",
      "content": "{{ completion.prompt[completion.prompt.length - 1].content }}"
    },
    {
      "role": "assistant",
      "content": "{{ completion.output }}"
    },
  {% endfor %}
  {
    "role": "user",
    "content": "{{ question }}"
  }
]

```
Licence

Full original license retained. Author interface previews, usage recipes and illustrative/expected output remain distinct from independently reproduced results. No source instructions, scripts, installations, models, API requests, accounts, memory writes, schedules, mail or browser tasks were executed. Complete source files/blocks retained. Only outer fences or documented indentation removed; multi-file recipes use editorial path labels and fences, with each separate binding in the review. Source versions/model aliases, template syntax and placeholders are unchanged.

Copyright (c) Promptfoo 2025

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
FONCTIONS INDIQUÉES PAR LA SOURCE

Ce que propose Promptfoo

  1. 01Compare prompts and model outputs
  2. 02Define repeatable evaluation cases
  3. 03Run red-team checks and CI workflows
Texte original de la source · EN
Ce qui le distingue

Ce qui le distingue

It organizes test cases and checks; meaningful results depend on the chosen datasets, assertions and providers. Evaluations using external APIs can send data to those providers.

Texte original de la source · EN
À qui il convient

À qui il convient

  • Developers evaluating AI applications
  • Teams maintaining repeatable model checks
Texte original de la source · EN
AVANT DE CHOISIR

Points à vérifier

  • Tester une vraie tâche et comparer le résultat à ses besoins.
  • Vérifier quelles données sont conservées, partagées ou utilisées pour l’entraînement.
  • Confirmer les tarifs, limites d’usage et conditions de résiliation sur le site officiel.
CAS D’USAGE

Tâches connexes

Dernière vérification

Lien officiel vérifié le 21 oct. 2026. Les fonctionnalités n’ont pas été testées indépendamment.

Tâches connexes

ProduitsPrixAccèsCAS D’USAGE
PromptfooNon vérifiéNon indiquéGénérer du code prêt pour la production · Automatiser un flux de travail
Arize PhoenixNon vérifiéAPIGénérer du code prêt pour la production · Automatiser un flux de travail
OpikNon vérifiéNon indiquéGénérer du code prêt pour la production · Automatiser un flux de travail
ArchonNon vérifiéWebGénérer du code prêt pour la production · Automatiser un flux de travail
Claude CodePayantWeb, Windows, macOS, Linux, iOS, Android, APIGénérer du code prêt pour la production · Automatiser un flux de travail