Skip to content

Class: EvalwrightClient ​

The SDK's entry point.

Resolving never runs a model: it returns the version of a prompt deployed to your key's environment with its variables bound, and you run that text with your own provider.

Example ​

ts
const client = new EvalwrightClient({
  apiKey: process.env.EVALWRIGHT_API_KEY!,
  baseUrl: process.env.EVALWRIGHT_BASE_URL!,
});

// The prompt's id, from its page in the app.
const { prompt } = await client.prompts.resolve("6a1f0c3e9b2d4a7f8e5c1b90", {
  vars: { customerName: "Ada" },
});

Throws ​

If apiKey or baseUrl is missing, cache.ttlMs is negative or not a number, or timeoutMs is not a whole number of milliseconds from 1 to 2147483647.

Constructors ​

Constructor ​

ts
new EvalwrightClient(options): EvalwrightClient;

Parameters ​

options ​

EvalwrightClientOptions

Returns ​

EvalwrightClient

Properties ​

prompts ​

ts
readonly prompts: PromptsResource;

Prompt operations.

Methods ​

close() ​

ts
close(): void;

Closes the realtime stream, if one was opened. The cache keeps working on its TTL afterwards. Safe to call more than once.

Returns ​

void

Released under the MIT licence.