Cellv0.2.5
API Reference

Type Reference

Complete reference for all exported TypeScript types

Document types

InsuranceDocument

Discriminated union of PolicyDocument | QuoteDocument.

type InsuranceDocument = PolicyDocument | QuoteDocument;

BaseDocument

Shared fields for all insurance documents.

interface BaseDocument {
  id: string;
  type: "policy" | "quote";
  carrier: string;
  security?: string;
  insuredName: string;
  premium?: string;
  summary?: string;
  policyTypes?: string[];
  coverages: Coverage[];
  sections?: Section[];
}

PolicyDocument

interface PolicyDocument extends BaseDocument {
  type: "policy";
  policyNumber: string;
  effectiveDate: string;
  expirationDate: string;
}

QuoteDocument

interface QuoteDocument extends BaseDocument {
  type: "quote";
  quoteNumber: string;
  proposedEffectiveDate?: string;
  proposedExpirationDate?: string;
  quoteExpirationDate?: string;
  subjectivities?: Subjectivity[];
  underwritingConditions?: UnderwritingCondition[];
  premiumBreakdown?: PremiumLine[];
}

Coverage

interface Coverage {
  name: string;
  limit: string;
  deductible?: string;
  pageNumber?: number;
  sectionRef?: string;
}

Section

interface Section {
  title: string;
  sectionNumber?: string;
  pageStart: number;
  pageEnd?: number;
  type: string;
  coverageType?: string;
  content: string;
  subsections?: Subsection[];
}

Subsection

interface Subsection {
  title: string;
  sectionNumber?: string;
  pageNumber?: number;
  content: string;
}

Subjectivity

interface Subjectivity {
  description: string;
  category?: string;
}

UnderwritingCondition

interface UnderwritingCondition {
  description: string;
}

PremiumLine

interface PremiumLine {
  line: string;
  amount: string;
}

Platform types

Platform

type Platform = "email" | "chat" | "sms" | "slack" | "discord";

CommunicationIntent

type CommunicationIntent = "direct" | "mediated" | "observed";

PlatformConfig

interface PlatformConfig {
  supportsMarkdown: boolean;
  supportsLinks: boolean;
  supportsRichFormatting: boolean;
  maxResponseLength?: number;
  signOff?: boolean;
}

AgentContext

interface AgentContext {
  platform: Platform;
  intent: CommunicationIntent;
  platformConfig?: PlatformConfig;
  companyName?: string;
  companyContext?: string;
  siteUrl: string;
  userName?: string;
  coiHandling?: "broker" | "user" | "member" | "ignore";
  brokerName?: string;
  brokerContactName?: string;
  brokerContactEmail?: string;
}

PLATFORM_CONFIGS

const PLATFORM_CONFIGS: Record<Platform, PlatformConfig>;

Pre-configured platform settings. See Platforms & Intents.

Model types

ModelConfig

interface ModelConfig {
  classification: LanguageModel;   // Pass 0: document type classification
  metadata: LanguageModel;         // Pass 1: metadata extraction
  sections: LanguageModel;         // Pass 2: chunked section extraction
  sectionsFallback: LanguageModel; // Pass 2 fallback when sections truncate
  enrichment: LanguageModel;       // Pass 3: supplementary field enrichment
}

createUniformModelConfig(model)

Create a ModelConfig where every role uses the same model.

function createUniformModelConfig(model: LanguageModel): ModelConfig;

createDefaultModelConfig()

Create a ModelConfig using Anthropic defaults. Requires @ai-sdk/anthropic (lazy-imported).

function createDefaultModelConfig(): ModelConfig;

MODEL_TOKEN_LIMITS

const MODEL_TOKEN_LIMITS: {
  classification: 512;
  metadata: 4096;
  sections: 8192;
  sectionsFallback: 16384;
  enrichment: 4096;
};

Tool types

ToolDefinition

interface ToolDefinition {
  name: string;
  description: string;
  input_schema: {
    type: "object";
    properties: Record<string, unknown>;
    required?: string[];
  };
}

Extraction types

LogFn

type LogFn = (message: string) => Promise<void>;

PromptBuilder

type PromptBuilder = (pageStart: number, pageEnd: number) => string;

ExtractOptions

interface ExtractOptions {
  log?: LogFn;
  onMetadata?: (raw: string) => Promise<void>;
  models?: ModelConfig;
  metadataProviderOptions?: ProviderOptions;
  fallbackProviderOptions?: ProviderOptions;
}

ClassifyOptions

interface ClassifyOptions {
  log?: LogFn;
  models?: ModelConfig;
}

ExtractSectionsOptions

interface ExtractSectionsOptions {
  log?: LogFn;
  promptBuilder?: PromptBuilder;
  models?: ModelConfig;
  fallbackProviderOptions?: ProviderOptions;
}

PDF types

AcroFormFieldInfo

interface AcroFormFieldInfo {
  name: string;
  type: "text" | "checkbox" | "dropdown" | "radio";
  options?: string[];
}

FieldMapping

interface FieldMapping {
  acroFormName: string;
  value: string;
}

TextOverlay

interface TextOverlay {
  page: number;
  x: number;
  y: number;
  text: string;
  fontSize?: number;
  isCheckmark?: boolean;
}

On this page