@claritylabs/cl-sdk 0.15.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2,6 +2,20 @@ import * as zod from 'zod';
2
2
  import { ZodSchema, ZodTypeAny, z } from 'zod';
3
3
  import { PDFDocument } from 'pdf-lib';
4
4
 
5
+ /**
6
+ * PDF input format that supports multiple delivery methods.
7
+ * This allows consumers to use memory-efficient file APIs (OpenAI Files API,
8
+ * Anthropic document blocks) instead of base64 encoding when desired.
9
+ *
10
+ * - `string` — base64-encoded PDF (backward compatible, default)
11
+ * - `URL` — file:// or https:// URL to the PDF
12
+ * - `Uint8Array` — raw PDF bytes
13
+ * - `{ fileId: string }` — provider-specific file reference (e.g., OpenAI file_id)
14
+ */
15
+ type PdfInput = string | URL | Uint8Array | {
16
+ fileId: string;
17
+ mimeType?: string;
18
+ };
5
19
  /** Callback to generate text from a prompt. Provider-agnostic. */
6
20
  type GenerateText = (params: {
7
21
  prompt: string;
@@ -17,12 +31,18 @@ type GenerateText = (params: {
17
31
  *
18
32
  * The extraction and query pipelines may pass document content via `providerOptions`:
19
33
  * - `providerOptions.pdfBase64` — base64-encoded PDF to include as document context
34
+ * - `providerOptions.pdfUrl` — `URL` object (file:// or https://) for file-based APIs
35
+ * - `providerOptions.pdfBytes` — `Uint8Array` of raw PDF bytes
36
+ * - `providerOptions.fileId` — provider-specific file reference (e.g., OpenAI file_id)
20
37
  * - `providerOptions.images` — `Array<{ imageBase64: string; mimeType: string }>` page images
21
38
  * - `providerOptions.attachments` — generic multimodal attachments such as
22
39
  * `Array<{ kind: "image" | "pdf" | "text"; name?: string; mimeType?: string; base64?: string; text?: string; description?: string }>`
23
40
  *
24
41
  * Your callback should check for these fields and include them as multi-part
25
42
  * message content (e.g. file/image parts) when calling your AI provider.
43
+ *
44
+ * For memory-efficient file handling, check `providerOptions.fileId` or `providerOptions.pdfUrl`
45
+ * first before falling back to `pdfBase64`. This allows you to use native Files APIs when available.
26
46
  */
27
47
  type GenerateObject<T = unknown> = (params: {
28
48
  prompt: string;
@@ -28442,7 +28462,7 @@ interface ExtractOptions {
28442
28462
  resumeFrom?: PipelineCheckpoint<ExtractionState>;
28443
28463
  }
28444
28464
  declare function createExtractor(config: ExtractorConfig): {
28445
- extract: (pdfBase64: string, documentId?: string, options?: ExtractOptions) => Promise<ExtractionResult>;
28465
+ extract: (pdfInput: PdfInput, documentId?: string, options?: ExtractOptions) => Promise<ExtractionResult>;
28446
28466
  };
28447
28467
 
28448
28468
  /**
@@ -28451,20 +28471,55 @@ declare function createExtractor(config: ExtractorConfig): {
28451
28471
  */
28452
28472
  declare function chunkDocument(doc: InsuranceDocument): DocumentChunk[];
28453
28473
 
28474
+ /**
28475
+ * Normalize PdfInput to Uint8Array bytes.
28476
+ * For fileId references or remote URLs, this will throw an error since
28477
+ * those should be handled by the provider callback directly.
28478
+ */
28479
+ declare function pdfInputToBytes(input: PdfInput): Promise<Uint8Array>;
28480
+ /**
28481
+ * Convert PdfInput to base64 string.
28482
+ * Note: This may negate memory benefits of fileId/URL inputs.
28483
+ * Prefer using pdfInputToBytes when possible.
28484
+ */
28485
+ declare function pdfInputToBase64(input: PdfInput): Promise<string>;
28486
+ /**
28487
+ * Check if the PdfInput is a file reference that can be passed directly
28488
+ * to provider APIs (fileId or URL) without base64 conversion.
28489
+ */
28490
+ declare function isFileReference(input: PdfInput): boolean;
28491
+ /**
28492
+ * Get a file identifier from PdfInput if available.
28493
+ * Returns undefined for base64/bytes that need to be passed as data.
28494
+ */
28495
+ declare function getFileIdentifier(input: PdfInput): {
28496
+ fileId?: string;
28497
+ url?: string;
28498
+ } | undefined;
28499
+ /**
28500
+ * Get the page count of a PDF from any PdfInput type.
28501
+ */
28502
+ declare function getPdfPageCount(input: PdfInput): Promise<number>;
28454
28503
  /**
28455
28504
  * Extract a page range from a PDF and return as base64.
28456
28505
  * Used to reduce API token usage by only sending relevant pages.
28457
28506
  *
28458
- * @param pdfBase64 - Full PDF as base64 string.
28507
+ * @param input - PDF as PdfInput (base64 string, URL, bytes, or fileId).
28459
28508
  * @param startPage - First page to include (1-indexed).
28460
28509
  * @param endPage - Last page to include (1-indexed, clamped to total pages).
28461
- * @returns Base64 string of the trimmed PDF, or original if range covers all pages.
28510
+ * @returns Base64 string of the trimmed PDF, or original base64 if range covers all pages.
28511
+ * @throws Error if input is a fileId reference or non-file URL (cannot extract pages from remote reference).
28462
28512
  */
28463
- declare function extractPageRange(pdfBase64: string, startPage: number, endPage: number): Promise<string>;
28513
+ declare function extractPageRange(input: PdfInput, startPage: number, endPage: number): Promise<string>;
28464
28514
  /**
28465
- * Get the page count of a PDF without fully parsing it.
28515
+ * Build provider options for passing PDF content to generateObject callbacks.
28516
+ * This chooses the most efficient representation based on the input type.
28517
+ *
28518
+ * @param input - The PdfInput to pass to the provider.
28519
+ * @param existingOptions - Existing providerOptions to merge with.
28520
+ * @returns Provider options with appropriate pdf* fields set.
28466
28521
  */
28467
- declare function getPdfPageCount(pdfBase64: string): Promise<number>;
28522
+ declare function buildPdfProviderOptions(input: PdfInput, existingOptions?: Record<string, unknown>): Promise<Record<string, unknown>>;
28468
28523
  interface AcroFormFieldInfo {
28469
28524
  name: string;
28470
28525
  type: "text" | "checkbox" | "dropdown" | "radio";
@@ -29738,16 +29793,16 @@ declare const QueryAttachmentSchema: z.ZodObject<{
29738
29793
  description?: string | undefined;
29739
29794
  id?: string | undefined;
29740
29795
  base64?: string | undefined;
29741
- text?: string | undefined;
29742
29796
  mimeType?: string | undefined;
29797
+ text?: string | undefined;
29743
29798
  }, {
29744
29799
  kind: "text" | "image" | "pdf";
29745
29800
  name?: string | undefined;
29746
29801
  description?: string | undefined;
29747
29802
  id?: string | undefined;
29748
29803
  base64?: string | undefined;
29749
- text?: string | undefined;
29750
29804
  mimeType?: string | undefined;
29805
+ text?: string | undefined;
29751
29806
  }>;
29752
29807
  type QueryAttachment = z.infer<typeof QueryAttachmentSchema>;
29753
29808
  declare const SubQuestionSchema: z.ZodObject<{
@@ -30306,4 +30361,4 @@ interface DocumentTemplate {
30306
30361
  }
30307
30362
  declare function getTemplate(policyType: string): DocumentTemplate;
30308
30363
 
30309
- export { ADMITTED_STATUSES, AGENT_TOOLS, APPLICATION_CLASSIFY_PROMPT, AUDIT_TYPES, type AcroFormFieldInfo, type AcroFormMapping, AcroFormMappingSchema, type Address, AddressSchema, type AdmittedStatus, AdmittedStatusSchema, type AgentContext, type AnswerParsingResult, AnswerParsingResultSchema, type ApplicationClassifyResult, ApplicationClassifyResultSchema, ApplicationEmailReviewSchema, type ApplicationField, ApplicationFieldSchema, type ApplicationListFilters, type ApplicationPipelineConfig, ApplicationQualityArtifactSchema, ApplicationQualityIssueSchema, ApplicationQualityReportSchema, ApplicationQualityRoundSchema, type ApplicationState, ApplicationStateSchema, type ApplicationStore, type AttachmentInterpretation, AttachmentInterpretationSchema, type AuditType, AuditTypeSchema, type AutoFillMatch, AutoFillMatchSchema, type AutoFillResult, AutoFillResultSchema, type AuxiliaryFact, AuxiliaryFactSchema, BOAT_TYPES, type BackfillProvider, type BindingAuthority, BindingAuthoritySchema, type BoatType, BoatTypeSchema, CHUNK_TYPES, CLAIM_STATUSES, COI_GENERATION_TOOL, CONDITION_TYPES, CONSTRUCTION_TYPES, CONTEXT_KEY_MAP, COVERAGE_COMPARISON_TOOL, COVERAGE_FORMS, COVERAGE_TRIGGERS, type ChunkFilter, type ChunkType, ChunkTypeSchema, type Citation, CitationSchema, type ClaimRecord, ClaimRecordSchema, type ClaimStatus, ClaimStatusSchema, type ClassificationCode, ClassificationCodeSchema, type CommercialAutoDeclarations, CommercialAutoDeclarationsSchema, type CommercialPropertyDeclarations, CommercialPropertyDeclarationsSchema, type CommunicationIntent, CommunicationIntentSchema, ConditionKeyValueSchema, type ConditionType, ConditionTypeSchema, type ConstructionType, ConstructionTypeSchema, type Contact, ContactSchema, type ContextKeyMapping, type ConversationTurn, type ConvertPdfToImagesFn, type Coverage, type CoverageForm, CoverageFormSchema, CoverageSchema, type CoverageTrigger, CoverageTriggerSchema, type CoverageValueType, CoverageValueTypeSchema, type CrimeDeclarations, CrimeDeclarationsSchema, type CyberDeclarations, CyberDeclarationsSchema, DEDUCTIBLE_TYPES, DEFENSE_COST_TREATMENTS, DOCUMENT_LOOKUP_TOOL, DOCUMENT_TYPES, type DODeclarations, DODeclarationsSchema, DWELLING_FIRE_FORM_TYPES, type Declarations, DeclarationsSchema, type DeductibleSchedule, DeductibleScheduleSchema, type DeductibleType, DeductibleTypeSchema, type DefenseCostTreatment, DefenseCostTreatmentSchema, type DocumentChunk, type DocumentFilters, type DocumentStore, type DocumentTemplate, type DocumentType, DocumentTypeSchema, type DriverRecord, DriverRecordSchema, type DwellingDetails, DwellingDetailsSchema, type DwellingFireDeclarations, DwellingFireDeclarationsSchema, type DwellingFireFormType, DwellingFireFormTypeSchema, ENDORSEMENT_PARTY_ROLES, ENDORSEMENT_TYPES, ENTITY_TYPES, type EarthquakeDeclarations, EarthquakeDeclarationsSchema, type EmbedText, type EmployersLiabilityLimits, EmployersLiabilityLimitsSchema, type Endorsement, type EndorsementParty, type EndorsementPartyRole, EndorsementPartyRoleSchema, EndorsementPartySchema, EndorsementSchema, type EndorsementType, EndorsementTypeSchema, type EnrichedCoverage, EnrichedCoverageSchema, type EnrichedSubjectivity, EnrichedSubjectivitySchema, type EnrichedUnderwritingCondition, EnrichedUnderwritingConditionSchema, type EntityType, EntityTypeSchema, type EvidenceItem, EvidenceItemSchema, type Exclusion, ExclusionSchema, type ExperienceMod, ExperienceModSchema, type ExtendedReportingPeriod, ExtendedReportingPeriodSchema, type ExtractOptions, type ExtractionResult, type ExtractionState, type ExtractorConfig, type ExtractorDef, FLOOD_ZONES, FOUNDATION_TYPES, type FarmRanchDeclarations, FarmRanchDeclarationsSchema, type FieldExtractionResult, FieldExtractionResultSchema, type FieldMapping, type FieldType, FieldTypeSchema, type FlatPdfPlacement, FlatPdfPlacementSchema, type FloodDeclarations, FloodDeclarationsSchema, type FloodZone, FloodZoneSchema, type FormReference, FormReferenceSchema, type FoundationType, FoundationTypeSchema, type GLDeclarations, GLDeclarationsSchema, type GenerateObject, type GenerateText, HOMEOWNERS_FORM_TYPES, type HomeownersDeclarations, HomeownersDeclarationsSchema, type HomeownersFormType, HomeownersFormTypeSchema, type IdentityTheftDeclarations, IdentityTheftDeclarationsSchema, type InsuranceDocument, InsuranceDocumentSchema, type InsuredLocation, InsuredLocationSchema, type InsuredVehicle, InsuredVehicleSchema, type InsurerInfo, InsurerInfoSchema, LIMIT_TYPES, LOSS_SETTLEMENTS, type LimitSchedule, LimitScheduleSchema, type LimitType, LimitTypeSchema, type LocationPremium, LocationPremiumSchema, type LogFn, type LookupFill, type LookupFillResult, LookupFillResultSchema, LookupFillSchema, type LookupRequest, LookupRequestSchema, type LossSettlement, LossSettlementSchema, type LossSummary, LossSummarySchema, type MemoryStore, type NamedInsured, NamedInsuredSchema, PERSONAL_AUTO_USAGES, PET_SPECIES, PLATFORM_CONFIGS, POLICY_SECTION_TYPES, POLICY_TERM_TYPES, POLICY_TYPES, type ParsedAnswer, ParsedAnswerSchema, type PaymentInstallment, PaymentInstallmentSchema, type PaymentPlan, PaymentPlanSchema, type PersonalArticlesDeclarations, PersonalArticlesDeclarationsSchema, type PersonalAutoDeclarations, PersonalAutoDeclarationsSchema, type PersonalAutoUsage, PersonalAutoUsageSchema, type PersonalUmbrellaDeclarations, PersonalUmbrellaDeclarationsSchema, type PersonalVehicleDetails, PersonalVehicleDetailsSchema, type PetDeclarations, PetDeclarationsSchema, type PetSpecies, PetSpeciesSchema, type PipelineCheckpoint, type PipelineContext, type PipelineContextOptions, type Platform, type PlatformConfig, PlatformSchema, type PolicyCondition, PolicyConditionSchema, type PolicyDocument, PolicyDocumentSchema, type PolicySectionType, PolicySectionTypeSchema, type PolicyTermType, PolicyTermTypeSchema, type PolicyType, PolicyTypeSchema, type PremiumLine, PremiumLineSchema, type PriorAnswer, type ProcessApplicationInput, type ProcessApplicationResult, type ProcessReplyInput, type ProcessReplyResult, type ProducerInfo, ProducerInfoSchema, type ProfessionalLiabilityDeclarations, ProfessionalLiabilityDeclarationsSchema, QUOTE_SECTION_TYPES, type QueryAttachment, type QueryAttachmentKind, QueryAttachmentKindSchema, QueryAttachmentSchema, type QueryClassifyResult, QueryClassifyResultSchema, type QueryConfig, type QueryInput, type QueryIntent, QueryIntentSchema, type QueryOutput, type QueryResult, QueryResultSchema, type QuestionBatchResult, QuestionBatchResultSchema, type QuoteDocument, QuoteDocumentSchema, type QuoteSectionType, QuoteSectionTypeSchema, RATING_BASIS_TYPES, ROOF_TYPES, type RVType, RVTypeSchema, RV_TYPES, type RatingBasis, RatingBasisSchema, type RatingBasisType, RatingBasisTypeSchema, type RecreationalVehicleDeclarations, RecreationalVehicleDeclarationsSchema, type ReplyIntent, ReplyIntentSchema, type RetrievalResult, RetrievalResultSchema, type RoofType, RoofTypeSchema, SCHEDULED_ITEM_CATEGORIES, SUBJECTIVITY_CATEGORIES, type SafeGenerateOptions, type SafeGenerateParams, type ScheduledItemCategory, ScheduledItemCategorySchema, type Section, SectionSchema, type SharedLimit, SharedLimitSchema, type SubAnswer, SubAnswerSchema, type SubQuestion, SubQuestionSchema, type Subjectivity, type SubjectivityCategory, SubjectivityCategorySchema, SubjectivitySchema, type Sublimit, SublimitSchema, type Subsection, SubsectionSchema, TITLE_POLICY_TYPES, type TaxFeeItem, TaxFeeItemSchema, type TextOverlay, type TitleDeclarations, TitleDeclarationsSchema, type TitlePolicyType, TitlePolicyTypeSchema, type TokenUsage, type ToolDefinition, type TravelDeclarations, TravelDeclarationsSchema, type UmbrellaExcessDeclarations, UmbrellaExcessDeclarationsSchema, type UnderwritingCondition, UnderwritingConditionSchema, VALUATION_METHODS, VEHICLE_COVERAGE_TYPES, type ValuationMethod, ValuationMethodSchema, type VehicleCoverage, VehicleCoverageSchema, type VehicleCoverageType, VehicleCoverageTypeSchema, type VerifyResult, VerifyResultSchema, type WatercraftDeclarations, WatercraftDeclarationsSchema, type WorkersCompDeclarations, WorkersCompDeclarationsSchema, buildAcroFormMappingPrompt, buildAgentSystemPrompt, buildAnswerParsingPrompt, buildAutoFillPrompt, buildBatchEmailGenerationPrompt, buildClassifyMessagePrompt, buildCoiRoutingPrompt, buildConfirmationSummaryPrompt, buildConversationMemoryGuidance, buildCoverageGapPrompt, buildFieldExplanationPrompt, buildFieldExtractionPrompt, buildFlatPdfMappingPrompt, buildFormattingPrompt, buildIdentityPrompt, buildIntentPrompt, buildInterpretAttachmentPrompt, buildLookupFillPrompt, buildQueryClassifyPrompt, buildQuestionBatchPrompt, buildQuotesPoliciesPrompt, buildReasonPrompt, buildReplyIntentClassificationPrompt, buildRespondPrompt, buildSafetyPrompt, buildVerifyPrompt, chunkDocument, createApplicationPipeline, createExtractor, createPipelineContext, createQueryAgent, extractPageRange, fillAcroForm, getAcroFormFields, getExtractor, getPdfPageCount, getTemplate, overlayTextOnPdf, pLimit, safeGenerateObject, sanitizeNulls, stripFences, toStrictSchema, withRetry };
30364
+ export { ADMITTED_STATUSES, AGENT_TOOLS, APPLICATION_CLASSIFY_PROMPT, AUDIT_TYPES, type AcroFormFieldInfo, type AcroFormMapping, AcroFormMappingSchema, type Address, AddressSchema, type AdmittedStatus, AdmittedStatusSchema, type AgentContext, type AnswerParsingResult, AnswerParsingResultSchema, type ApplicationClassifyResult, ApplicationClassifyResultSchema, ApplicationEmailReviewSchema, type ApplicationField, ApplicationFieldSchema, type ApplicationListFilters, type ApplicationPipelineConfig, ApplicationQualityArtifactSchema, ApplicationQualityIssueSchema, ApplicationQualityReportSchema, ApplicationQualityRoundSchema, type ApplicationState, ApplicationStateSchema, type ApplicationStore, type AttachmentInterpretation, AttachmentInterpretationSchema, type AuditType, AuditTypeSchema, type AutoFillMatch, AutoFillMatchSchema, type AutoFillResult, AutoFillResultSchema, type AuxiliaryFact, AuxiliaryFactSchema, BOAT_TYPES, type BackfillProvider, type BindingAuthority, BindingAuthoritySchema, type BoatType, BoatTypeSchema, CHUNK_TYPES, CLAIM_STATUSES, COI_GENERATION_TOOL, CONDITION_TYPES, CONSTRUCTION_TYPES, CONTEXT_KEY_MAP, COVERAGE_COMPARISON_TOOL, COVERAGE_FORMS, COVERAGE_TRIGGERS, type ChunkFilter, type ChunkType, ChunkTypeSchema, type Citation, CitationSchema, type ClaimRecord, ClaimRecordSchema, type ClaimStatus, ClaimStatusSchema, type ClassificationCode, ClassificationCodeSchema, type CommercialAutoDeclarations, CommercialAutoDeclarationsSchema, type CommercialPropertyDeclarations, CommercialPropertyDeclarationsSchema, type CommunicationIntent, CommunicationIntentSchema, ConditionKeyValueSchema, type ConditionType, ConditionTypeSchema, type ConstructionType, ConstructionTypeSchema, type Contact, ContactSchema, type ContextKeyMapping, type ConversationTurn, type ConvertPdfToImagesFn, type Coverage, type CoverageForm, CoverageFormSchema, CoverageSchema, type CoverageTrigger, CoverageTriggerSchema, type CoverageValueType, CoverageValueTypeSchema, type CrimeDeclarations, CrimeDeclarationsSchema, type CyberDeclarations, CyberDeclarationsSchema, DEDUCTIBLE_TYPES, DEFENSE_COST_TREATMENTS, DOCUMENT_LOOKUP_TOOL, DOCUMENT_TYPES, type DODeclarations, DODeclarationsSchema, DWELLING_FIRE_FORM_TYPES, type Declarations, DeclarationsSchema, type DeductibleSchedule, DeductibleScheduleSchema, type DeductibleType, DeductibleTypeSchema, type DefenseCostTreatment, DefenseCostTreatmentSchema, type DocumentChunk, type DocumentFilters, type DocumentStore, type DocumentTemplate, type DocumentType, DocumentTypeSchema, type DriverRecord, DriverRecordSchema, type DwellingDetails, DwellingDetailsSchema, type DwellingFireDeclarations, DwellingFireDeclarationsSchema, type DwellingFireFormType, DwellingFireFormTypeSchema, ENDORSEMENT_PARTY_ROLES, ENDORSEMENT_TYPES, ENTITY_TYPES, type EarthquakeDeclarations, EarthquakeDeclarationsSchema, type EmbedText, type EmployersLiabilityLimits, EmployersLiabilityLimitsSchema, type Endorsement, type EndorsementParty, type EndorsementPartyRole, EndorsementPartyRoleSchema, EndorsementPartySchema, EndorsementSchema, type EndorsementType, EndorsementTypeSchema, type EnrichedCoverage, EnrichedCoverageSchema, type EnrichedSubjectivity, EnrichedSubjectivitySchema, type EnrichedUnderwritingCondition, EnrichedUnderwritingConditionSchema, type EntityType, EntityTypeSchema, type EvidenceItem, EvidenceItemSchema, type Exclusion, ExclusionSchema, type ExperienceMod, ExperienceModSchema, type ExtendedReportingPeriod, ExtendedReportingPeriodSchema, type ExtractOptions, type ExtractionResult, type ExtractionState, type ExtractorConfig, type ExtractorDef, FLOOD_ZONES, FOUNDATION_TYPES, type FarmRanchDeclarations, FarmRanchDeclarationsSchema, type FieldExtractionResult, FieldExtractionResultSchema, type FieldMapping, type FieldType, FieldTypeSchema, type FlatPdfPlacement, FlatPdfPlacementSchema, type FloodDeclarations, FloodDeclarationsSchema, type FloodZone, FloodZoneSchema, type FormReference, FormReferenceSchema, type FoundationType, FoundationTypeSchema, type GLDeclarations, GLDeclarationsSchema, type GenerateObject, type GenerateText, HOMEOWNERS_FORM_TYPES, type HomeownersDeclarations, HomeownersDeclarationsSchema, type HomeownersFormType, HomeownersFormTypeSchema, type IdentityTheftDeclarations, IdentityTheftDeclarationsSchema, type InsuranceDocument, InsuranceDocumentSchema, type InsuredLocation, InsuredLocationSchema, type InsuredVehicle, InsuredVehicleSchema, type InsurerInfo, InsurerInfoSchema, LIMIT_TYPES, LOSS_SETTLEMENTS, type LimitSchedule, LimitScheduleSchema, type LimitType, LimitTypeSchema, type LocationPremium, LocationPremiumSchema, type LogFn, type LookupFill, type LookupFillResult, LookupFillResultSchema, LookupFillSchema, type LookupRequest, LookupRequestSchema, type LossSettlement, LossSettlementSchema, type LossSummary, LossSummarySchema, type MemoryStore, type NamedInsured, NamedInsuredSchema, PERSONAL_AUTO_USAGES, PET_SPECIES, PLATFORM_CONFIGS, POLICY_SECTION_TYPES, POLICY_TERM_TYPES, POLICY_TYPES, type ParsedAnswer, ParsedAnswerSchema, type PaymentInstallment, PaymentInstallmentSchema, type PaymentPlan, PaymentPlanSchema, type PdfInput, type PersonalArticlesDeclarations, PersonalArticlesDeclarationsSchema, type PersonalAutoDeclarations, PersonalAutoDeclarationsSchema, type PersonalAutoUsage, PersonalAutoUsageSchema, type PersonalUmbrellaDeclarations, PersonalUmbrellaDeclarationsSchema, type PersonalVehicleDetails, PersonalVehicleDetailsSchema, type PetDeclarations, PetDeclarationsSchema, type PetSpecies, PetSpeciesSchema, type PipelineCheckpoint, type PipelineContext, type PipelineContextOptions, type Platform, type PlatformConfig, PlatformSchema, type PolicyCondition, PolicyConditionSchema, type PolicyDocument, PolicyDocumentSchema, type PolicySectionType, PolicySectionTypeSchema, type PolicyTermType, PolicyTermTypeSchema, type PolicyType, PolicyTypeSchema, type PremiumLine, PremiumLineSchema, type PriorAnswer, type ProcessApplicationInput, type ProcessApplicationResult, type ProcessReplyInput, type ProcessReplyResult, type ProducerInfo, ProducerInfoSchema, type ProfessionalLiabilityDeclarations, ProfessionalLiabilityDeclarationsSchema, QUOTE_SECTION_TYPES, type QueryAttachment, type QueryAttachmentKind, QueryAttachmentKindSchema, QueryAttachmentSchema, type QueryClassifyResult, QueryClassifyResultSchema, type QueryConfig, type QueryInput, type QueryIntent, QueryIntentSchema, type QueryOutput, type QueryResult, QueryResultSchema, type QuestionBatchResult, QuestionBatchResultSchema, type QuoteDocument, QuoteDocumentSchema, type QuoteSectionType, QuoteSectionTypeSchema, RATING_BASIS_TYPES, ROOF_TYPES, type RVType, RVTypeSchema, RV_TYPES, type RatingBasis, RatingBasisSchema, type RatingBasisType, RatingBasisTypeSchema, type RecreationalVehicleDeclarations, RecreationalVehicleDeclarationsSchema, type ReplyIntent, ReplyIntentSchema, type RetrievalResult, RetrievalResultSchema, type RoofType, RoofTypeSchema, SCHEDULED_ITEM_CATEGORIES, SUBJECTIVITY_CATEGORIES, type SafeGenerateOptions, type SafeGenerateParams, type ScheduledItemCategory, ScheduledItemCategorySchema, type Section, SectionSchema, type SharedLimit, SharedLimitSchema, type SubAnswer, SubAnswerSchema, type SubQuestion, SubQuestionSchema, type Subjectivity, type SubjectivityCategory, SubjectivityCategorySchema, SubjectivitySchema, type Sublimit, SublimitSchema, type Subsection, SubsectionSchema, TITLE_POLICY_TYPES, type TaxFeeItem, TaxFeeItemSchema, type TextOverlay, type TitleDeclarations, TitleDeclarationsSchema, type TitlePolicyType, TitlePolicyTypeSchema, type TokenUsage, type ToolDefinition, type TravelDeclarations, TravelDeclarationsSchema, type UmbrellaExcessDeclarations, UmbrellaExcessDeclarationsSchema, type UnderwritingCondition, UnderwritingConditionSchema, VALUATION_METHODS, VEHICLE_COVERAGE_TYPES, type ValuationMethod, ValuationMethodSchema, type VehicleCoverage, VehicleCoverageSchema, type VehicleCoverageType, VehicleCoverageTypeSchema, type VerifyResult, VerifyResultSchema, type WatercraftDeclarations, WatercraftDeclarationsSchema, type WorkersCompDeclarations, WorkersCompDeclarationsSchema, buildAcroFormMappingPrompt, buildAgentSystemPrompt, buildAnswerParsingPrompt, buildAutoFillPrompt, buildBatchEmailGenerationPrompt, buildClassifyMessagePrompt, buildCoiRoutingPrompt, buildConfirmationSummaryPrompt, buildConversationMemoryGuidance, buildCoverageGapPrompt, buildFieldExplanationPrompt, buildFieldExtractionPrompt, buildFlatPdfMappingPrompt, buildFormattingPrompt, buildIdentityPrompt, buildIntentPrompt, buildInterpretAttachmentPrompt, buildLookupFillPrompt, buildPdfProviderOptions, buildQueryClassifyPrompt, buildQuestionBatchPrompt, buildQuotesPoliciesPrompt, buildReasonPrompt, buildReplyIntentClassificationPrompt, buildRespondPrompt, buildSafetyPrompt, buildVerifyPrompt, chunkDocument, createApplicationPipeline, createExtractor, createPipelineContext, createQueryAgent, extractPageRange, fillAcroForm, getAcroFormFields, getExtractor, getFileIdentifier, getPdfPageCount, getTemplate, isFileReference, overlayTextOnPdf, pLimit, pdfInputToBase64, pdfInputToBytes, safeGenerateObject, sanitizeNulls, stripFences, toStrictSchema, withRetry };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,20 @@ import * as zod from 'zod';
2
2
  import { ZodSchema, ZodTypeAny, z } from 'zod';
3
3
  import { PDFDocument } from 'pdf-lib';
4
4
 
5
+ /**
6
+ * PDF input format that supports multiple delivery methods.
7
+ * This allows consumers to use memory-efficient file APIs (OpenAI Files API,
8
+ * Anthropic document blocks) instead of base64 encoding when desired.
9
+ *
10
+ * - `string` — base64-encoded PDF (backward compatible, default)
11
+ * - `URL` — file:// or https:// URL to the PDF
12
+ * - `Uint8Array` — raw PDF bytes
13
+ * - `{ fileId: string }` — provider-specific file reference (e.g., OpenAI file_id)
14
+ */
15
+ type PdfInput = string | URL | Uint8Array | {
16
+ fileId: string;
17
+ mimeType?: string;
18
+ };
5
19
  /** Callback to generate text from a prompt. Provider-agnostic. */
6
20
  type GenerateText = (params: {
7
21
  prompt: string;
@@ -17,12 +31,18 @@ type GenerateText = (params: {
17
31
  *
18
32
  * The extraction and query pipelines may pass document content via `providerOptions`:
19
33
  * - `providerOptions.pdfBase64` — base64-encoded PDF to include as document context
34
+ * - `providerOptions.pdfUrl` — `URL` object (file:// or https://) for file-based APIs
35
+ * - `providerOptions.pdfBytes` — `Uint8Array` of raw PDF bytes
36
+ * - `providerOptions.fileId` — provider-specific file reference (e.g., OpenAI file_id)
20
37
  * - `providerOptions.images` — `Array<{ imageBase64: string; mimeType: string }>` page images
21
38
  * - `providerOptions.attachments` — generic multimodal attachments such as
22
39
  * `Array<{ kind: "image" | "pdf" | "text"; name?: string; mimeType?: string; base64?: string; text?: string; description?: string }>`
23
40
  *
24
41
  * Your callback should check for these fields and include them as multi-part
25
42
  * message content (e.g. file/image parts) when calling your AI provider.
43
+ *
44
+ * For memory-efficient file handling, check `providerOptions.fileId` or `providerOptions.pdfUrl`
45
+ * first before falling back to `pdfBase64`. This allows you to use native Files APIs when available.
26
46
  */
27
47
  type GenerateObject<T = unknown> = (params: {
28
48
  prompt: string;
@@ -28442,7 +28462,7 @@ interface ExtractOptions {
28442
28462
  resumeFrom?: PipelineCheckpoint<ExtractionState>;
28443
28463
  }
28444
28464
  declare function createExtractor(config: ExtractorConfig): {
28445
- extract: (pdfBase64: string, documentId?: string, options?: ExtractOptions) => Promise<ExtractionResult>;
28465
+ extract: (pdfInput: PdfInput, documentId?: string, options?: ExtractOptions) => Promise<ExtractionResult>;
28446
28466
  };
28447
28467
 
28448
28468
  /**
@@ -28451,20 +28471,55 @@ declare function createExtractor(config: ExtractorConfig): {
28451
28471
  */
28452
28472
  declare function chunkDocument(doc: InsuranceDocument): DocumentChunk[];
28453
28473
 
28474
+ /**
28475
+ * Normalize PdfInput to Uint8Array bytes.
28476
+ * For fileId references or remote URLs, this will throw an error since
28477
+ * those should be handled by the provider callback directly.
28478
+ */
28479
+ declare function pdfInputToBytes(input: PdfInput): Promise<Uint8Array>;
28480
+ /**
28481
+ * Convert PdfInput to base64 string.
28482
+ * Note: This may negate memory benefits of fileId/URL inputs.
28483
+ * Prefer using pdfInputToBytes when possible.
28484
+ */
28485
+ declare function pdfInputToBase64(input: PdfInput): Promise<string>;
28486
+ /**
28487
+ * Check if the PdfInput is a file reference that can be passed directly
28488
+ * to provider APIs (fileId or URL) without base64 conversion.
28489
+ */
28490
+ declare function isFileReference(input: PdfInput): boolean;
28491
+ /**
28492
+ * Get a file identifier from PdfInput if available.
28493
+ * Returns undefined for base64/bytes that need to be passed as data.
28494
+ */
28495
+ declare function getFileIdentifier(input: PdfInput): {
28496
+ fileId?: string;
28497
+ url?: string;
28498
+ } | undefined;
28499
+ /**
28500
+ * Get the page count of a PDF from any PdfInput type.
28501
+ */
28502
+ declare function getPdfPageCount(input: PdfInput): Promise<number>;
28454
28503
  /**
28455
28504
  * Extract a page range from a PDF and return as base64.
28456
28505
  * Used to reduce API token usage by only sending relevant pages.
28457
28506
  *
28458
- * @param pdfBase64 - Full PDF as base64 string.
28507
+ * @param input - PDF as PdfInput (base64 string, URL, bytes, or fileId).
28459
28508
  * @param startPage - First page to include (1-indexed).
28460
28509
  * @param endPage - Last page to include (1-indexed, clamped to total pages).
28461
- * @returns Base64 string of the trimmed PDF, or original if range covers all pages.
28510
+ * @returns Base64 string of the trimmed PDF, or original base64 if range covers all pages.
28511
+ * @throws Error if input is a fileId reference or non-file URL (cannot extract pages from remote reference).
28462
28512
  */
28463
- declare function extractPageRange(pdfBase64: string, startPage: number, endPage: number): Promise<string>;
28513
+ declare function extractPageRange(input: PdfInput, startPage: number, endPage: number): Promise<string>;
28464
28514
  /**
28465
- * Get the page count of a PDF without fully parsing it.
28515
+ * Build provider options for passing PDF content to generateObject callbacks.
28516
+ * This chooses the most efficient representation based on the input type.
28517
+ *
28518
+ * @param input - The PdfInput to pass to the provider.
28519
+ * @param existingOptions - Existing providerOptions to merge with.
28520
+ * @returns Provider options with appropriate pdf* fields set.
28466
28521
  */
28467
- declare function getPdfPageCount(pdfBase64: string): Promise<number>;
28522
+ declare function buildPdfProviderOptions(input: PdfInput, existingOptions?: Record<string, unknown>): Promise<Record<string, unknown>>;
28468
28523
  interface AcroFormFieldInfo {
28469
28524
  name: string;
28470
28525
  type: "text" | "checkbox" | "dropdown" | "radio";
@@ -29738,16 +29793,16 @@ declare const QueryAttachmentSchema: z.ZodObject<{
29738
29793
  description?: string | undefined;
29739
29794
  id?: string | undefined;
29740
29795
  base64?: string | undefined;
29741
- text?: string | undefined;
29742
29796
  mimeType?: string | undefined;
29797
+ text?: string | undefined;
29743
29798
  }, {
29744
29799
  kind: "text" | "image" | "pdf";
29745
29800
  name?: string | undefined;
29746
29801
  description?: string | undefined;
29747
29802
  id?: string | undefined;
29748
29803
  base64?: string | undefined;
29749
- text?: string | undefined;
29750
29804
  mimeType?: string | undefined;
29805
+ text?: string | undefined;
29751
29806
  }>;
29752
29807
  type QueryAttachment = z.infer<typeof QueryAttachmentSchema>;
29753
29808
  declare const SubQuestionSchema: z.ZodObject<{
@@ -30306,4 +30361,4 @@ interface DocumentTemplate {
30306
30361
  }
30307
30362
  declare function getTemplate(policyType: string): DocumentTemplate;
30308
30363
 
30309
- export { ADMITTED_STATUSES, AGENT_TOOLS, APPLICATION_CLASSIFY_PROMPT, AUDIT_TYPES, type AcroFormFieldInfo, type AcroFormMapping, AcroFormMappingSchema, type Address, AddressSchema, type AdmittedStatus, AdmittedStatusSchema, type AgentContext, type AnswerParsingResult, AnswerParsingResultSchema, type ApplicationClassifyResult, ApplicationClassifyResultSchema, ApplicationEmailReviewSchema, type ApplicationField, ApplicationFieldSchema, type ApplicationListFilters, type ApplicationPipelineConfig, ApplicationQualityArtifactSchema, ApplicationQualityIssueSchema, ApplicationQualityReportSchema, ApplicationQualityRoundSchema, type ApplicationState, ApplicationStateSchema, type ApplicationStore, type AttachmentInterpretation, AttachmentInterpretationSchema, type AuditType, AuditTypeSchema, type AutoFillMatch, AutoFillMatchSchema, type AutoFillResult, AutoFillResultSchema, type AuxiliaryFact, AuxiliaryFactSchema, BOAT_TYPES, type BackfillProvider, type BindingAuthority, BindingAuthoritySchema, type BoatType, BoatTypeSchema, CHUNK_TYPES, CLAIM_STATUSES, COI_GENERATION_TOOL, CONDITION_TYPES, CONSTRUCTION_TYPES, CONTEXT_KEY_MAP, COVERAGE_COMPARISON_TOOL, COVERAGE_FORMS, COVERAGE_TRIGGERS, type ChunkFilter, type ChunkType, ChunkTypeSchema, type Citation, CitationSchema, type ClaimRecord, ClaimRecordSchema, type ClaimStatus, ClaimStatusSchema, type ClassificationCode, ClassificationCodeSchema, type CommercialAutoDeclarations, CommercialAutoDeclarationsSchema, type CommercialPropertyDeclarations, CommercialPropertyDeclarationsSchema, type CommunicationIntent, CommunicationIntentSchema, ConditionKeyValueSchema, type ConditionType, ConditionTypeSchema, type ConstructionType, ConstructionTypeSchema, type Contact, ContactSchema, type ContextKeyMapping, type ConversationTurn, type ConvertPdfToImagesFn, type Coverage, type CoverageForm, CoverageFormSchema, CoverageSchema, type CoverageTrigger, CoverageTriggerSchema, type CoverageValueType, CoverageValueTypeSchema, type CrimeDeclarations, CrimeDeclarationsSchema, type CyberDeclarations, CyberDeclarationsSchema, DEDUCTIBLE_TYPES, DEFENSE_COST_TREATMENTS, DOCUMENT_LOOKUP_TOOL, DOCUMENT_TYPES, type DODeclarations, DODeclarationsSchema, DWELLING_FIRE_FORM_TYPES, type Declarations, DeclarationsSchema, type DeductibleSchedule, DeductibleScheduleSchema, type DeductibleType, DeductibleTypeSchema, type DefenseCostTreatment, DefenseCostTreatmentSchema, type DocumentChunk, type DocumentFilters, type DocumentStore, type DocumentTemplate, type DocumentType, DocumentTypeSchema, type DriverRecord, DriverRecordSchema, type DwellingDetails, DwellingDetailsSchema, type DwellingFireDeclarations, DwellingFireDeclarationsSchema, type DwellingFireFormType, DwellingFireFormTypeSchema, ENDORSEMENT_PARTY_ROLES, ENDORSEMENT_TYPES, ENTITY_TYPES, type EarthquakeDeclarations, EarthquakeDeclarationsSchema, type EmbedText, type EmployersLiabilityLimits, EmployersLiabilityLimitsSchema, type Endorsement, type EndorsementParty, type EndorsementPartyRole, EndorsementPartyRoleSchema, EndorsementPartySchema, EndorsementSchema, type EndorsementType, EndorsementTypeSchema, type EnrichedCoverage, EnrichedCoverageSchema, type EnrichedSubjectivity, EnrichedSubjectivitySchema, type EnrichedUnderwritingCondition, EnrichedUnderwritingConditionSchema, type EntityType, EntityTypeSchema, type EvidenceItem, EvidenceItemSchema, type Exclusion, ExclusionSchema, type ExperienceMod, ExperienceModSchema, type ExtendedReportingPeriod, ExtendedReportingPeriodSchema, type ExtractOptions, type ExtractionResult, type ExtractionState, type ExtractorConfig, type ExtractorDef, FLOOD_ZONES, FOUNDATION_TYPES, type FarmRanchDeclarations, FarmRanchDeclarationsSchema, type FieldExtractionResult, FieldExtractionResultSchema, type FieldMapping, type FieldType, FieldTypeSchema, type FlatPdfPlacement, FlatPdfPlacementSchema, type FloodDeclarations, FloodDeclarationsSchema, type FloodZone, FloodZoneSchema, type FormReference, FormReferenceSchema, type FoundationType, FoundationTypeSchema, type GLDeclarations, GLDeclarationsSchema, type GenerateObject, type GenerateText, HOMEOWNERS_FORM_TYPES, type HomeownersDeclarations, HomeownersDeclarationsSchema, type HomeownersFormType, HomeownersFormTypeSchema, type IdentityTheftDeclarations, IdentityTheftDeclarationsSchema, type InsuranceDocument, InsuranceDocumentSchema, type InsuredLocation, InsuredLocationSchema, type InsuredVehicle, InsuredVehicleSchema, type InsurerInfo, InsurerInfoSchema, LIMIT_TYPES, LOSS_SETTLEMENTS, type LimitSchedule, LimitScheduleSchema, type LimitType, LimitTypeSchema, type LocationPremium, LocationPremiumSchema, type LogFn, type LookupFill, type LookupFillResult, LookupFillResultSchema, LookupFillSchema, type LookupRequest, LookupRequestSchema, type LossSettlement, LossSettlementSchema, type LossSummary, LossSummarySchema, type MemoryStore, type NamedInsured, NamedInsuredSchema, PERSONAL_AUTO_USAGES, PET_SPECIES, PLATFORM_CONFIGS, POLICY_SECTION_TYPES, POLICY_TERM_TYPES, POLICY_TYPES, type ParsedAnswer, ParsedAnswerSchema, type PaymentInstallment, PaymentInstallmentSchema, type PaymentPlan, PaymentPlanSchema, type PersonalArticlesDeclarations, PersonalArticlesDeclarationsSchema, type PersonalAutoDeclarations, PersonalAutoDeclarationsSchema, type PersonalAutoUsage, PersonalAutoUsageSchema, type PersonalUmbrellaDeclarations, PersonalUmbrellaDeclarationsSchema, type PersonalVehicleDetails, PersonalVehicleDetailsSchema, type PetDeclarations, PetDeclarationsSchema, type PetSpecies, PetSpeciesSchema, type PipelineCheckpoint, type PipelineContext, type PipelineContextOptions, type Platform, type PlatformConfig, PlatformSchema, type PolicyCondition, PolicyConditionSchema, type PolicyDocument, PolicyDocumentSchema, type PolicySectionType, PolicySectionTypeSchema, type PolicyTermType, PolicyTermTypeSchema, type PolicyType, PolicyTypeSchema, type PremiumLine, PremiumLineSchema, type PriorAnswer, type ProcessApplicationInput, type ProcessApplicationResult, type ProcessReplyInput, type ProcessReplyResult, type ProducerInfo, ProducerInfoSchema, type ProfessionalLiabilityDeclarations, ProfessionalLiabilityDeclarationsSchema, QUOTE_SECTION_TYPES, type QueryAttachment, type QueryAttachmentKind, QueryAttachmentKindSchema, QueryAttachmentSchema, type QueryClassifyResult, QueryClassifyResultSchema, type QueryConfig, type QueryInput, type QueryIntent, QueryIntentSchema, type QueryOutput, type QueryResult, QueryResultSchema, type QuestionBatchResult, QuestionBatchResultSchema, type QuoteDocument, QuoteDocumentSchema, type QuoteSectionType, QuoteSectionTypeSchema, RATING_BASIS_TYPES, ROOF_TYPES, type RVType, RVTypeSchema, RV_TYPES, type RatingBasis, RatingBasisSchema, type RatingBasisType, RatingBasisTypeSchema, type RecreationalVehicleDeclarations, RecreationalVehicleDeclarationsSchema, type ReplyIntent, ReplyIntentSchema, type RetrievalResult, RetrievalResultSchema, type RoofType, RoofTypeSchema, SCHEDULED_ITEM_CATEGORIES, SUBJECTIVITY_CATEGORIES, type SafeGenerateOptions, type SafeGenerateParams, type ScheduledItemCategory, ScheduledItemCategorySchema, type Section, SectionSchema, type SharedLimit, SharedLimitSchema, type SubAnswer, SubAnswerSchema, type SubQuestion, SubQuestionSchema, type Subjectivity, type SubjectivityCategory, SubjectivityCategorySchema, SubjectivitySchema, type Sublimit, SublimitSchema, type Subsection, SubsectionSchema, TITLE_POLICY_TYPES, type TaxFeeItem, TaxFeeItemSchema, type TextOverlay, type TitleDeclarations, TitleDeclarationsSchema, type TitlePolicyType, TitlePolicyTypeSchema, type TokenUsage, type ToolDefinition, type TravelDeclarations, TravelDeclarationsSchema, type UmbrellaExcessDeclarations, UmbrellaExcessDeclarationsSchema, type UnderwritingCondition, UnderwritingConditionSchema, VALUATION_METHODS, VEHICLE_COVERAGE_TYPES, type ValuationMethod, ValuationMethodSchema, type VehicleCoverage, VehicleCoverageSchema, type VehicleCoverageType, VehicleCoverageTypeSchema, type VerifyResult, VerifyResultSchema, type WatercraftDeclarations, WatercraftDeclarationsSchema, type WorkersCompDeclarations, WorkersCompDeclarationsSchema, buildAcroFormMappingPrompt, buildAgentSystemPrompt, buildAnswerParsingPrompt, buildAutoFillPrompt, buildBatchEmailGenerationPrompt, buildClassifyMessagePrompt, buildCoiRoutingPrompt, buildConfirmationSummaryPrompt, buildConversationMemoryGuidance, buildCoverageGapPrompt, buildFieldExplanationPrompt, buildFieldExtractionPrompt, buildFlatPdfMappingPrompt, buildFormattingPrompt, buildIdentityPrompt, buildIntentPrompt, buildInterpretAttachmentPrompt, buildLookupFillPrompt, buildQueryClassifyPrompt, buildQuestionBatchPrompt, buildQuotesPoliciesPrompt, buildReasonPrompt, buildReplyIntentClassificationPrompt, buildRespondPrompt, buildSafetyPrompt, buildVerifyPrompt, chunkDocument, createApplicationPipeline, createExtractor, createPipelineContext, createQueryAgent, extractPageRange, fillAcroForm, getAcroFormFields, getExtractor, getPdfPageCount, getTemplate, overlayTextOnPdf, pLimit, safeGenerateObject, sanitizeNulls, stripFences, toStrictSchema, withRetry };
30364
+ export { ADMITTED_STATUSES, AGENT_TOOLS, APPLICATION_CLASSIFY_PROMPT, AUDIT_TYPES, type AcroFormFieldInfo, type AcroFormMapping, AcroFormMappingSchema, type Address, AddressSchema, type AdmittedStatus, AdmittedStatusSchema, type AgentContext, type AnswerParsingResult, AnswerParsingResultSchema, type ApplicationClassifyResult, ApplicationClassifyResultSchema, ApplicationEmailReviewSchema, type ApplicationField, ApplicationFieldSchema, type ApplicationListFilters, type ApplicationPipelineConfig, ApplicationQualityArtifactSchema, ApplicationQualityIssueSchema, ApplicationQualityReportSchema, ApplicationQualityRoundSchema, type ApplicationState, ApplicationStateSchema, type ApplicationStore, type AttachmentInterpretation, AttachmentInterpretationSchema, type AuditType, AuditTypeSchema, type AutoFillMatch, AutoFillMatchSchema, type AutoFillResult, AutoFillResultSchema, type AuxiliaryFact, AuxiliaryFactSchema, BOAT_TYPES, type BackfillProvider, type BindingAuthority, BindingAuthoritySchema, type BoatType, BoatTypeSchema, CHUNK_TYPES, CLAIM_STATUSES, COI_GENERATION_TOOL, CONDITION_TYPES, CONSTRUCTION_TYPES, CONTEXT_KEY_MAP, COVERAGE_COMPARISON_TOOL, COVERAGE_FORMS, COVERAGE_TRIGGERS, type ChunkFilter, type ChunkType, ChunkTypeSchema, type Citation, CitationSchema, type ClaimRecord, ClaimRecordSchema, type ClaimStatus, ClaimStatusSchema, type ClassificationCode, ClassificationCodeSchema, type CommercialAutoDeclarations, CommercialAutoDeclarationsSchema, type CommercialPropertyDeclarations, CommercialPropertyDeclarationsSchema, type CommunicationIntent, CommunicationIntentSchema, ConditionKeyValueSchema, type ConditionType, ConditionTypeSchema, type ConstructionType, ConstructionTypeSchema, type Contact, ContactSchema, type ContextKeyMapping, type ConversationTurn, type ConvertPdfToImagesFn, type Coverage, type CoverageForm, CoverageFormSchema, CoverageSchema, type CoverageTrigger, CoverageTriggerSchema, type CoverageValueType, CoverageValueTypeSchema, type CrimeDeclarations, CrimeDeclarationsSchema, type CyberDeclarations, CyberDeclarationsSchema, DEDUCTIBLE_TYPES, DEFENSE_COST_TREATMENTS, DOCUMENT_LOOKUP_TOOL, DOCUMENT_TYPES, type DODeclarations, DODeclarationsSchema, DWELLING_FIRE_FORM_TYPES, type Declarations, DeclarationsSchema, type DeductibleSchedule, DeductibleScheduleSchema, type DeductibleType, DeductibleTypeSchema, type DefenseCostTreatment, DefenseCostTreatmentSchema, type DocumentChunk, type DocumentFilters, type DocumentStore, type DocumentTemplate, type DocumentType, DocumentTypeSchema, type DriverRecord, DriverRecordSchema, type DwellingDetails, DwellingDetailsSchema, type DwellingFireDeclarations, DwellingFireDeclarationsSchema, type DwellingFireFormType, DwellingFireFormTypeSchema, ENDORSEMENT_PARTY_ROLES, ENDORSEMENT_TYPES, ENTITY_TYPES, type EarthquakeDeclarations, EarthquakeDeclarationsSchema, type EmbedText, type EmployersLiabilityLimits, EmployersLiabilityLimitsSchema, type Endorsement, type EndorsementParty, type EndorsementPartyRole, EndorsementPartyRoleSchema, EndorsementPartySchema, EndorsementSchema, type EndorsementType, EndorsementTypeSchema, type EnrichedCoverage, EnrichedCoverageSchema, type EnrichedSubjectivity, EnrichedSubjectivitySchema, type EnrichedUnderwritingCondition, EnrichedUnderwritingConditionSchema, type EntityType, EntityTypeSchema, type EvidenceItem, EvidenceItemSchema, type Exclusion, ExclusionSchema, type ExperienceMod, ExperienceModSchema, type ExtendedReportingPeriod, ExtendedReportingPeriodSchema, type ExtractOptions, type ExtractionResult, type ExtractionState, type ExtractorConfig, type ExtractorDef, FLOOD_ZONES, FOUNDATION_TYPES, type FarmRanchDeclarations, FarmRanchDeclarationsSchema, type FieldExtractionResult, FieldExtractionResultSchema, type FieldMapping, type FieldType, FieldTypeSchema, type FlatPdfPlacement, FlatPdfPlacementSchema, type FloodDeclarations, FloodDeclarationsSchema, type FloodZone, FloodZoneSchema, type FormReference, FormReferenceSchema, type FoundationType, FoundationTypeSchema, type GLDeclarations, GLDeclarationsSchema, type GenerateObject, type GenerateText, HOMEOWNERS_FORM_TYPES, type HomeownersDeclarations, HomeownersDeclarationsSchema, type HomeownersFormType, HomeownersFormTypeSchema, type IdentityTheftDeclarations, IdentityTheftDeclarationsSchema, type InsuranceDocument, InsuranceDocumentSchema, type InsuredLocation, InsuredLocationSchema, type InsuredVehicle, InsuredVehicleSchema, type InsurerInfo, InsurerInfoSchema, LIMIT_TYPES, LOSS_SETTLEMENTS, type LimitSchedule, LimitScheduleSchema, type LimitType, LimitTypeSchema, type LocationPremium, LocationPremiumSchema, type LogFn, type LookupFill, type LookupFillResult, LookupFillResultSchema, LookupFillSchema, type LookupRequest, LookupRequestSchema, type LossSettlement, LossSettlementSchema, type LossSummary, LossSummarySchema, type MemoryStore, type NamedInsured, NamedInsuredSchema, PERSONAL_AUTO_USAGES, PET_SPECIES, PLATFORM_CONFIGS, POLICY_SECTION_TYPES, POLICY_TERM_TYPES, POLICY_TYPES, type ParsedAnswer, ParsedAnswerSchema, type PaymentInstallment, PaymentInstallmentSchema, type PaymentPlan, PaymentPlanSchema, type PdfInput, type PersonalArticlesDeclarations, PersonalArticlesDeclarationsSchema, type PersonalAutoDeclarations, PersonalAutoDeclarationsSchema, type PersonalAutoUsage, PersonalAutoUsageSchema, type PersonalUmbrellaDeclarations, PersonalUmbrellaDeclarationsSchema, type PersonalVehicleDetails, PersonalVehicleDetailsSchema, type PetDeclarations, PetDeclarationsSchema, type PetSpecies, PetSpeciesSchema, type PipelineCheckpoint, type PipelineContext, type PipelineContextOptions, type Platform, type PlatformConfig, PlatformSchema, type PolicyCondition, PolicyConditionSchema, type PolicyDocument, PolicyDocumentSchema, type PolicySectionType, PolicySectionTypeSchema, type PolicyTermType, PolicyTermTypeSchema, type PolicyType, PolicyTypeSchema, type PremiumLine, PremiumLineSchema, type PriorAnswer, type ProcessApplicationInput, type ProcessApplicationResult, type ProcessReplyInput, type ProcessReplyResult, type ProducerInfo, ProducerInfoSchema, type ProfessionalLiabilityDeclarations, ProfessionalLiabilityDeclarationsSchema, QUOTE_SECTION_TYPES, type QueryAttachment, type QueryAttachmentKind, QueryAttachmentKindSchema, QueryAttachmentSchema, type QueryClassifyResult, QueryClassifyResultSchema, type QueryConfig, type QueryInput, type QueryIntent, QueryIntentSchema, type QueryOutput, type QueryResult, QueryResultSchema, type QuestionBatchResult, QuestionBatchResultSchema, type QuoteDocument, QuoteDocumentSchema, type QuoteSectionType, QuoteSectionTypeSchema, RATING_BASIS_TYPES, ROOF_TYPES, type RVType, RVTypeSchema, RV_TYPES, type RatingBasis, RatingBasisSchema, type RatingBasisType, RatingBasisTypeSchema, type RecreationalVehicleDeclarations, RecreationalVehicleDeclarationsSchema, type ReplyIntent, ReplyIntentSchema, type RetrievalResult, RetrievalResultSchema, type RoofType, RoofTypeSchema, SCHEDULED_ITEM_CATEGORIES, SUBJECTIVITY_CATEGORIES, type SafeGenerateOptions, type SafeGenerateParams, type ScheduledItemCategory, ScheduledItemCategorySchema, type Section, SectionSchema, type SharedLimit, SharedLimitSchema, type SubAnswer, SubAnswerSchema, type SubQuestion, SubQuestionSchema, type Subjectivity, type SubjectivityCategory, SubjectivityCategorySchema, SubjectivitySchema, type Sublimit, SublimitSchema, type Subsection, SubsectionSchema, TITLE_POLICY_TYPES, type TaxFeeItem, TaxFeeItemSchema, type TextOverlay, type TitleDeclarations, TitleDeclarationsSchema, type TitlePolicyType, TitlePolicyTypeSchema, type TokenUsage, type ToolDefinition, type TravelDeclarations, TravelDeclarationsSchema, type UmbrellaExcessDeclarations, UmbrellaExcessDeclarationsSchema, type UnderwritingCondition, UnderwritingConditionSchema, VALUATION_METHODS, VEHICLE_COVERAGE_TYPES, type ValuationMethod, ValuationMethodSchema, type VehicleCoverage, VehicleCoverageSchema, type VehicleCoverageType, VehicleCoverageTypeSchema, type VerifyResult, VerifyResultSchema, type WatercraftDeclarations, WatercraftDeclarationsSchema, type WorkersCompDeclarations, WorkersCompDeclarationsSchema, buildAcroFormMappingPrompt, buildAgentSystemPrompt, buildAnswerParsingPrompt, buildAutoFillPrompt, buildBatchEmailGenerationPrompt, buildClassifyMessagePrompt, buildCoiRoutingPrompt, buildConfirmationSummaryPrompt, buildConversationMemoryGuidance, buildCoverageGapPrompt, buildFieldExplanationPrompt, buildFieldExtractionPrompt, buildFlatPdfMappingPrompt, buildFormattingPrompt, buildIdentityPrompt, buildIntentPrompt, buildInterpretAttachmentPrompt, buildLookupFillPrompt, buildPdfProviderOptions, buildQueryClassifyPrompt, buildQuestionBatchPrompt, buildQuotesPoliciesPrompt, buildReasonPrompt, buildReplyIntentClassificationPrompt, buildRespondPrompt, buildSafetyPrompt, buildVerifyPrompt, chunkDocument, createApplicationPipeline, createExtractor, createPipelineContext, createQueryAgent, extractPageRange, fillAcroForm, getAcroFormFields, getExtractor, getFileIdentifier, getPdfPageCount, getTemplate, isFileReference, overlayTextOnPdf, pLimit, pdfInputToBase64, pdfInputToBytes, safeGenerateObject, sanitizeNulls, stripFences, toStrictSchema, withRetry };