MyBotBoxMyBotBox

@yarlisai/ai

Unified LLM port — OpenAI, Anthropic, Bedrock, Gemini, and 12 more provider adapters.

Unified LLM port — OpenAI, Anthropic, Bedrock, Gemini, and 12 more provider adapters.

Install

npm install @yarlisai/ai

Source: packages/ai · npm · CHANGELOG

Why

@yarlisai/ai follows the port/adapter contract: consumers depend on a port (SomeProvider interface) and instantiate an adapter at runtime. Swapping vendors is a single-line config change.

Usage

The package's README ships a complete quickstart. mybotbox-platform itself is the reference consumer — apps/sat/lib/ai/ (or a similarly-named module) shows how every callsite uses the port instead of a vendor SDK directly.

Copilot model lineup & tool contract

The @yarlisai/ai/copilot subpath exports the Copilot model picker lineup and the tool-call contract as pure data + zod schemas — no React, no app imports — so SDKs and external agents can validate against the same source of truth the platform uses:

import {
  COPILOT_MODELS, // full picker lineup (id, label, tier icon, provider)
  DEFAULT_COPILOT_MODEL, // current default model id
  normalizeCopilotModel, // maps retired aliases → current canonical ids
  ToolIds, // zod enum of every Copilot tool id
  ToolArgSchemas, // per-tool argument schemas
  ToolSSESchemas, // per-tool `tool_call` SSE event schemas
  ToolResultSchemas, // per-tool result schemas
  ToolRegistry, // consolidated { id, args, sse, result } per tool
} from '@yarlisai/ai/copilot'

// Validate an incoming tool_call SSE event end-to-end:
const event = ToolSSESchemas.run_workflow.parse(incoming)

// Normalize a persisted (possibly legacy) model id:
const model = normalizeCopilotModel('claude-4.5-sonnet') // → 'claude-sonnet-4-6'

These exports are also re-exported from the package root. The host app consumes them through thin shims (apps/sat/lib/copilot/{models,registry}.ts), keeping one importable contract for both internal and external consumers (prerequisite for ADR 0010).

See also