API Reference
Complete reference for all public exports from tsfm.
Classes
| Class | Description |
|---|---|
| SystemLanguageModel | On-device model access and availability |
| LanguageModelSession | Conversation session with all generation methods |
| GenerationSchema | Schema builder for structured output |
| Tool | Abstract base class for tool calling |
| Transcript | Session history export and import |
Types and Enums
| Export | Description |
|---|---|
| GenerationOptions | Options for temperature, tokens, sampling |
| SamplingMode | Greedy or random sampling strategies |
| GenerationGuide | Output constraints for schema properties |
| GeneratedContent | Structured generation result |
| Errors | Error hierarchy and error codes |
Chat & Responses APIs
| Export | Description |
|---|---|
| Client | Chat-style and Responses-style API client backed by on-device Apple Intelligence |
ts
import Client from "tsfm-sdk/chat";See the Chat & Responses API reference for full type documentation.
Installation
ts
import {
SystemLanguageModel,
LanguageModelSession,
GenerationSchema,
GenerationGuide,
Tool,
Transcript,
SamplingMode,
} from "tsfm-sdk";
// Chat API compatible interface
import Client from "tsfm-sdk/chat";