@polarityinc/polarity
v0.3.2
Published
TypeScript/JavaScript SDK for Polarity — install alias for @polarityinc/polarity-keystone (same package, new name).
Readme
@polarityinc/polarity
TypeScript / JavaScript SDK for Polarity — agent evaluation, sandboxed execution, and LLM observability.
This is the canonical install name. It's a thin alias that re-exports
the API surface from @polarityinc/polarity-keystone. Both names refer
to the same package; use whichever feels right.
Install
npm install @polarityinc/polarity
# or: bun add @polarityinc/polarityQuickstart
import { Polarity, traced } from '@polarityinc/polarity';
import OpenAI from 'openai';
const plr = new Polarity();
const client = plr.wrap(new OpenAI());
const run = traced('workflow', async (prompt: string) => {
return client.chat.completions.create({
model: 'gpt-4o-mini',
messages: [{ role: 'user', content: prompt }],
});
});
await run('hello world');Traces appear at https://app.polarity.so.
Configuration
| Env var | Purpose |
| --- | --- |
| POLARITY_API_KEY | Required. Get one at https://app.polarity.so |
| POLARITY_BASE_URL | Optional. Defaults to https://api.plr.sh |
Legacy KEYSTONE_* env vars continue to work indefinitely.
More
Full docs at https://docs.polarity.so.
