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
..
src
fc4a6bbc7d
docs(examples): update model references from gpt-4o-mini to gpt-4.1-mini (#4289)
2 months ago
5b3fcfb728
chore: Add README for missing examples (#4404)
2 months ago
2ac593c9cb
chore: Fix formatting and add style check to CI (#872)
1 year ago
de65862239
fix: Broken types (#854)
1 year ago
de65862239
fix: Broken types (#854)
1 year ago

README.md

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

node-package-typescript (Node Package TypeScript)

You can run this example with:

npx promptfoo@latest init --example node-package-typescript

This example demonstrates using promptfoo from a TypeScript script.

Prerequisites

  • Node.js (version 18 or higher)
  • TypeScript and ts-node (installed via npm dependencies)
  • 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:
npx ts-node src/full-eval.ts

Expected Results

The TypeScript script will:

  • Run evaluations with full type safety using the promptfoo API
  • Save results to output.json
  • Display evaluation metrics in the console
  • Demonstrate TypeScript integration patterns for promptfoo

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