Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel
Michael 5b3fcfb728
chore: Add README for missing examples (#4404)
2 months ago
..
5b3fcfb728
chore: Add README for missing examples (#4404)
2 months ago
fc4a6bbc7d
docs(examples): update model references from gpt-4o-mini to gpt-4.1-mini (#4289)
2 months ago
21a04bc105
fix: show labels for custom provider (#875)
1 year ago
bf81260b44
Simplify API and add support for unified test suite definition (#14)
2 years ago
d4190dc0dd
fix: node library supports prompt files (#668)
1 year ago

README.md

You have to be logged in to leave a comment. Sign In

node-package (Node Package)

You can run this example with:

npx promptfoo@latest init --example node-package

This example demonstrates using promptfoo from a Node.js script.

Prerequisites

  • Node.js (version 18 or higher)
  • API keys for LLM providers set as environment variables:

You can set these in a .env file:

OPENAI_API_KEY=sk-your-key-here
ANTHROPIC_API_KEY=sk-ant-your-key-here

Running the Example

  1. Install dependencies:
npm install
  1. Execute the script:
node full-eval.js

Expected Results

The script will:

  • Run evaluations programmatically using the promptfoo Node.js API
  • Save results to output.json
  • Display evaluation metrics in the console
  • Allow you to view detailed results with promptfoo view
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...