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 c514791528
chore(deps): update all example dependencies to latest versions (#4900)
1 month ago
..
c514791528
chore(deps): update all example dependencies to latest versions (#4900)
1 month ago
5b3fcfb728
chore: Add README for missing examples (#4404)
2 months ago
841a40dcda
feat(providers): add transformRequest to HTTP provider. Rename responseParser to transformResponse (#2228)
8 months ago

README.md

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

websockets (Websockets Provider Example)

You can run this example with:

npx promptfoo@latest init --example websockets

This example shows how to connect promptfoo to a WebSocket-based LLM service.

Prerequisites

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

Quick Start

  1. Start the test server (simulates a WebSocket LLM service):
cd test-server
npm install
node server.js
  1. In a new terminal, run the evaluation:
promptfoo eval

Expected Results

This example will:

  • Start a mock WebSocket server that simulates an LLM service
  • Connect promptfoo to the WebSocket server using the custom provider
  • Run evaluations through the WebSocket connection
  • Demonstrate how to integrate promptfoo with custom WebSocket-based APIs
  • Save results that can be viewed with promptfoo view
Tip!

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

Comments

Loading...