Implementation:Promptfoo Promptfoo Update Checker
| Knowledge Sources | |
|---|---|
| Domains | CLI, Version_Management |
| Last Updated | 2026-02-14 07:45 GMT |
Overview
Concrete tool for checking whether newer versions of promptfoo (npm) and modelaudit (PyPI) are available, and displaying update notifications.
Description
The Update_Checker module (updates.ts) provides functions to check for software updates. checkForUpdates() queries the promptfoo API for the latest npm version and compares it with the current VERSION using semver. checkModelAuditUpdates() checks PyPI for the latest modelaudit version and compares it with the locally installed version. Both functions display formatted terminal notifications when updates are available and can be disabled via PROMPTFOO_DISABLE_UPDATE.
Usage
Called during CLI startup to notify users of available updates. The check is non-blocking and failures are silently ignored.
Code Reference
Source Location
- Repository: Promptfoo_Promptfoo
- File: src/updates.ts
- Lines: 1-115
Signature
export async function getLatestVersion(): Promise<string>
export async function checkForUpdates(): Promise<boolean>
export async function getModelAuditLatestVersion(): Promise<string | null>
export async function getModelAuditCurrentVersion(): Promise<string | null>
export async function checkModelAuditUpdates(): Promise<boolean>
Import
import { checkForUpdates, checkModelAuditUpdates } from './updates';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | Queries external APIs for version info |
Outputs
| Name | Type | Description |
|---|---|---|
| updated | boolean | true if a newer version was found and notification shown |
Usage Examples
import { checkForUpdates, checkModelAuditUpdates } from './updates';
// Check for promptfoo updates at CLI startup
const hasUpdate = await checkForUpdates();
if (hasUpdate) {
// Notification already printed to terminal
}
// Check for modelaudit updates
await checkModelAuditUpdates();