PromptFoo: An Open-Source Toolkit for Prompt Engineering

Gary Nakanelua
GTA: Generative Tech Advances
2 min readSep 20, 2023

--

Ensure high-quality LLM outputs with automatic evals.

Introduction

A recent blog, An Open-Source Framework for Prompt Engineering, post delves into the complexities and challenges of prompt engineering, particularly when integrating Language Learning Models (LLMs) into applications. The post introduces “promptfoo,” an open-source toolkit designed to make prompt engineering more systematic and efficient.

The Core Concept

Promptfoo is an open-source framework that aims to structure the often chaotic process of prompt engineering. It offers four types of grading systems — programmatic, semantic, LLM-based, and human-based — to evaluate the effectiveness of prompts. The toolkit provides a step-by-step guide for “engineering” a prompt, from defining test cases to analyzing results.

Why It Matters

The toolkit allows for a more structured, quantitative approach, helping optimize the prompts’ quality. This approach is particularly crucial for applications that rely heavily on LLMs, as it can significantly reduce the time and effort spent on trial-and-error methods.

Personal Experimentation

I gave promptfoo a go, opting to run it in Google Colab. Promptfoo supports a variety of LLM providers. For quick testing, I chose to test out prompts with OpenAI’s gpt-4–0613 and gpt-3.5-turbo-16k-0613 models.

After working out some Node versioning issues within Google Colab, promptfoo ran like a champ. You can grab my experimentation notebook from our GitHub here.

Screenshot of My Prompt Engineering Workflow with Promptfoo

For the Technically Curious

The original blog post from Ian Webster is quite detailed. You can check it out at https://www.ianww.com/blog/2023/05/21/prompt-engineering-framework.

For the Experimenters

Check out the promptfoo repo on GitHub for quick starts, examples, and more.

--

--

Gary Nakanelua
GTA: Generative Tech Advances

🚀MD of Innovation @ Blueprint - 🧬Open-Source Evangelist - 📘Author of Experiment or Expire - 🎸Bass player for Iris Drive - Co-host of Puget Sounds Podcast