New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@tanstack/ai-typesafe

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/ai-typesafe

TypeSafe Jev adapter for TanStack AI — typed evaluate decisions over HTTP.

Source
npmnpm
Version
0.1.0
Version published
Maintainers
3
Created
Source
TanStack AI

NPM downloads GitHub stars

@tanstack/ai-typesafe

TypeSafe Jev adapter for TanStack AI. Call Jev with decide() and typed questions. This package talks HTTP with fetch. It does not add a TypeSafe SDK.

Install

pnpm add @tanstack/ai @tanstack/ai-typesafe

Setup

Get an API key from TypeSafe and set it as an environment variable:

export TYPESAFE_API_KEY="..."

Usage

import { boolean, choice, decide, score } from '@tanstack/ai'
import { typesafeDecider } from '@tanstack/ai-typesafe'

const result = await decide({
  adapter: typesafeDecider('jev-latest'),
  state: ticket,
  questions: {
    queue: choice({
      instructions: 'Which team should handle this ticket?',
      options: {
        billing: 'Payments, invoices, refunds',
        tech: 'Bugs, outages, integrations',
        sales: 'Pricing, upgrades, new accounts',
      },
    }),
    urgency: score({
      instructions: 'How urgent is this ticket?',
      levels: ['low', 'medium', 'high'],
    }),
    refund: boolean({
      instructions: 'Is the customer asking for a refund?',
    }),
  },
})

result.queue.value
result.meta.model
result.meta.usage

typesafeDecider(model) reads TYPESAFE_API_KEY from the environment. To pass a key yourself, use createTypesafeDecider(model, apiKey).

Supported models

  • jev-latest — current stable Jev alias
  • jev-1.13.0 — pinned Jev release

You can also pass other TypeSafe model ids as a string.

License

MIT

Keywords

ai

FAQs

Package last updated on 21 Sep 2026

Related posts