Reference@tailrace/ai-sdk
AI SDK
Reference for @tailrace/ai-sdk - wrap models and tools, fluent helpers, and streaming options.
@tailrace/ai-sdk integrates Tailrace with the Vercel AI SDK (ai@^5).
Install
pnpm add @tailrace/core @tailrace/ai-sdk aiPeer dependency: ai@^5.
Exports
| Export | Description |
|---|---|
withAiSdk | Attach fluent model / tools to a Tailrace instance |
wrapModel | Middleware wrapper for LanguageModelV2 |
wrapTools | Type-preserving wrapper for a ToolSet |
encodeModelProvider | Provider string encoding for policy keys |
AiSdkWrapOptions | Shared options type |
StreamBlockBehavior | Streaming output block modes |
Types: TailraceWithAiSdk, AiSdkWrapOptions, StreamBlockBehavior.
Default behavior
With createTailrace() and no custom policy:
- Secret-class entities → block
- Email, phone, credit card, IBAN, SSN → tokenize
- Model input block → throw before provider call
- Model output block (stream default) → throw after hold-back scan
See @tailrace/core default policy for the full table.