Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

README.md 981 B

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...