@docrouter/sdk 0.1.0 → 0.2.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
@@ -1,5 +1,8 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
2
 
3
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
4
+ [key: string]: JsonValue;
5
+ };
3
6
  interface DocRouterConfig {
4
7
  baseURL: string;
5
8
  token?: string;
@@ -44,6 +47,9 @@ interface AccessToken {
44
47
  interface ListAccessTokensResponse {
45
48
  access_tokens: AccessToken[];
46
49
  }
50
+ interface TokenOrganizationResponse {
51
+ organization_id: string | null;
52
+ }
47
53
  interface OrganizationMember {
48
54
  user_id: string;
49
55
  role: 'admin' | 'user';
@@ -84,8 +90,8 @@ interface Document {
84
90
  }
85
91
  interface UploadDocument {
86
92
  name: string;
87
- content: ArrayBuffer | Buffer | Uint8Array;
88
- type: string;
93
+ content: string;
94
+ tag_ids?: string[];
89
95
  metadata?: Record<string, string>;
90
96
  }
91
97
  interface UploadDocumentsParams {
@@ -141,6 +147,30 @@ interface ListDocumentsResponse {
141
147
  total_count: number;
142
148
  skip: number;
143
149
  }
150
+ interface OCRGeometry {
151
+ BoundingBox: {
152
+ Width: number;
153
+ Height: number;
154
+ Left: number;
155
+ Top: number;
156
+ };
157
+ Polygon: Array<{
158
+ X: number;
159
+ Y: number;
160
+ }>;
161
+ }
162
+ interface OCRBlock {
163
+ BlockType: 'PAGE' | 'LINE' | 'WORD';
164
+ Confidence: number;
165
+ Text?: string;
166
+ Geometry: OCRGeometry;
167
+ Id: string;
168
+ Relationships?: Array<{
169
+ Type: string;
170
+ Ids: string[];
171
+ }>;
172
+ Page: number;
173
+ }
144
174
  interface GetOCRBlocksParams {
145
175
  documentId: string;
146
176
  }
@@ -158,34 +188,44 @@ interface GetOCRMetadataResponse {
158
188
  created_at: string;
159
189
  updated_at: string;
160
190
  }
161
- interface LLMChatMessage {
162
- role: 'system' | 'user' | 'assistant';
191
+ interface LLMMessage {
192
+ role: "system" | "user" | "assistant";
163
193
  content: string;
164
194
  }
165
195
  interface LLMChatRequest {
166
- messages: LLMChatMessage[];
167
- model?: string;
168
- temperature?: number;
196
+ model: string;
197
+ messages: LLMMessage[];
169
198
  max_tokens?: number;
199
+ temperature?: number;
170
200
  stream?: boolean;
171
201
  }
172
- interface LLMChatResponse {
173
- message: LLMChatMessage;
174
- usage?: {
175
- prompt_tokens: number;
176
- completion_tokens: number;
177
- total_tokens: number;
202
+ interface LLMChatChoice {
203
+ index: number;
204
+ message: {
205
+ role: "assistant";
206
+ content: string;
178
207
  };
208
+ finish_reason: string;
209
+ }
210
+ interface LLMChatUsage {
211
+ prompt_tokens: number;
212
+ completion_tokens: number;
213
+ total_tokens: number;
214
+ }
215
+ interface LLMChatResponse {
216
+ id: string;
217
+ object: "chat.completion";
218
+ created: number;
219
+ model: string;
220
+ choices: LLMChatChoice[];
221
+ usage: LLMChatUsage;
179
222
  }
180
223
  interface LLMChatStreamChunk {
181
- type: 'chunk';
182
- content: string;
224
+ chunk: string;
183
225
  done: boolean;
184
226
  }
185
227
  interface LLMChatStreamError {
186
- type: 'error';
187
228
  error: string;
188
- done: true;
189
229
  }
190
230
  interface ListLLMModelsParams {
191
231
  providerName?: string;
@@ -193,25 +233,33 @@ interface ListLLMModelsParams {
193
233
  llmEnabled?: boolean;
194
234
  }
195
235
  interface LLMModel {
196
- id: string;
197
- name: string;
198
- provider: string;
199
- enabled: boolean;
236
+ litellm_model: string;
237
+ litellm_provider: string;
238
+ max_input_tokens: number;
239
+ max_output_tokens: number;
240
+ input_cost_per_token: number;
241
+ output_cost_per_token: number;
200
242
  }
201
243
  interface ListLLMModelsResponse {
202
244
  models: LLMModel[];
203
245
  }
246
+ interface LLMProvider {
247
+ name: string;
248
+ display_name: string;
249
+ litellm_provider: string;
250
+ litellm_models_enabled: string[];
251
+ litellm_models_available: string[];
252
+ enabled: boolean;
253
+ token: string | null;
254
+ token_created_at: string | null;
255
+ }
204
256
  interface ListLLMProvidersResponse {
205
- providers: Array<{
206
- name: string;
207
- enabled: boolean;
208
- configured: boolean;
209
- }>;
257
+ providers: LLMProvider[];
210
258
  }
211
259
  interface SetLLMProviderConfigRequest {
212
- api_key?: string;
213
- base_url?: string;
214
- enabled?: boolean;
260
+ litellm_models_enabled: string[] | null;
261
+ enabled: boolean | null;
262
+ token: string | null;
215
263
  }
216
264
  interface RunLLMParams {
217
265
  documentId: string;
@@ -228,7 +276,13 @@ interface GetLLMResultParams {
228
276
  fallback?: boolean;
229
277
  }
230
278
  interface GetLLMResultResponse {
231
- result: Record<string, unknown>;
279
+ prompt_revid: string;
280
+ prompt_id: string;
281
+ prompt_version: number;
282
+ document_id: string;
283
+ llm_result: Record<string, JsonValue>;
284
+ updated_llm_result: Record<string, JsonValue>;
285
+ is_edited: boolean;
232
286
  is_verified: boolean;
233
287
  created_at: string;
234
288
  updated_at: string;
@@ -240,10 +294,13 @@ interface DeleteLLMResultParams {
240
294
  interface User {
241
295
  id: string;
242
296
  email: string;
243
- name: string;
297
+ name: string | null;
244
298
  role: string;
299
+ email_verified: boolean | null;
245
300
  created_at: string;
246
301
  updated_at: string;
302
+ has_password: boolean;
303
+ has_seen_tour: boolean;
247
304
  }
248
305
  interface UserCreate {
249
306
  email: string;
@@ -254,9 +311,9 @@ interface UserUpdate {
254
311
  name?: string;
255
312
  email?: string;
256
313
  password?: string;
257
- }
258
- interface UserResponse {
259
- user: User;
314
+ role?: string;
315
+ email_verified?: boolean;
316
+ has_seen_tour?: boolean;
260
317
  }
261
318
  interface ListUsersParams {
262
319
  skip?: number;
@@ -274,6 +331,7 @@ interface Tag {
274
331
  id: string;
275
332
  name: string;
276
333
  color: string;
334
+ description?: string;
277
335
  created_at: string;
278
336
  updated_at: string;
279
337
  }
@@ -297,59 +355,46 @@ interface UpdateTagParams {
297
355
  interface DeleteTagParams {
298
356
  tagId: string;
299
357
  }
300
- interface PortalSessionResponse {
301
- url: string;
302
- }
303
- interface SubscriptionResponse {
304
- id: string;
305
- status: string;
306
- current_period_start: string;
307
- current_period_end: string;
308
- plan_id: string;
309
- }
310
- interface UsageResponse {
311
- credits_used: number;
312
- credits_remaining: number;
313
- period_start: string;
314
- period_end: string;
315
- }
316
358
  interface CreditConfig {
317
- cost_per_credit: number;
318
- credits_per_dollar: number;
359
+ price_per_credit: number;
360
+ currency: string;
361
+ min_cost: number;
362
+ max_cost: number;
319
363
  }
320
364
  interface CreditUpdateResponse {
321
365
  credits_added: number;
322
366
  new_balance: number;
323
367
  }
324
- interface UsageRangeRequest {
325
- start_date: string;
326
- end_date: string;
368
+ interface FormResponseFormat {
369
+ json_formio?: object | null;
370
+ json_formio_mapping?: Record<string, FieldMapping>;
327
371
  }
328
- interface UsageRangeResponse {
329
- usage: Array<{
330
- date: string;
331
- credits_used: number;
332
- }>;
372
+ interface FieldMappingSource {
373
+ promptRevId: string;
374
+ promptName: string;
375
+ schemaFieldPath: string;
376
+ schemaFieldName: string;
377
+ schemaFieldType: string;
378
+ }
379
+ interface FieldMapping {
380
+ sources: FieldMappingSource[];
381
+ mappingType: 'direct' | 'concatenated' | 'calculated' | 'conditional';
382
+ concatenationSeparator?: string;
333
383
  }
334
384
  interface Form {
335
385
  form_revid: string;
336
386
  form_id: string;
337
387
  form_version: number;
338
388
  name: string;
339
- response_format: {
340
- json_formio?: Array<Record<string, unknown>>;
341
- json_formio_mapping?: Record<string, Record<string, unknown>>;
342
- };
389
+ response_format: FormResponseFormat;
343
390
  created_at: string;
344
391
  created_by: string;
392
+ tag_ids?: string[];
345
393
  }
346
394
  interface CreateFormParams {
347
395
  organizationId: string;
348
396
  name: string;
349
- response_format: {
350
- json_formio?: Array<Record<string, unknown>>;
351
- json_formio_mapping?: Record<string, Record<string, unknown>>;
352
- };
397
+ response_format: FormResponseFormat;
353
398
  }
354
399
  interface ListFormsParams {
355
400
  organizationId: string;
@@ -369,7 +414,7 @@ interface GetFormParams {
369
414
  interface UpdateFormParams {
370
415
  organizationId: string;
371
416
  formId: string;
372
- form: Partial<Omit<Form, 'id' | 'created_at' | 'updated_at'>>;
417
+ form: Partial<Omit<Form, 'form_revid' | 'form_id' | 'form_version' | 'created_at' | 'created_by'>>;
373
418
  }
374
419
  interface DeleteFormParams {
375
420
  organizationId: string;
@@ -402,15 +447,21 @@ interface DeleteFormSubmissionParams {
402
447
  formRevId: string;
403
448
  }
404
449
  interface Prompt {
405
- id: string;
450
+ prompt_revid: string;
451
+ prompt_id: string;
452
+ prompt_version: number;
406
453
  name: string;
407
454
  content: string;
455
+ schema_id?: string;
456
+ schema_version?: number;
457
+ tag_ids?: string[];
458
+ model?: string;
408
459
  created_at: string;
409
- updated_at: string;
460
+ created_by: string;
410
461
  }
411
462
  interface CreatePromptParams {
412
463
  organizationId: string;
413
- prompt: Omit<Prompt, 'id' | 'created_at' | 'updated_at'>;
464
+ prompt: Omit<Prompt, 'prompt_revid' | 'prompt_id' | 'prompt_version' | 'created_at' | 'created_by'>;
414
465
  }
415
466
  interface ListPromptsParams {
416
467
  organizationId: string;
@@ -432,65 +483,50 @@ interface GetPromptParams {
432
483
  interface UpdatePromptParams {
433
484
  organizationId: string;
434
485
  promptId: string;
435
- prompt: Partial<Omit<Prompt, 'id' | 'created_at' | 'updated_at'>>;
486
+ prompt: Partial<Omit<Prompt, 'prompt_revid' | 'prompt_id' | 'prompt_version' | 'created_at' | 'created_by'>>;
436
487
  }
437
488
  interface DeletePromptParams {
438
489
  organizationId: string;
439
490
  promptId: string;
440
491
  }
441
- interface Flow {
442
- id: string;
443
- name: string;
444
- definition: Record<string, unknown>;
445
- created_at: string;
446
- updated_at: string;
447
- }
448
- interface CreateFlowParams {
449
- organizationId: string;
450
- flow: Omit<Flow, 'id' | 'created_at' | 'updated_at'>;
451
- }
452
- interface UpdateFlowParams {
453
- organizationId: string;
454
- flowId: string;
455
- flow: Partial<Omit<Flow, 'id' | 'created_at' | 'updated_at'>>;
456
- }
457
- interface ListFlowsParams {
458
- organizationId: string;
459
- skip?: number;
460
- limit?: number;
461
- }
462
- interface ListFlowsResponse {
463
- flows: Flow[];
464
- total_count: number;
465
- skip: number;
466
- }
467
- interface GetFlowParams {
468
- organizationId: string;
469
- flowId: string;
470
- }
471
- interface DeleteFlowParams {
472
- organizationId: string;
473
- flowId: string;
492
+ interface SchemaProperty {
493
+ type: 'string' | 'integer' | 'number' | 'boolean' | 'array' | 'object';
494
+ description?: string;
495
+ items?: SchemaProperty;
496
+ properties?: Record<string, SchemaProperty>;
497
+ additionalProperties?: boolean;
498
+ required?: string[];
499
+ }
500
+ interface SchemaResponseFormat {
501
+ type: 'json_schema';
502
+ json_schema: {
503
+ name: string;
504
+ schema: {
505
+ type: 'object';
506
+ properties: Record<string, SchemaProperty>;
507
+ required: string[];
508
+ additionalProperties: boolean;
509
+ };
510
+ strict: boolean;
511
+ };
474
512
  }
475
513
  interface Schema {
476
514
  schema_revid: string;
477
515
  schema_id: string;
478
516
  schema_version: number;
479
517
  name: string;
480
- response_format: {
481
- type: 'json_schema';
482
- json_schema: Record<string, unknown>;
483
- };
518
+ response_format: SchemaResponseFormat;
484
519
  created_at: string;
485
520
  created_by: string;
486
521
  }
522
+ interface SchemaConfig {
523
+ name: string;
524
+ response_format: SchemaResponseFormat;
525
+ }
487
526
  interface CreateSchemaParams {
488
527
  organizationId: string;
489
528
  name: string;
490
- response_format: {
491
- type: 'json_schema';
492
- json_schema: Record<string, unknown>;
493
- };
529
+ response_format: SchemaResponseFormat;
494
530
  }
495
531
  interface ListSchemasParams {
496
532
  organizationId: string;
@@ -510,7 +546,7 @@ interface GetSchemaParams {
510
546
  interface UpdateSchemaParams {
511
547
  organizationId: string;
512
548
  schemaId: string;
513
- schema: Partial<Omit<Schema, 'id' | 'created_at' | 'updated_at'>>;
549
+ schema: Partial<Omit<Schema, 'schema_revid' | 'schema_id' | 'schema_version' | 'created_at' | 'created_by'>>;
514
550
  }
515
551
  interface DeleteSchemaParams {
516
552
  organizationId: string;
@@ -520,13 +556,15 @@ interface InvitationResponse {
520
556
  id: string;
521
557
  email: string;
522
558
  organization_id: string;
559
+ organization_name?: string;
523
560
  role: string;
561
+ user_exists?: boolean;
524
562
  created_at: string;
525
563
  expires_at: string;
526
564
  }
527
565
  interface CreateInvitationRequest {
528
566
  email: string;
529
- organization_id: string;
567
+ organization_id?: string;
530
568
  role: string;
531
569
  }
532
570
  interface ListInvitationsParams {
@@ -542,10 +580,79 @@ interface AcceptInvitationRequest {
542
580
  name: string;
543
581
  password: string;
544
582
  }
583
+ interface PortalSessionResponse {
584
+ url: string;
585
+ }
586
+ interface PortalSessionResponse {
587
+ payment_portal_url: string;
588
+ stripe_enabled: boolean;
589
+ }
590
+ interface SubscriptionPlan {
591
+ plan_id: string;
592
+ name: string;
593
+ base_price: number;
594
+ included_spus: number;
595
+ features: string[];
596
+ currency: string;
597
+ interval: string;
598
+ }
599
+ interface SubscriptionResponse {
600
+ plans: SubscriptionPlan[];
601
+ current_plan: string | null;
602
+ subscription_status: string | null;
603
+ cancel_at_period_end: boolean;
604
+ current_period_start: number | null;
605
+ current_period_end: number | null;
606
+ stripe_enabled: boolean;
607
+ stripe_payments_portal_enabled: boolean;
608
+ }
609
+ interface UsageData {
610
+ subscription_type: string | null;
611
+ usage_unit: string;
612
+ period_metered_usage: number;
613
+ total_metered_usage: number;
614
+ remaining_included: number;
615
+ purchased_credits: number;
616
+ purchased_credits_used: number;
617
+ purchased_credits_remaining: number;
618
+ granted_credits: number;
619
+ granted_credits_used: number;
620
+ granted_credits_remaining: number;
621
+ period_start: number | null;
622
+ period_end: number | null;
623
+ }
624
+ interface UsageResponse {
625
+ usage_source: string;
626
+ data: UsageData;
627
+ }
628
+ interface UsageRangeRequest {
629
+ start_date: string;
630
+ end_date: string;
631
+ }
632
+ interface UsageRangeRequest {
633
+ start_date: string;
634
+ end_date: string;
635
+ }
636
+ interface UsageDataPoint {
637
+ date: string;
638
+ spus: number;
639
+ operation: string;
640
+ source: string;
641
+ }
642
+ interface UsageRangeResponse {
643
+ usage: Array<{
644
+ date: string;
645
+ credits_used: number;
646
+ }>;
647
+ }
648
+ interface UsageRangeResponse {
649
+ data_points: UsageDataPoint[];
650
+ total_spus: number;
651
+ }
545
652
  interface AWSConfig {
546
653
  access_key_id: string;
547
654
  secret_access_key: string;
548
- region: string;
655
+ s3_bucket_name: string;
549
656
  created_at: string;
550
657
  }
551
658
 
@@ -565,7 +672,7 @@ declare class HttpClient {
565
672
  put<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
566
673
  delete<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
567
674
  request<T = unknown>(config: AxiosRequestConfig): Promise<T>;
568
- stream(url: string, data: unknown, onChunk: (chunk: unknown) => void, onError?: (error: Error) => void, abortSignal?: AbortSignal): Promise<void>;
675
+ stream(url: string, data: unknown, onChunk: (chunk: LLMChatStreamChunk | LLMChatStreamError) => void, onError?: (error: Error) => void, abortSignal?: AbortSignal): Promise<void>;
569
676
  updateToken(token: string): void;
570
677
  updateTokenProvider(provider: () => Promise<string>): void;
571
678
  }
@@ -593,26 +700,69 @@ declare class DocRouterAccount {
593
700
  createOrganization(organization: CreateOrganizationRequest): Promise<Organization>;
594
701
  updateOrganization(organizationId: string, update: UpdateOrganizationRequest): Promise<Organization>;
595
702
  deleteOrganization(organizationId: string): Promise<unknown>;
596
- createAccountToken(request: CreateTokenRequest): Promise<unknown>;
597
- getAccountTokens(): Promise<ListAccessTokensResponse | unknown>;
598
- deleteAccountToken(tokenId: string): Promise<unknown>;
599
- createOrganizationToken(request: CreateTokenRequest, organizationId: string): Promise<unknown>;
600
- getOrganizationTokens(organizationId: string): Promise<unknown>;
601
- deleteOrganizationToken(tokenId: string, organizationId: string): Promise<unknown>;
703
+ createAccountToken(request: CreateTokenRequest): Promise<AccessToken>;
704
+ getAccountTokens(): Promise<AccessToken[]>;
705
+ deleteAccountToken(tokenId: string): Promise<void>;
706
+ createOrganizationToken(request: CreateTokenRequest, organizationId: string): Promise<AccessToken>;
707
+ getOrganizationTokens(organizationId: string): Promise<AccessToken[]>;
708
+ deleteOrganizationToken(tokenId: string, organizationId: string): Promise<void>;
709
+ /**
710
+ * Get the organization ID associated with an API token
711
+ * @param token The API token to resolve
712
+ * @returns The organization ID for org-specific tokens, or null for account-level tokens
713
+ */
714
+ getOrganizationFromToken(token: string): Promise<TokenOrganizationResponse>;
602
715
  listLLMModels(params: ListLLMModelsParams): Promise<ListLLMModelsResponse>;
603
716
  listLLMProviders(): Promise<ListLLMProvidersResponse>;
604
717
  setLLMProviderConfig(providerName: string, request: SetLLMProviderConfigRequest): Promise<SetLLMProviderConfigRequest>;
605
718
  listUsers(params?: ListUsersParams): Promise<ListUsersResponse>;
606
- getUser(userId: string): Promise<UserResponse>;
607
- createUser(user: UserCreate): Promise<UserResponse>;
608
- updateUser(userId: string, update: UserUpdate): Promise<UserResponse>;
719
+ getUser(userId: string): Promise<User>;
720
+ createUser(user: UserCreate): Promise<User>;
721
+ updateUser(userId: string, update: UserUpdate): Promise<User>;
609
722
  deleteUser(userId: string): Promise<void>;
610
723
  sendVerificationEmail(userId: string): Promise<unknown>;
611
724
  sendRegistrationVerificationEmail(userId: string): Promise<unknown>;
612
725
  verifyEmail(token: string): Promise<unknown>;
613
- createAWSConfig(config: Omit<AWSConfig, 'created_at'>): Promise<unknown>;
614
- getAWSConfig(): Promise<unknown>;
615
- deleteAWSConfig(): Promise<unknown>;
726
+ createAWSConfig(config: Omit<AWSConfig, 'created_at'>): Promise<AWSConfig>;
727
+ getAWSConfig(): Promise<AWSConfig>;
728
+ deleteAWSConfig(): Promise<void>;
729
+ createInvitation(invitation: CreateInvitationRequest): Promise<InvitationResponse>;
730
+ getInvitations(params?: ListInvitationsParams): Promise<ListInvitationsResponse>;
731
+ getInvitation(token: string): Promise<InvitationResponse>;
732
+ acceptInvitation(token: string, data: AcceptInvitationRequest): Promise<{
733
+ message: string;
734
+ }>;
735
+ getCustomerPortal(orgId: string): Promise<PortalSessionResponse>;
736
+ getSubscription(orgId: string): Promise<SubscriptionResponse>;
737
+ activateSubscription(orgId: string): Promise<{
738
+ status: string;
739
+ message: string;
740
+ }>;
741
+ cancelSubscription(orgId: string): Promise<{
742
+ status: string;
743
+ message: string;
744
+ }>;
745
+ getCurrentUsage(orgId: string): Promise<UsageResponse>;
746
+ addCredits(orgId: string, amount: number): Promise<CreditUpdateResponse>;
747
+ getCreditConfig(orgId: string): Promise<CreditConfig>;
748
+ purchaseCredits(orgId: string, request: {
749
+ credits: number;
750
+ success_url: string;
751
+ cancel_url: string;
752
+ }): Promise<{
753
+ checkout_url: string;
754
+ session_id: string;
755
+ }>;
756
+ getUsageRange(orgId: string, request: UsageRangeRequest): Promise<UsageRangeResponse>;
757
+ createCheckoutSession(orgId: string, planId: string): Promise<PortalSessionResponse>;
758
+ /**
759
+ * Run LLM chat (account level)
760
+ */
761
+ runLLMChat(request: LLMChatRequest): Promise<LLMChatResponse>;
762
+ /**
763
+ * Run LLM chat with streaming (account level)
764
+ */
765
+ runLLMChatStream(request: LLMChatRequest, onChunk: (chunk: LLMChatStreamChunk | LLMChatStreamError) => void, onError?: (error: Error) => void, abortSignal?: AbortSignal): Promise<void>;
616
766
  /**
617
767
  * Get the current HTTP client (for advanced usage)
618
768
  */
@@ -634,8 +784,8 @@ declare class DocRouterOrg {
634
784
  uploadDocuments(params: {
635
785
  documents: Array<{
636
786
  name: string;
637
- content: ArrayBuffer | Buffer | Uint8Array;
638
- type: string;
787
+ content: string;
788
+ tag_ids?: string[];
639
789
  metadata?: Record<string, string>;
640
790
  }>;
641
791
  }): Promise<UploadDocumentsResponse>;
@@ -661,11 +811,11 @@ declare class DocRouterOrg {
661
811
  }): Promise<unknown>;
662
812
  getOCRBlocks(params: {
663
813
  documentId: string;
664
- }): Promise<unknown>;
814
+ }): Promise<OCRBlock[]>;
665
815
  getOCRText(params: {
666
816
  documentId: string;
667
817
  pageNum?: number;
668
- }): Promise<unknown>;
818
+ }): Promise<string>;
669
819
  getOCRMetadata(params: {
670
820
  documentId: string;
671
821
  }): Promise<GetOCRMetadataResponse>;
@@ -682,9 +832,9 @@ declare class DocRouterOrg {
682
832
  updateLLMResult({ documentId, promptId, result, isVerified }: {
683
833
  documentId: string;
684
834
  promptId: string;
685
- result: Record<string, unknown>;
835
+ result: Record<string, JsonValue>;
686
836
  isVerified?: boolean;
687
- }): Promise<unknown>;
837
+ }): Promise<GetLLMResultResponse>;
688
838
  deleteLLMResult(params: {
689
839
  documentId: string;
690
840
  promptId: string;
@@ -692,6 +842,13 @@ declare class DocRouterOrg {
692
842
  downloadAllLLMResults(params: {
693
843
  documentId: string;
694
844
  }): Promise<unknown>;
845
+ createPrompt(params: Omit<CreatePromptParams, 'organizationId'>): Promise<Prompt>;
846
+ listPrompts(params?: Omit<ListPromptsParams, 'organizationId'>): Promise<ListPromptsResponse>;
847
+ getPrompt(params: Omit<GetPromptParams, 'organizationId'>): Promise<Prompt>;
848
+ updatePrompt(params: Omit<UpdatePromptParams, 'organizationId'>): Promise<Prompt>;
849
+ deletePrompt(params: Omit<DeletePromptParams, 'organizationId'>): Promise<{
850
+ message: string;
851
+ }>;
695
852
  createTag(params: {
696
853
  tag: Omit<Tag, 'id' | 'created_at' | 'updated_at'>;
697
854
  }): Promise<Tag>;
@@ -722,13 +879,6 @@ declare class DocRouterOrg {
722
879
  submitForm(params: Omit<SubmitFormParams, 'organizationId'>): Promise<FormSubmission>;
723
880
  getFormSubmission(params: Omit<GetFormSubmissionParams, 'organizationId'>): Promise<FormSubmission | null>;
724
881
  deleteFormSubmission(params: Omit<DeleteFormSubmissionParams, 'organizationId'>): Promise<void>;
725
- createPrompt(params: Omit<CreatePromptParams, 'organizationId'>): Promise<Prompt>;
726
- listPrompts(params: Omit<ListPromptsParams, 'organizationId'>): Promise<ListPromptsResponse>;
727
- getPrompt(params: Omit<GetPromptParams, 'organizationId'>): Promise<Prompt>;
728
- updatePrompt(params: Omit<UpdatePromptParams, 'organizationId'>): Promise<Prompt>;
729
- deletePrompt(params: Omit<DeletePromptParams, 'organizationId'>): Promise<{
730
- message: string;
731
- }>;
732
882
  createSchema(schema: Omit<CreateSchemaParams, 'organizationId'>): Promise<Schema>;
733
883
  listSchemas(params: Omit<ListSchemasParams, 'organizationId'>): Promise<ListSchemasResponse>;
734
884
  getSchema(params: Omit<GetSchemaParams, 'organizationId'>): Promise<Schema>;
@@ -743,11 +893,6 @@ declare class DocRouterOrg {
743
893
  valid: boolean;
744
894
  errors?: string[];
745
895
  }>;
746
- createFlow(params: Omit<CreateFlowParams, 'organizationId'>): Promise<Flow>;
747
- updateFlow(params: Omit<UpdateFlowParams, 'organizationId'>): Promise<Flow>;
748
- listFlows(params?: Omit<ListFlowsParams, 'organizationId'>): Promise<ListFlowsResponse>;
749
- getFlow(params: Omit<GetFlowParams, 'organizationId'>): Promise<Flow>;
750
- deleteFlow(params: Omit<DeleteFlowParams, 'organizationId'>): Promise<void>;
751
896
  getCustomerPortal(): Promise<PortalSessionResponse>;
752
897
  getSubscription(): Promise<SubscriptionResponse>;
753
898
  activateSubscription(): Promise<{
@@ -768,30 +913,12 @@ declare class DocRouterOrg {
768
913
  }): Promise<unknown>;
769
914
  getUsageRange(request: UsageRangeRequest): Promise<UsageRangeResponse>;
770
915
  createCheckoutSession(planId: string): Promise<PortalSessionResponse>;
771
- runLLMChat(request: {
772
- messages: Array<{
773
- role: 'system' | 'user' | 'assistant';
774
- content: string;
775
- }>;
776
- model?: string;
777
- temperature?: number;
778
- max_tokens?: number;
779
- stream?: boolean;
780
- }): Promise<unknown>;
781
- runLLMChatStream(request: {
782
- messages: Array<{
783
- role: 'system' | 'user' | 'assistant';
784
- content: string;
785
- }>;
786
- model?: string;
787
- temperature?: number;
788
- max_tokens?: number;
789
- stream?: boolean;
790
- }, onChunk: (chunk: unknown) => void, onError?: (error: Error) => void, abortSignal?: AbortSignal): Promise<void>;
916
+ runLLMChat(request: LLMChatRequest): Promise<LLMChatResponse>;
917
+ runLLMChatStream(request: LLMChatRequest, onChunk: (chunk: LLMChatStreamChunk | LLMChatStreamError) => void, onError?: (error: Error) => void, abortSignal?: AbortSignal): Promise<void>;
791
918
  /**
792
919
  * Get the current HTTP client (for advanced usage)
793
920
  */
794
921
  getHttpClient(): HttpClient;
795
922
  }
796
923
 
797
- export { type AWSConfig, type AcceptInvitationRequest, type AccessToken, type ApiError, type CreateFlowParams, type CreateFormParams, type CreateInvitationRequest, type CreateOrganizationRequest, type CreatePromptParams, type CreateSchemaParams, type CreateTagParams, type CreateTokenRequest, type CreditConfig, type CreditUpdateResponse, type DeleteDocumentParams, type DeleteFlowParams, type DeleteFormParams, type DeleteFormSubmissionParams, type DeleteLLMResultParams, type DeletePromptParams, type DeleteSchemaParams, type DeleteTagParams, DocRouterAccount, type DocRouterAccountConfig, type DocRouterConfig, DocRouterOrg, type DocRouterOrgConfig, type Document, type Flow, type Form, type FormSubmission, type GetDocumentParams, type GetDocumentResponse, type GetFlowParams, type GetFormParams, type GetFormSubmissionParams, type GetLLMResultParams, type GetLLMResultResponse, type GetOCRBlocksParams, type GetOCRMetadataParams, type GetOCRMetadataResponse, type GetOCRTextParams, type GetPromptParams, type GetSchemaParams, HttpClient, type InvitationResponse, type LLMChatMessage, type LLMChatRequest, type LLMChatResponse, type LLMChatStreamChunk, type LLMChatStreamError, type LLMModel, type ListAccessTokensResponse, type ListDocumentsParams, type ListDocumentsResponse, type ListFlowsParams, type ListFlowsResponse, type ListFormsParams, type ListFormsResponse, type ListInvitationsParams, type ListInvitationsResponse, type ListLLMModelsParams, type ListLLMModelsResponse, type ListLLMProvidersResponse, type ListOrganizationsResponse, type ListPromptsParams, type ListPromptsResponse, type ListSchemasParams, type ListSchemasResponse, type ListTagsParams, type ListTagsResponse, type ListUsersParams, type ListUsersResponse, type Organization, type OrganizationMember, type OrganizationType, type PortalSessionResponse, type Prompt, type RunLLMParams, type RunLLMResponse, type Schema, type SetLLMProviderConfigRequest, type SubmitFormParams, type SubscriptionResponse, type Tag, type UpdateDocumentParams, type UpdateFlowParams, type UpdateFormParams, type UpdateOrganizationRequest, type UpdatePromptParams, type UpdateSchemaParams, type UpdateTagParams, type UploadDocument, type UploadDocumentsParams, type UploadDocumentsResponse, type UploadedDocument, type UsageRangeRequest, type UsageRangeResponse, type UsageResponse, type User, type UserCreate, type UserResponse, type UserUpdate };
924
+ export { type AWSConfig, type AcceptInvitationRequest, type AccessToken, type ApiError, type CreateFormParams, type CreateInvitationRequest, type CreateOrganizationRequest, type CreatePromptParams, type CreateSchemaParams, type CreateTagParams, type CreateTokenRequest, type CreditConfig, type CreditUpdateResponse, type DeleteDocumentParams, type DeleteFormParams, type DeleteFormSubmissionParams, type DeleteLLMResultParams, type DeletePromptParams, type DeleteSchemaParams, type DeleteTagParams, DocRouterAccount, type DocRouterAccountConfig, type DocRouterConfig, DocRouterOrg, type DocRouterOrgConfig, type Document, type FieldMapping, type FieldMappingSource, type Form, type FormResponseFormat, type FormSubmission, type GetDocumentParams, type GetDocumentResponse, type GetFormParams, type GetFormSubmissionParams, type GetLLMResultParams, type GetLLMResultResponse, type GetOCRBlocksParams, type GetOCRMetadataParams, type GetOCRMetadataResponse, type GetOCRTextParams, type GetPromptParams, type GetSchemaParams, HttpClient, type InvitationResponse, type JsonValue, type LLMChatChoice, type LLMChatRequest, type LLMChatResponse, type LLMChatStreamChunk, type LLMChatStreamError, type LLMChatUsage, type LLMMessage, type LLMModel, type LLMProvider, type ListAccessTokensResponse, type ListDocumentsParams, type ListDocumentsResponse, type ListFormsParams, type ListFormsResponse, type ListInvitationsParams, type ListInvitationsResponse, type ListLLMModelsParams, type ListLLMModelsResponse, type ListLLMProvidersResponse, type ListOrganizationsResponse, type ListPromptsParams, type ListPromptsResponse, type ListSchemasParams, type ListSchemasResponse, type ListTagsParams, type ListTagsResponse, type ListUsersParams, type ListUsersResponse, type OCRBlock, type OCRGeometry, type Organization, type OrganizationMember, type OrganizationType, type PortalSessionResponse, type Prompt, type RunLLMParams, type RunLLMResponse, type Schema, type SchemaConfig, type SchemaProperty, type SchemaResponseFormat, type SetLLMProviderConfigRequest, type SubmitFormParams, type SubscriptionPlan, type SubscriptionResponse, type Tag, type TokenOrganizationResponse, type UpdateDocumentParams, type UpdateFormParams, type UpdateOrganizationRequest, type UpdatePromptParams, type UpdateSchemaParams, type UpdateTagParams, type UploadDocument, type UploadDocumentsParams, type UploadDocumentsResponse, type UploadedDocument, type UsageData, type UsageDataPoint, type UsageRangeRequest, type UsageRangeResponse, type UsageResponse, type User, type UserCreate, type UserUpdate };