Pezzo Client - Node.js
The Pezzo client is an NPM package that allows you to easily integrate your application with Pezzo. The client was built with TypeScript and is type-safe.
Getting Started
Intall the Pezzo Client
Install the @pezzo/client NPM package:
npm i @pezzo/client
Initialize the Pezzo Client
You only need to initialize the Pezzo client once, and then you can use it throughout your application.
Configure via environment variables
Configure manually
Pezzo automatically looks for the following environment variables:
PEZZO_API_KEY
: Your Pezzo API keyPEZZO_PROJECT_ID
: Your Pezzo project IDPEZZO_ENVIRONMENT
: The environment you want to use (e.g.Production
, which is the default environment created by Pezzo)
Variables found will be used automatically for configuration.
import { Pezzo, PezzoOpenAI } from "@pezzo/client";
// Initialize the Pezzo client and export it
export const pezzo = new Pezzo();
// Initialize PezzoOpenAI and export it
export const openai = new PezzoOpenAI(pezzo);
API Reference
Pezzo.constructor(options: PezzoOptions)
Function
options
PezzoOptions
apiKey
string
default: "process.env.PEZZO_API_KEY"requiredPezzo API key
projectId
string
default: "process.env.PEZZO_PROJECT_ID"requiredPezzo project ID
environment
string
default: "process.env.PEZZO_ENVIRONMENT"requiredPezzo environment name
serverUrl
string
default: "https://api.pezzo.ai"requiredPezzo server URL
Pezzo.getPrompt(promptName: string)
Function
promptName
string
The name of the prompt to retrieve. The prompt must be deployed to the current environment specified when initializing the Pezzo client.