@claritylabs/cl-sdk 0.11.0 → 0.12.0
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/README.md +49 -1
- package/dist/index.d.mts +69 -11
- package/dist/index.d.ts +69 -11
- package/dist/index.js +199 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +195 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -6
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install @claritylabs/cl-sdk pdf-lib zod
|
|
|
13
13
|
## What It Does
|
|
14
14
|
|
|
15
15
|
- **Document Extraction** — Agentic pipeline with 11 focused extractors that turns insurance PDFs into structured data with page-level provenance, quality gates, and automatic declarations-to-schema promotion (limits, deductibles, locations, broker, loss payees, summary)
|
|
16
|
-
- **Query Agent** — Citation-backed question answering over stored documents with sub-question decomposition and grounding verification
|
|
16
|
+
- **Query Agent** — Citation-backed question answering over stored documents and inbound photos/PDFs/text with sub-question decomposition and grounding verification
|
|
17
17
|
- **Application Processing** — Eight focused agents handle intake — field extraction, auto-fill from prior answers, topic-based question batching, and PDF mapping
|
|
18
18
|
- **Agent System** — Composable prompt modules for building insurance-aware conversational agents across email, chat, SMS, Slack, and Discord
|
|
19
19
|
- **Storage** — DocumentStore and MemoryStore interfaces with SQLite reference implementation
|
|
@@ -43,6 +43,54 @@ console.log(result.reviewReport); // Quality gate results
|
|
|
43
43
|
|
|
44
44
|
See the [full documentation](https://cl-sdk.claritylabs.inc/docs) for architecture, provider setup, API reference, and more.
|
|
45
45
|
|
|
46
|
+
## Multimodal Querying
|
|
47
|
+
|
|
48
|
+
`createQueryAgent()` now accepts user-supplied attachments on each query. This is meant for flows like:
|
|
49
|
+
|
|
50
|
+
- an SMS user texting a photo of apartment damage
|
|
51
|
+
- a broker or insured emailing a COI or other PDF for context
|
|
52
|
+
- a caller pasting text from an email thread alongside a question
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { createQueryAgent } from "@claritylabs/cl-sdk";
|
|
56
|
+
|
|
57
|
+
const agent = createQueryAgent({
|
|
58
|
+
generateText,
|
|
59
|
+
generateObject,
|
|
60
|
+
documentStore,
|
|
61
|
+
memoryStore,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const result = await agent.query({
|
|
65
|
+
question: "What details do we still need, and does this relate to the stored policy?",
|
|
66
|
+
conversationId: "conv-123",
|
|
67
|
+
attachments: [
|
|
68
|
+
{
|
|
69
|
+
kind: "image",
|
|
70
|
+
name: "damage.jpg",
|
|
71
|
+
mimeType: "image/jpeg",
|
|
72
|
+
base64: damagePhotoBase64,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
kind: "pdf",
|
|
76
|
+
name: "coi.pdf",
|
|
77
|
+
mimeType: "application/pdf",
|
|
78
|
+
base64: coiPdfBase64,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The query pipeline first interprets each attachment into structured evidence, then combines that with retrieved chunks, document lookups, and conversation history before answering.
|
|
85
|
+
|
|
86
|
+
Important: your `generateObject` callback must actually forward multimodal payloads from `providerOptions` to the model request:
|
|
87
|
+
|
|
88
|
+
- `providerOptions.attachments` for generic image/pdf/text inputs
|
|
89
|
+
- `providerOptions.pdfBase64` for PDF inputs
|
|
90
|
+
- `providerOptions.images` for image inputs
|
|
91
|
+
|
|
92
|
+
If your callback ignores those fields, the model will only see the text prompt.
|
|
93
|
+
|
|
46
94
|
## Development
|
|
47
95
|
|
|
48
96
|
```bash
|
package/dist/index.d.mts
CHANGED
|
@@ -15,9 +15,11 @@ type GenerateText = (params: {
|
|
|
15
15
|
/**
|
|
16
16
|
* Callback to generate a typed object from a prompt + Zod schema. Provider-agnostic.
|
|
17
17
|
*
|
|
18
|
-
* The extraction
|
|
18
|
+
* The extraction and query pipelines may pass document content via `providerOptions`:
|
|
19
19
|
* - `providerOptions.pdfBase64` — base64-encoded PDF to include as document context
|
|
20
20
|
* - `providerOptions.images` — `Array<{ imageBase64: string; mimeType: string }>` page images
|
|
21
|
+
* - `providerOptions.attachments` — generic multimodal attachments such as
|
|
22
|
+
* `Array<{ kind: "image" | "pdf" | "text"; name?: string; mimeType?: string; base64?: string; text?: string; description?: string }>`
|
|
21
23
|
*
|
|
22
24
|
* Your callback should check for these fields and include them as multi-part
|
|
23
25
|
* message content (e.g. file/image parts) when calling your AI provider.
|
|
@@ -29591,6 +29593,34 @@ declare function buildLookupFillPrompt(requests: {
|
|
|
29591
29593
|
|
|
29592
29594
|
declare const QueryIntentSchema: z.ZodEnum<["policy_question", "coverage_comparison", "document_search", "claims_inquiry", "general_knowledge"]>;
|
|
29593
29595
|
type QueryIntent = z.infer<typeof QueryIntentSchema>;
|
|
29596
|
+
declare const QueryAttachmentKindSchema: z.ZodEnum<["image", "pdf", "text"]>;
|
|
29597
|
+
type QueryAttachmentKind = z.infer<typeof QueryAttachmentKindSchema>;
|
|
29598
|
+
declare const QueryAttachmentSchema: z.ZodObject<{
|
|
29599
|
+
id: z.ZodOptional<z.ZodString>;
|
|
29600
|
+
kind: z.ZodEnum<["image", "pdf", "text"]>;
|
|
29601
|
+
name: z.ZodOptional<z.ZodString>;
|
|
29602
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
29603
|
+
base64: z.ZodOptional<z.ZodString>;
|
|
29604
|
+
text: z.ZodOptional<z.ZodString>;
|
|
29605
|
+
description: z.ZodOptional<z.ZodString>;
|
|
29606
|
+
}, "strip", z.ZodTypeAny, {
|
|
29607
|
+
kind: "text" | "image" | "pdf";
|
|
29608
|
+
name?: string | undefined;
|
|
29609
|
+
description?: string | undefined;
|
|
29610
|
+
id?: string | undefined;
|
|
29611
|
+
base64?: string | undefined;
|
|
29612
|
+
text?: string | undefined;
|
|
29613
|
+
mimeType?: string | undefined;
|
|
29614
|
+
}, {
|
|
29615
|
+
kind: "text" | "image" | "pdf";
|
|
29616
|
+
name?: string | undefined;
|
|
29617
|
+
description?: string | undefined;
|
|
29618
|
+
id?: string | undefined;
|
|
29619
|
+
base64?: string | undefined;
|
|
29620
|
+
text?: string | undefined;
|
|
29621
|
+
mimeType?: string | undefined;
|
|
29622
|
+
}>;
|
|
29623
|
+
type QueryAttachment = z.infer<typeof QueryAttachmentSchema>;
|
|
29594
29624
|
declare const SubQuestionSchema: z.ZodObject<{
|
|
29595
29625
|
question: z.ZodString;
|
|
29596
29626
|
intent: z.ZodEnum<["policy_question", "coverage_comparison", "document_search", "claims_inquiry", "general_knowledge"]>;
|
|
@@ -29726,10 +29756,11 @@ declare const QueryClassifyResultSchema: z.ZodObject<{
|
|
|
29726
29756
|
}>;
|
|
29727
29757
|
type QueryClassifyResult = z.infer<typeof QueryClassifyResultSchema>;
|
|
29728
29758
|
declare const EvidenceItemSchema: z.ZodObject<{
|
|
29729
|
-
source: z.ZodEnum<["chunk", "document", "conversation"]>;
|
|
29759
|
+
source: z.ZodEnum<["chunk", "document", "conversation", "attachment"]>;
|
|
29730
29760
|
chunkId: z.ZodOptional<z.ZodString>;
|
|
29731
29761
|
documentId: z.ZodOptional<z.ZodString>;
|
|
29732
29762
|
turnId: z.ZodOptional<z.ZodString>;
|
|
29763
|
+
attachmentId: z.ZodOptional<z.ZodString>;
|
|
29733
29764
|
text: z.ZodString;
|
|
29734
29765
|
relevance: z.ZodNumber;
|
|
29735
29766
|
metadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -29744,35 +29775,55 @@ declare const EvidenceItemSchema: z.ZodObject<{
|
|
|
29744
29775
|
}>, "many">>;
|
|
29745
29776
|
}, "strip", z.ZodTypeAny, {
|
|
29746
29777
|
text: string;
|
|
29747
|
-
source: "document" | "chunk" | "conversation";
|
|
29778
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29748
29779
|
relevance: number;
|
|
29749
29780
|
chunkId?: string | undefined;
|
|
29750
29781
|
documentId?: string | undefined;
|
|
29751
29782
|
turnId?: string | undefined;
|
|
29783
|
+
attachmentId?: string | undefined;
|
|
29752
29784
|
metadata?: {
|
|
29753
29785
|
key: string;
|
|
29754
29786
|
value: string;
|
|
29755
29787
|
}[] | undefined;
|
|
29756
29788
|
}, {
|
|
29757
29789
|
text: string;
|
|
29758
|
-
source: "document" | "chunk" | "conversation";
|
|
29790
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29759
29791
|
relevance: number;
|
|
29760
29792
|
chunkId?: string | undefined;
|
|
29761
29793
|
documentId?: string | undefined;
|
|
29762
29794
|
turnId?: string | undefined;
|
|
29795
|
+
attachmentId?: string | undefined;
|
|
29763
29796
|
metadata?: {
|
|
29764
29797
|
key: string;
|
|
29765
29798
|
value: string;
|
|
29766
29799
|
}[] | undefined;
|
|
29767
29800
|
}>;
|
|
29768
29801
|
type EvidenceItem = z.infer<typeof EvidenceItemSchema>;
|
|
29802
|
+
declare const AttachmentInterpretationSchema: z.ZodObject<{
|
|
29803
|
+
summary: z.ZodString;
|
|
29804
|
+
extractedFacts: z.ZodArray<z.ZodString, "many">;
|
|
29805
|
+
recommendedFocus: z.ZodArray<z.ZodString, "many">;
|
|
29806
|
+
confidence: z.ZodNumber;
|
|
29807
|
+
}, "strip", z.ZodTypeAny, {
|
|
29808
|
+
summary: string;
|
|
29809
|
+
confidence: number;
|
|
29810
|
+
extractedFacts: string[];
|
|
29811
|
+
recommendedFocus: string[];
|
|
29812
|
+
}, {
|
|
29813
|
+
summary: string;
|
|
29814
|
+
confidence: number;
|
|
29815
|
+
extractedFacts: string[];
|
|
29816
|
+
recommendedFocus: string[];
|
|
29817
|
+
}>;
|
|
29818
|
+
type AttachmentInterpretation = z.infer<typeof AttachmentInterpretationSchema>;
|
|
29769
29819
|
declare const RetrievalResultSchema: z.ZodObject<{
|
|
29770
29820
|
subQuestion: z.ZodString;
|
|
29771
29821
|
evidence: z.ZodArray<z.ZodObject<{
|
|
29772
|
-
source: z.ZodEnum<["chunk", "document", "conversation"]>;
|
|
29822
|
+
source: z.ZodEnum<["chunk", "document", "conversation", "attachment"]>;
|
|
29773
29823
|
chunkId: z.ZodOptional<z.ZodString>;
|
|
29774
29824
|
documentId: z.ZodOptional<z.ZodString>;
|
|
29775
29825
|
turnId: z.ZodOptional<z.ZodString>;
|
|
29826
|
+
attachmentId: z.ZodOptional<z.ZodString>;
|
|
29776
29827
|
text: z.ZodString;
|
|
29777
29828
|
relevance: z.ZodNumber;
|
|
29778
29829
|
metadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -29787,22 +29838,24 @@ declare const RetrievalResultSchema: z.ZodObject<{
|
|
|
29787
29838
|
}>, "many">>;
|
|
29788
29839
|
}, "strip", z.ZodTypeAny, {
|
|
29789
29840
|
text: string;
|
|
29790
|
-
source: "document" | "chunk" | "conversation";
|
|
29841
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29791
29842
|
relevance: number;
|
|
29792
29843
|
chunkId?: string | undefined;
|
|
29793
29844
|
documentId?: string | undefined;
|
|
29794
29845
|
turnId?: string | undefined;
|
|
29846
|
+
attachmentId?: string | undefined;
|
|
29795
29847
|
metadata?: {
|
|
29796
29848
|
key: string;
|
|
29797
29849
|
value: string;
|
|
29798
29850
|
}[] | undefined;
|
|
29799
29851
|
}, {
|
|
29800
29852
|
text: string;
|
|
29801
|
-
source: "document" | "chunk" | "conversation";
|
|
29853
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29802
29854
|
relevance: number;
|
|
29803
29855
|
chunkId?: string | undefined;
|
|
29804
29856
|
documentId?: string | undefined;
|
|
29805
29857
|
turnId?: string | undefined;
|
|
29858
|
+
attachmentId?: string | undefined;
|
|
29806
29859
|
metadata?: {
|
|
29807
29860
|
key: string;
|
|
29808
29861
|
value: string;
|
|
@@ -29812,11 +29865,12 @@ declare const RetrievalResultSchema: z.ZodObject<{
|
|
|
29812
29865
|
subQuestion: string;
|
|
29813
29866
|
evidence: {
|
|
29814
29867
|
text: string;
|
|
29815
|
-
source: "document" | "chunk" | "conversation";
|
|
29868
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29816
29869
|
relevance: number;
|
|
29817
29870
|
chunkId?: string | undefined;
|
|
29818
29871
|
documentId?: string | undefined;
|
|
29819
29872
|
turnId?: string | undefined;
|
|
29873
|
+
attachmentId?: string | undefined;
|
|
29820
29874
|
metadata?: {
|
|
29821
29875
|
key: string;
|
|
29822
29876
|
value: string;
|
|
@@ -29826,11 +29880,12 @@ declare const RetrievalResultSchema: z.ZodObject<{
|
|
|
29826
29880
|
subQuestion: string;
|
|
29827
29881
|
evidence: {
|
|
29828
29882
|
text: string;
|
|
29829
|
-
source: "document" | "chunk" | "conversation";
|
|
29883
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29830
29884
|
relevance: number;
|
|
29831
29885
|
chunkId?: string | undefined;
|
|
29832
29886
|
documentId?: string | undefined;
|
|
29833
29887
|
turnId?: string | undefined;
|
|
29888
|
+
attachmentId?: string | undefined;
|
|
29834
29889
|
metadata?: {
|
|
29835
29890
|
key: string;
|
|
29836
29891
|
value: string;
|
|
@@ -30034,6 +30089,7 @@ interface QueryInput {
|
|
|
30034
30089
|
question: string;
|
|
30035
30090
|
conversationId?: string;
|
|
30036
30091
|
context?: AgentContext;
|
|
30092
|
+
attachments?: QueryAttachment[];
|
|
30037
30093
|
}
|
|
30038
30094
|
interface QueryOutput extends QueryResult {
|
|
30039
30095
|
tokenUsage: TokenUsage;
|
|
@@ -30048,7 +30104,9 @@ declare function createQueryAgent(config: QueryConfig): {
|
|
|
30048
30104
|
* Query classification prompt — determines intent and decomposes complex
|
|
30049
30105
|
* questions into atomic sub-questions for parallel retrieval + reasoning.
|
|
30050
30106
|
*/
|
|
30051
|
-
declare function buildQueryClassifyPrompt(question: string, conversationContext?: string): string;
|
|
30107
|
+
declare function buildQueryClassifyPrompt(question: string, conversationContext?: string, attachmentContext?: string): string;
|
|
30108
|
+
|
|
30109
|
+
declare function buildInterpretAttachmentPrompt(question: string, attachment: QueryAttachment): string;
|
|
30052
30110
|
|
|
30053
30111
|
/**
|
|
30054
30112
|
* Reasoning prompts — per-intent prompts that instruct the reasoner agent
|
|
@@ -30107,4 +30165,4 @@ interface DocumentTemplate {
|
|
|
30107
30165
|
}
|
|
30108
30166
|
declare function getTemplate(policyType: string): DocumentTemplate;
|
|
30109
30167
|
|
|
30110
|
-
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 AuditType, AuditTypeSchema, type AutoFillMatch, AutoFillMatchSchema, type AutoFillResult, AutoFillResultSchema, 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 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, 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 };
|
|
30168
|
+
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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,9 +15,11 @@ type GenerateText = (params: {
|
|
|
15
15
|
/**
|
|
16
16
|
* Callback to generate a typed object from a prompt + Zod schema. Provider-agnostic.
|
|
17
17
|
*
|
|
18
|
-
* The extraction
|
|
18
|
+
* The extraction and query pipelines may pass document content via `providerOptions`:
|
|
19
19
|
* - `providerOptions.pdfBase64` — base64-encoded PDF to include as document context
|
|
20
20
|
* - `providerOptions.images` — `Array<{ imageBase64: string; mimeType: string }>` page images
|
|
21
|
+
* - `providerOptions.attachments` — generic multimodal attachments such as
|
|
22
|
+
* `Array<{ kind: "image" | "pdf" | "text"; name?: string; mimeType?: string; base64?: string; text?: string; description?: string }>`
|
|
21
23
|
*
|
|
22
24
|
* Your callback should check for these fields and include them as multi-part
|
|
23
25
|
* message content (e.g. file/image parts) when calling your AI provider.
|
|
@@ -29591,6 +29593,34 @@ declare function buildLookupFillPrompt(requests: {
|
|
|
29591
29593
|
|
|
29592
29594
|
declare const QueryIntentSchema: z.ZodEnum<["policy_question", "coverage_comparison", "document_search", "claims_inquiry", "general_knowledge"]>;
|
|
29593
29595
|
type QueryIntent = z.infer<typeof QueryIntentSchema>;
|
|
29596
|
+
declare const QueryAttachmentKindSchema: z.ZodEnum<["image", "pdf", "text"]>;
|
|
29597
|
+
type QueryAttachmentKind = z.infer<typeof QueryAttachmentKindSchema>;
|
|
29598
|
+
declare const QueryAttachmentSchema: z.ZodObject<{
|
|
29599
|
+
id: z.ZodOptional<z.ZodString>;
|
|
29600
|
+
kind: z.ZodEnum<["image", "pdf", "text"]>;
|
|
29601
|
+
name: z.ZodOptional<z.ZodString>;
|
|
29602
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
29603
|
+
base64: z.ZodOptional<z.ZodString>;
|
|
29604
|
+
text: z.ZodOptional<z.ZodString>;
|
|
29605
|
+
description: z.ZodOptional<z.ZodString>;
|
|
29606
|
+
}, "strip", z.ZodTypeAny, {
|
|
29607
|
+
kind: "text" | "image" | "pdf";
|
|
29608
|
+
name?: string | undefined;
|
|
29609
|
+
description?: string | undefined;
|
|
29610
|
+
id?: string | undefined;
|
|
29611
|
+
base64?: string | undefined;
|
|
29612
|
+
text?: string | undefined;
|
|
29613
|
+
mimeType?: string | undefined;
|
|
29614
|
+
}, {
|
|
29615
|
+
kind: "text" | "image" | "pdf";
|
|
29616
|
+
name?: string | undefined;
|
|
29617
|
+
description?: string | undefined;
|
|
29618
|
+
id?: string | undefined;
|
|
29619
|
+
base64?: string | undefined;
|
|
29620
|
+
text?: string | undefined;
|
|
29621
|
+
mimeType?: string | undefined;
|
|
29622
|
+
}>;
|
|
29623
|
+
type QueryAttachment = z.infer<typeof QueryAttachmentSchema>;
|
|
29594
29624
|
declare const SubQuestionSchema: z.ZodObject<{
|
|
29595
29625
|
question: z.ZodString;
|
|
29596
29626
|
intent: z.ZodEnum<["policy_question", "coverage_comparison", "document_search", "claims_inquiry", "general_knowledge"]>;
|
|
@@ -29726,10 +29756,11 @@ declare const QueryClassifyResultSchema: z.ZodObject<{
|
|
|
29726
29756
|
}>;
|
|
29727
29757
|
type QueryClassifyResult = z.infer<typeof QueryClassifyResultSchema>;
|
|
29728
29758
|
declare const EvidenceItemSchema: z.ZodObject<{
|
|
29729
|
-
source: z.ZodEnum<["chunk", "document", "conversation"]>;
|
|
29759
|
+
source: z.ZodEnum<["chunk", "document", "conversation", "attachment"]>;
|
|
29730
29760
|
chunkId: z.ZodOptional<z.ZodString>;
|
|
29731
29761
|
documentId: z.ZodOptional<z.ZodString>;
|
|
29732
29762
|
turnId: z.ZodOptional<z.ZodString>;
|
|
29763
|
+
attachmentId: z.ZodOptional<z.ZodString>;
|
|
29733
29764
|
text: z.ZodString;
|
|
29734
29765
|
relevance: z.ZodNumber;
|
|
29735
29766
|
metadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -29744,35 +29775,55 @@ declare const EvidenceItemSchema: z.ZodObject<{
|
|
|
29744
29775
|
}>, "many">>;
|
|
29745
29776
|
}, "strip", z.ZodTypeAny, {
|
|
29746
29777
|
text: string;
|
|
29747
|
-
source: "document" | "chunk" | "conversation";
|
|
29778
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29748
29779
|
relevance: number;
|
|
29749
29780
|
chunkId?: string | undefined;
|
|
29750
29781
|
documentId?: string | undefined;
|
|
29751
29782
|
turnId?: string | undefined;
|
|
29783
|
+
attachmentId?: string | undefined;
|
|
29752
29784
|
metadata?: {
|
|
29753
29785
|
key: string;
|
|
29754
29786
|
value: string;
|
|
29755
29787
|
}[] | undefined;
|
|
29756
29788
|
}, {
|
|
29757
29789
|
text: string;
|
|
29758
|
-
source: "document" | "chunk" | "conversation";
|
|
29790
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29759
29791
|
relevance: number;
|
|
29760
29792
|
chunkId?: string | undefined;
|
|
29761
29793
|
documentId?: string | undefined;
|
|
29762
29794
|
turnId?: string | undefined;
|
|
29795
|
+
attachmentId?: string | undefined;
|
|
29763
29796
|
metadata?: {
|
|
29764
29797
|
key: string;
|
|
29765
29798
|
value: string;
|
|
29766
29799
|
}[] | undefined;
|
|
29767
29800
|
}>;
|
|
29768
29801
|
type EvidenceItem = z.infer<typeof EvidenceItemSchema>;
|
|
29802
|
+
declare const AttachmentInterpretationSchema: z.ZodObject<{
|
|
29803
|
+
summary: z.ZodString;
|
|
29804
|
+
extractedFacts: z.ZodArray<z.ZodString, "many">;
|
|
29805
|
+
recommendedFocus: z.ZodArray<z.ZodString, "many">;
|
|
29806
|
+
confidence: z.ZodNumber;
|
|
29807
|
+
}, "strip", z.ZodTypeAny, {
|
|
29808
|
+
summary: string;
|
|
29809
|
+
confidence: number;
|
|
29810
|
+
extractedFacts: string[];
|
|
29811
|
+
recommendedFocus: string[];
|
|
29812
|
+
}, {
|
|
29813
|
+
summary: string;
|
|
29814
|
+
confidence: number;
|
|
29815
|
+
extractedFacts: string[];
|
|
29816
|
+
recommendedFocus: string[];
|
|
29817
|
+
}>;
|
|
29818
|
+
type AttachmentInterpretation = z.infer<typeof AttachmentInterpretationSchema>;
|
|
29769
29819
|
declare const RetrievalResultSchema: z.ZodObject<{
|
|
29770
29820
|
subQuestion: z.ZodString;
|
|
29771
29821
|
evidence: z.ZodArray<z.ZodObject<{
|
|
29772
|
-
source: z.ZodEnum<["chunk", "document", "conversation"]>;
|
|
29822
|
+
source: z.ZodEnum<["chunk", "document", "conversation", "attachment"]>;
|
|
29773
29823
|
chunkId: z.ZodOptional<z.ZodString>;
|
|
29774
29824
|
documentId: z.ZodOptional<z.ZodString>;
|
|
29775
29825
|
turnId: z.ZodOptional<z.ZodString>;
|
|
29826
|
+
attachmentId: z.ZodOptional<z.ZodString>;
|
|
29776
29827
|
text: z.ZodString;
|
|
29777
29828
|
relevance: z.ZodNumber;
|
|
29778
29829
|
metadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -29787,22 +29838,24 @@ declare const RetrievalResultSchema: z.ZodObject<{
|
|
|
29787
29838
|
}>, "many">>;
|
|
29788
29839
|
}, "strip", z.ZodTypeAny, {
|
|
29789
29840
|
text: string;
|
|
29790
|
-
source: "document" | "chunk" | "conversation";
|
|
29841
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29791
29842
|
relevance: number;
|
|
29792
29843
|
chunkId?: string | undefined;
|
|
29793
29844
|
documentId?: string | undefined;
|
|
29794
29845
|
turnId?: string | undefined;
|
|
29846
|
+
attachmentId?: string | undefined;
|
|
29795
29847
|
metadata?: {
|
|
29796
29848
|
key: string;
|
|
29797
29849
|
value: string;
|
|
29798
29850
|
}[] | undefined;
|
|
29799
29851
|
}, {
|
|
29800
29852
|
text: string;
|
|
29801
|
-
source: "document" | "chunk" | "conversation";
|
|
29853
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29802
29854
|
relevance: number;
|
|
29803
29855
|
chunkId?: string | undefined;
|
|
29804
29856
|
documentId?: string | undefined;
|
|
29805
29857
|
turnId?: string | undefined;
|
|
29858
|
+
attachmentId?: string | undefined;
|
|
29806
29859
|
metadata?: {
|
|
29807
29860
|
key: string;
|
|
29808
29861
|
value: string;
|
|
@@ -29812,11 +29865,12 @@ declare const RetrievalResultSchema: z.ZodObject<{
|
|
|
29812
29865
|
subQuestion: string;
|
|
29813
29866
|
evidence: {
|
|
29814
29867
|
text: string;
|
|
29815
|
-
source: "document" | "chunk" | "conversation";
|
|
29868
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29816
29869
|
relevance: number;
|
|
29817
29870
|
chunkId?: string | undefined;
|
|
29818
29871
|
documentId?: string | undefined;
|
|
29819
29872
|
turnId?: string | undefined;
|
|
29873
|
+
attachmentId?: string | undefined;
|
|
29820
29874
|
metadata?: {
|
|
29821
29875
|
key: string;
|
|
29822
29876
|
value: string;
|
|
@@ -29826,11 +29880,12 @@ declare const RetrievalResultSchema: z.ZodObject<{
|
|
|
29826
29880
|
subQuestion: string;
|
|
29827
29881
|
evidence: {
|
|
29828
29882
|
text: string;
|
|
29829
|
-
source: "document" | "chunk" | "conversation";
|
|
29883
|
+
source: "document" | "chunk" | "conversation" | "attachment";
|
|
29830
29884
|
relevance: number;
|
|
29831
29885
|
chunkId?: string | undefined;
|
|
29832
29886
|
documentId?: string | undefined;
|
|
29833
29887
|
turnId?: string | undefined;
|
|
29888
|
+
attachmentId?: string | undefined;
|
|
29834
29889
|
metadata?: {
|
|
29835
29890
|
key: string;
|
|
29836
29891
|
value: string;
|
|
@@ -30034,6 +30089,7 @@ interface QueryInput {
|
|
|
30034
30089
|
question: string;
|
|
30035
30090
|
conversationId?: string;
|
|
30036
30091
|
context?: AgentContext;
|
|
30092
|
+
attachments?: QueryAttachment[];
|
|
30037
30093
|
}
|
|
30038
30094
|
interface QueryOutput extends QueryResult {
|
|
30039
30095
|
tokenUsage: TokenUsage;
|
|
@@ -30048,7 +30104,9 @@ declare function createQueryAgent(config: QueryConfig): {
|
|
|
30048
30104
|
* Query classification prompt — determines intent and decomposes complex
|
|
30049
30105
|
* questions into atomic sub-questions for parallel retrieval + reasoning.
|
|
30050
30106
|
*/
|
|
30051
|
-
declare function buildQueryClassifyPrompt(question: string, conversationContext?: string): string;
|
|
30107
|
+
declare function buildQueryClassifyPrompt(question: string, conversationContext?: string, attachmentContext?: string): string;
|
|
30108
|
+
|
|
30109
|
+
declare function buildInterpretAttachmentPrompt(question: string, attachment: QueryAttachment): string;
|
|
30052
30110
|
|
|
30053
30111
|
/**
|
|
30054
30112
|
* Reasoning prompts — per-intent prompts that instruct the reasoner agent
|
|
@@ -30107,4 +30165,4 @@ interface DocumentTemplate {
|
|
|
30107
30165
|
}
|
|
30108
30166
|
declare function getTemplate(policyType: string): DocumentTemplate;
|
|
30109
30167
|
|
|
30110
|
-
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 AuditType, AuditTypeSchema, type AutoFillMatch, AutoFillMatchSchema, type AutoFillResult, AutoFillResultSchema, 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 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, 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 };
|
|
30168
|
+
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, 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 };
|