@squidcloud/client 1.0.391 → 1.0.393

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.
Files changed (21) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/index.js +1 -1
  3. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +96 -41
  4. package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +5 -18
  5. package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +63 -3
  6. package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +56 -12
  7. package/dist/internal-common/src/public-types/api.public-types.d.ts +1 -10
  8. package/dist/internal-common/src/public-types/communication.public-types.d.ts +1 -1
  9. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +12 -0
  10. package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
  11. package/dist/internal-common/src/types/ai-agent.types.d.ts +4 -1
  12. package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +27 -12
  13. package/dist/internal-common/src/utils/global.utils.d.ts +1 -1
  14. package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +14 -4
  15. package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +11 -1
  16. package/dist/typescript-client/src/ai-client.d.ts +10 -15
  17. package/dist/typescript-client/src/{ai-knowledge-base.reference.d.ts → ai-knowledge-base/ai-knowledge-base-client-reference.d.ts} +12 -4
  18. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client.d.ts +28 -0
  19. package/dist/typescript-client/src/index.d.ts +2 -1
  20. package/dist/typescript-client/src/version.d.ts +1 -1
  21. package/package.json +5 -5
@@ -1,7 +1,8 @@
1
- import { AiAudioCreateSpeechModelName, AiAudioTranscriptionModelName, AiChatModelName, AiEmbeddingsModelName, AiImageModelName, AiProviderType, AiRerankProvider, AnthropicChatModelName, GeminiChatModelName, GrokChatModelName, OpenAiAudioCreateSpeechModelName, OpenAiAudioTranscriptionModelName, OpenAiChatModelName, OpenAiCreateSpeechFormat, OpenAiReasoningChatModelName } from './ai-common.public-types';
1
+ import { AiAudioCreateSpeechModelName, AiAudioTranscriptionModelName, AiChatModelName, AiEmbeddingsModelName, AiImageModelName, AiProviderType, AiRerankProvider, AnthropicChatModelName, GeminiChatModelName, GrokChatModelName, OpenAiAudioCreateSpeechModelName, OpenAiAudioTranscriptionModelName, OpenAiChatModelName, OpenAiCreateSpeechFormat } from './ai-common.public-types';
2
2
  import { AiContextMetadata, AiContextMetadataFilter, AiKnowledgeBaseContextType, AiRagType } from './ai-knowledge-base.public-types';
3
3
  import { AiFunctionId, AiFunctionIdWithContext, UserAiChatModelName } from './backend.public-types';
4
4
  import { AiAgentId, AiContextId, AiKnowledgeBaseId, IntegrationId } from './communication.public-types';
5
+ import { DocumentExtractionMethod } from './extraction.public-types';
5
6
  import { IntegrationType } from './integration.public-types';
6
7
  import { JobId } from './job.public-types';
7
8
  import { SecretKey } from './secret.public-types';
@@ -109,7 +110,7 @@ export interface OpenAiCreateSpeechOptions extends BaseAiAudioCreateSpeechOption
109
110
  */
110
111
  export interface FluxOptions extends BaseAiGenerateImageOptions {
111
112
  /** Specifies the Flux Pro 1.1 model for image generation. */
112
- modelName: 'flux-pro-1.1';
113
+ modelName: 'flux-pro-1.1' | 'flux-kontext-pro';
113
114
  /** The width of the generated image, must be a multiple of 32, min 256, max 1440; defaults to 1024. */
114
115
  width?: number;
115
116
  /** The height of the generated image, must be a multiple of 32, min 256, max 1440; defaults to 768. */
@@ -151,17 +152,27 @@ export type AiAgentResponseFormat = 'text' | 'json_object';
151
152
  /**
152
153
  * @category AI
153
154
  */
154
- export type AiFileUrlType = 'image';
155
+ export type AiFileUrlType = 'image' | 'document';
155
156
  /**
156
157
  * Represents a URL reference to an AI-processed file, such as an image.
157
158
  * @category AI
158
159
  */
159
160
  export interface AiFileUrl {
161
+ /** The unique identifier for the file URL for the current request. */
162
+ id: string;
160
163
  /** The type of file referenced by the URL (e.g., 'image'). */
161
164
  type: AiFileUrlType;
165
+ /** The purpose of the file, indicating how it will be used in AI processing. */
166
+ purpose: AiFilePurpose;
162
167
  /** The URL pointing to the file. */
163
168
  url: string;
169
+ /** An optional description of the file's content or purpose - sent to the AI. */
170
+ description?: string;
171
+ /** The file name, can be used in the prompt to reference the file. */
172
+ fileName?: string;
164
173
  }
174
+ /** The purpose of the AI file, used to determine how the file should be processed or utilized. */
175
+ export type AiFilePurpose = 'context' | 'tools';
165
176
  /**
166
177
  * Metadata for an AI agent connected to an integration.
167
178
  * @category AI
@@ -247,20 +258,16 @@ export interface AiAgentMemoryOptions {
247
258
  * @category AI
248
259
  */
249
260
  export interface BaseAiChatOptions {
250
- /** The maximum number of tokens to use when making the request to the AI model. Defaults to the max tokens the model can accept. */
251
- maxTokens?: number;
252
261
  /**
253
- * A unique chat ID, if the same chat ID is used again and history is not disabled, it will continue the conversation.
254
- * @deprecated use 'memoryOptions` instead.
262
+ * The maximum number of input tokens that Squid can use when making the request to the AI model.
263
+ * Defaults to the max tokens the model can accept.
255
264
  */
256
- chatId?: string;
265
+ maxTokens?: number;
257
266
  /**
258
- * Disables history for the agent, so each question is answered as
259
- * if it were the first question in the conversation.
260
- * Default to false.
261
- * @deprecated use 'memoryOptions` instead.
267
+ * The maximum number of tokens the model should output.
268
+ * Passed directly to the AI model. Can be used to control the output verbosity.
262
269
  */
263
- disableHistory?: boolean;
270
+ maxOutputTokens?: number;
264
271
  /** The context ID to use for the request. If not provided, the agent's default context will be used. */
265
272
  memoryOptions?: AiAgentMemoryOptions;
266
273
  /** Whether to disable the whole context for the request. Default to false. */
@@ -284,8 +291,12 @@ export interface BaseAiChatOptions {
284
291
  functions?: Array<AiFunctionId | AiFunctionIdWithContext>;
285
292
  /** Instructions to include with the prompt. */
286
293
  instructions?: string;
287
- /** A set of filters that will limit the context the AI can access. */
294
+ /** A set of filters that will limit the context the AI can access.
295
+ * @deprecated use `contextMetadataFilterForKnowledgeBase` instead.
296
+ */
288
297
  contextMetadataFilter?: AiContextMetadataFilter;
298
+ /** A set of filters that will limit the context the AI can access. */
299
+ contextMetadataFilterForKnowledgeBase?: Record<AiKnowledgeBaseId, AiContextMetadataFilter>;
289
300
  /** The options to use for the response in voice. */
290
301
  voiceOptions?: AiAudioCreateSpeechOptions;
291
302
  /** List of connected AI agents can be called by the current agent. Overrides the stored value. */
@@ -311,6 +322,22 @@ export interface BaseAiChatOptions {
311
322
  * connected agents, connected integrations, or functions.
312
323
  */
313
324
  executionPlanOptions?: AiAgentExecutionPlanOptions;
325
+ /** An array of file URLs to include in the chat context. */
326
+ fileUrls?: Array<AiFileUrl>;
327
+ /**
328
+ * The level of reasoning effort to apply; defaults to model-specific value.
329
+ * Effective only for models with reasoning.
330
+ */
331
+ reasoningEffort?: AiReasoningEffort;
332
+ /**
333
+ * Controls response length and detail level.
334
+ * Use `low` for brief responses, `medium` for balanced detail, or `high` for comprehensive explanations.
335
+ * Default: 'medium'.
336
+ *
337
+ * Note: this parameter is only supported by OpenAI plain text responses and is ignored for others.
338
+ * For other providers ask about verbosity in prompt and using `maxOutputTokens`.
339
+ */
340
+ verbosity?: AiVerbosityLevel;
314
341
  }
315
342
  /**
316
343
  * Chat options specific to Gemini models, extending base options.
@@ -337,23 +364,18 @@ export interface GrokChatOptions extends BaseAiChatOptions {
337
364
  export interface OpenAiChatOptions extends BaseAiChatOptions {
338
365
  /** The OpenAI model to use for the chat. */
339
366
  model?: OpenAiChatModelName;
340
- /** An array of file URLs to include in the chat context. */
341
- fileUrls?: Array<AiFileUrl>;
342
367
  }
343
368
  /**
369
+ * AI reasoning effort: Unsupported values are mapped to the closest supported option.
344
370
  * @category AI
345
371
  */
346
- export type AiReasoningEffort = 'low' | 'medium' | 'high';
372
+ export type AiReasoningEffort = 'minimal' | 'low' | 'medium' | 'high';
347
373
  /**
348
- * Chat options for OpenAI reasoning models, extending OpenAI options.
349
- * @category AI
374
+ * Controls response length and detail level.
375
+ * Use `low` for brief responses,`medium` for balanced detail, or `high` for comprehensive explanations.
376
+ * Default: 'medium'.
350
377
  */
351
- export interface OpenAiReasoningChatOptions extends OpenAiChatOptions {
352
- /** The OpenAI reasoning model to use for the chat. */
353
- model?: OpenAiReasoningChatModelName;
354
- /** The level of reasoning effort to apply; defaults to model-specific value. */
355
- reasoningEffort?: AiReasoningEffort;
356
- }
378
+ export type AiVerbosityLevel = 'low' | 'medium' | 'high';
357
379
  /**
358
380
  * Chat options specific to Anthropic models, extending base options.
359
381
  * @category AI
@@ -361,20 +383,18 @@ export interface OpenAiReasoningChatOptions extends OpenAiChatOptions {
361
383
  export interface AnthropicChatOptions extends BaseAiChatOptions {
362
384
  /** The Anthropic model to use for the chat. */
363
385
  model?: AnthropicChatModelName;
364
- /** The level of reasoning effort to apply. Defaults to no reasoning. */
365
- reasoningEffort?: AiReasoningEffort;
366
386
  }
367
387
  /**
368
388
  * The generic options type. When no generic is provided,
369
389
  * the type is inferred from the provided overrideModel (or falls back to BaseAiAgentChatOptions).
370
390
  * @category AI
371
391
  */
372
- export type AiChatOptions<T extends AiChatModelName | undefined = undefined> = T extends undefined ? BaseAiChatOptions | GeminiChatOptions | OpenAiReasoningChatOptions | OpenAiChatOptions | AnthropicChatOptions : T extends GeminiChatModelName ? GeminiChatOptions : T extends OpenAiReasoningChatModelName ? OpenAiReasoningChatOptions : T extends OpenAiChatModelName ? OpenAiChatOptions : T extends AnthropicChatModelName ? AnthropicChatOptions : T extends GrokChatModelName ? GrokChatOptions : never;
392
+ export type AiChatOptions<T extends AiChatModelName | undefined = undefined> = T extends undefined ? BaseAiChatOptions | GeminiChatOptions | OpenAiChatOptions | AnthropicChatOptions : T extends GeminiChatModelName ? GeminiChatOptions : T extends OpenAiChatModelName ? OpenAiChatOptions : T extends AnthropicChatModelName ? AnthropicChatOptions : T extends GrokChatModelName ? GrokChatOptions : never;
373
393
  /**
374
394
  * @category AI
375
395
  */
376
396
  export type AllAiAgentChatOptions = {
377
- [K in keyof BaseAiChatOptions | keyof GeminiChatOptions | keyof GrokChatOptions | keyof OpenAiReasoningChatOptions | keyof OpenAiChatOptions | keyof AnthropicChatOptions]?: (K extends keyof BaseAiChatOptions ? BaseAiChatOptions[K] : never) | (K extends keyof GeminiChatOptions ? GeminiChatOptions[K] : never) | (K extends keyof GrokChatOptions ? GrokChatOptions[K] : never) | (K extends keyof OpenAiReasoningChatOptions ? OpenAiReasoningChatOptions[K] : never) | (K extends keyof OpenAiChatOptions ? OpenAiChatOptions[K] : never) | (K extends keyof AnthropicChatOptions ? AnthropicChatOptions[K] : never);
397
+ [K in keyof BaseAiChatOptions | keyof GeminiChatOptions | keyof GrokChatOptions | keyof OpenAiChatOptions | keyof AnthropicChatOptions]?: (K extends keyof BaseAiChatOptions ? BaseAiChatOptions[K] : never) | (K extends keyof GeminiChatOptions ? GeminiChatOptions[K] : never) | (K extends keyof GrokChatOptions ? GrokChatOptions[K] : never) | (K extends keyof OpenAiChatOptions ? OpenAiChatOptions[K] : never) | (K extends keyof AnthropicChatOptions ? AnthropicChatOptions[K] : never);
378
398
  };
379
399
  /**
380
400
  * A definition of an AI agent with its properties and default chat options.
@@ -424,8 +444,8 @@ export interface AiStatusMessage {
424
444
  tags?: Record<string, any>;
425
445
  }
426
446
  /**
427
- * Name of the tag that contains ID of the parent message .
428
- * When the tag is present the current message should be considered in the context of the parent message.
447
+ * Name of the tag that contains ID of the parent message.
448
+ * When the tag is present, the current message should be considered in the context of the parent message.
429
449
  * Example: the message can contain a function call result.
430
450
  */
431
451
  export declare const AI_STATUS_MESSAGE_PARENT_MESSAGE_ID_TAG = "parent";
@@ -438,8 +458,10 @@ export declare const AI_STATUS_MESSAGE_RESULT_TAG = "result";
438
458
  export interface AiSearchOptions {
439
459
  /** The prompt to search for */
440
460
  prompt: string;
441
- /** A set of filters that will limit the context the AI can access */
461
+ /** DEPRECATED: A set of filters that will limit the context the AI can access. */
442
462
  contextMetadataFilter?: AiContextMetadataFilter;
463
+ /** A set of filters that will limit the context the AI can access. */
464
+ contextMetadataFilterForKnowledgeBase?: Record<AiKnowledgeBaseId, AiContextMetadataFilter>;
443
465
  /** The maximum number of results to return */
444
466
  limit?: number;
445
467
  /** Which provider's reranker to use for reranking the context. Defaults to 'cohere'. */
@@ -496,27 +518,31 @@ interface BaseContextRequest {
496
518
  * Status of an individual context item after successfully upserting it.
497
519
  * @category AI
498
520
  */
499
- export interface UpsertContextStatusSuccess {
500
- /** Whether the context upsert was successful or got an error. */
501
- status: 'success';
521
+ export interface BaseUpsertContextStatus {
522
+ /** Whether the context upsert was successful, otherwise, what occurred. */
523
+ status: 'success' | 'error';
502
524
  /** The unique identifier of the context item. */
503
525
  contextId: string;
504
526
  /** The name of the context item, typically the title or filename. */
505
527
  name: string;
506
528
  }
529
+ /**
530
+ * Status of an individual context item after successfully upserting it.
531
+ * @category AI
532
+ */
533
+ export interface UpsertContextStatusSuccess extends BaseUpsertContextStatus {
534
+ /** Whether the context upsert was successful or got an error. */
535
+ status: 'success';
536
+ }
507
537
  /**
508
538
  * Status of an individual context item after it failed to upsert.
509
539
  *
510
540
  * Contains the error message for why the upsert failed.
511
541
  * @category AI
512
542
  */
513
- export interface UpsertContextStatusError {
543
+ export interface UpsertContextStatusError extends BaseUpsertContextStatus {
514
544
  /** Whether the context upsert was successful or got an error. */
515
545
  status: 'error';
516
- /** The unique identifier of the context item. */
517
- contextId: string;
518
- /** The name of the context item, typically the title or filename. */
519
- name: string;
520
546
  /** Reason the upsert failed. */
521
547
  errorMessage: string;
522
548
  }
@@ -525,12 +551,20 @@ export interface UpsertContextStatusError {
525
551
  * @category AI
526
552
  */
527
553
  export type UpsertContextStatus = UpsertContextStatusSuccess | UpsertContextStatusError;
554
+ /**
555
+ * Response structure for upserting context.
556
+ * @category AI
557
+ */
558
+ export interface UpsertAgentContextResponse {
559
+ /** Upsert failure that occurred for the items sent in the request. */
560
+ failure?: UpsertContextStatusError;
561
+ }
528
562
  /**
529
563
  * Response structure for upserting contexts.
530
564
  * @category AI
531
565
  */
532
566
  export interface UpsertAgentContextsResponse {
533
- /** List of the upsert status of each item sent in the request. */
567
+ /** List of the upsert failures that occurred for the items sent in the request. */
534
568
  failures: Array<UpsertContextStatusError>;
535
569
  }
536
570
  /**
@@ -574,6 +608,16 @@ export interface FileContextRequest extends BaseContextRequest {
574
608
  extractionModel?: AiChatModelName;
575
609
  /** General options for how to process the file. */
576
610
  options?: AiContextFileOptions;
611
+ /** The preferred method for extracting data from the document. */
612
+ preferredExtractionMethod?: DocumentExtractionMethod;
613
+ /**
614
+ * Whether Squid keeps or discards the original file.
615
+ *
616
+ * Keeping the original file allows reprocessing and the ability for the user to download it later.
617
+ *
618
+ * Defaults to false.
619
+ */
620
+ discardOriginalFile?: boolean;
577
621
  }
578
622
  /**
579
623
  * Base options for how to deal with the content being upserted.
@@ -614,6 +658,8 @@ export interface AiTranscribeAndAskResponse {
614
658
  responseString: string;
615
659
  /** The transcribed text from the audio input. */
616
660
  transcribedPrompt: string;
661
+ /** The annotations associated with the AI response, if any. */
662
+ annotations?: Record<string, AiAnnotation>;
617
663
  }
618
664
  /** Per application AI settings. */
619
665
  export interface ApplicationAiSettings {
@@ -640,4 +686,13 @@ export interface UserAiAskResponse {
640
686
  /** The number of output tokens generated by the AI agent. */
641
687
  outputTokens?: number;
642
688
  }
689
+ /** Represents an annotation in the AI response. */
690
+ export type AiAnnotation = AiFileAnnotation;
691
+ /** Represents an annotation for a file in the AI response. */
692
+ export interface AiFileAnnotation {
693
+ /** The type of the annotation, always 'file'. */
694
+ type: 'file';
695
+ /** The AI file with the URL to the file */
696
+ aiFileUrl: AiFileUrl;
697
+ }
643
698
  export {};
@@ -16,18 +16,9 @@ export declare const AI_PROVIDER_TYPES: readonly ["anthropic", "flux", "gemini",
16
16
  */
17
17
  export type AiProviderType = (typeof AI_PROVIDER_TYPES)[number];
18
18
  /**
19
- * The supported OpenAI models.
20
19
  * @category AI
21
20
  */
22
- export declare const OPENAI_O1_CHAT_MODEL_NAMES: readonly ["o1"];
23
- /**
24
- * @category AI
25
- */
26
- export declare const OPENAI_REASONING_CHAT_MODEL_NAMES: readonly ["o1", "o3", "o3-mini", "o4-mini"];
27
- /**
28
- * @category AI
29
- */
30
- export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-4o", "gpt-4o-mini", "gpt-4.1-nano", "gpt-4.1-mini", "gpt-4.1", "o1", "o3", "o3-mini", "o4-mini"];
21
+ export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["o1", "o3", "o3-mini", "o4-mini", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4o", "gpt-4o-mini"];
31
22
  /**
32
23
  * @category AI
33
24
  */
@@ -44,12 +35,12 @@ export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-3", "grok-3-fast", "
44
35
  /**
45
36
  * @category AI
46
37
  */
47
- export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-3-7-sonnet-latest", "claude-opus-4-20250514", "claude-sonnet-4-20250514"];
38
+ export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-3-7-sonnet-latest", "claude-opus-4-20250514", "claude-opus-4-1-20250805", "claude-sonnet-4-20250514"];
48
39
  /**
49
40
  * The supported AI model names.
50
41
  * @category AI
51
42
  */
52
- export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-4o", "gpt-4o-mini", "gpt-4.1-nano", "gpt-4.1-mini", "gpt-4.1", "o1", "o3", "o3-mini", "o4-mini", "claude-3-7-sonnet-latest", "claude-opus-4-20250514", "claude-sonnet-4-20250514", "gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite", "grok-3", "grok-3-fast", "grok-3-mini", "grok-3-mini-fast", "grok-4"];
43
+ export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["o1", "o3", "o3-mini", "o4-mini", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4o", "gpt-4o-mini", "claude-3-7-sonnet-latest", "claude-opus-4-20250514", "claude-opus-4-1-20250805", "claude-sonnet-4-20250514", "gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite", "grok-3", "grok-3-fast", "grok-3-mini", "grok-3-mini-fast", "grok-4"];
53
44
  /**
54
45
  * Check if the given model name is a global AI chat model name.
55
46
  */
@@ -90,11 +81,11 @@ export declare const STABLE_DIFFUSION_MODEL_NAMES: readonly ["stable-diffusion-c
90
81
  /**
91
82
  * @category AI
92
83
  */
93
- export declare const FLUX_MODEL_NAMES: readonly ["flux-pro-1.1"];
84
+ export declare const FLUX_MODEL_NAMES: readonly ["flux-pro-1.1", "flux-kontext-pro"];
94
85
  /**
95
86
  * @category AI
96
87
  */
97
- export declare const AI_IMAGE_MODEL_NAMES: readonly ["dall-e-3", "stable-diffusion-core", "flux-pro-1.1"];
88
+ export declare const AI_IMAGE_MODEL_NAMES: readonly ["dall-e-3", "stable-diffusion-core", "flux-pro-1.1", "flux-kontext-pro"];
98
89
  /**
99
90
  * @category AI
100
91
  */
@@ -127,10 +118,6 @@ export type AiVoyageEmbeddingsModelName = (typeof VOYAGE_EMBEDDING_MODEL_NAMES)[
127
118
  * @category AI
128
119
  */
129
120
  export type OpenAiChatModelName = (typeof OPENAI_CHAT_MODEL_NAMES)[number];
130
- /**
131
- * @category AI
132
- */
133
- export type OpenAiReasoningChatModelName = (typeof OPENAI_REASONING_CHAT_MODEL_NAMES)[number];
134
121
  /**
135
122
  * @category AI
136
123
  */
@@ -1,6 +1,7 @@
1
1
  import { UpsertContextStatusError } from './ai-agent.public-types';
2
2
  import { AiChatModelName, AiEmbeddingsModelName, AiRerankProvider } from './ai-common.public-types';
3
3
  import { AiKnowledgeBaseId } from './communication.public-types';
4
+ import { DocumentExtractionMethod } from './extraction.public-types';
4
5
  /**
5
6
  * Represents an AI knowledge base that can be attached to an AI agent.
6
7
  * @category AI
@@ -16,6 +17,8 @@ export interface AiKnowledgeBase {
16
17
  metadataFields: Array<AiKnowledgeBaseMetadataField>;
17
18
  /** The embedding model name that should be used for this knowledge base.*/
18
19
  embeddingModel: AiEmbeddingsModelName;
20
+ /** The model name that should be used when asking questions of this knowledge base. */
21
+ chatModel: AiChatModelName;
19
22
  }
20
23
  /**
21
24
  * Represents a field in an AI knowledge base metadata.
@@ -102,6 +105,26 @@ export interface AiContextMetadataOrFilter {
102
105
  /** An array of filters where at least one must be true for the condition to pass. */
103
106
  $or: AiContextMetadataFilter[];
104
107
  }
108
+ /**
109
+ * The options for the AI knowledgebase search method.
110
+ * @category AI
111
+ */
112
+ export interface AllAiKnowledgeBaseChatOptions {
113
+ /** A set of filters that will limit the context the AI can access. */
114
+ contextMetadataFilter?: AiContextMetadataFilter;
115
+ /** Whether to include references from the source context in the response. Default to false. */
116
+ includeReference?: boolean;
117
+ /** Include metadata in the context */
118
+ includeMetadata?: boolean;
119
+ /** Which provider's reranker to use for reranking the context. Defaults to 'cohere'. */
120
+ rerankProvider?: AiRerankProvider;
121
+ /** The maximum number of results to return */
122
+ limit?: number;
123
+ /** How many chunks to look over. Defaults to 100 */
124
+ chunkLimit?: number;
125
+ /** Which chat model to use when asking the question */
126
+ chatModel?: AiChatModelName;
127
+ }
105
128
  /**
106
129
  * @category AI
107
130
  */
@@ -186,6 +209,16 @@ export interface AiKnowledgeBaseFileContextRequest extends BaseAiKnowledgeBaseCo
186
209
  imageExtractionModel?: AiChatModelName;
187
210
  /** General options for how to process the file. */
188
211
  options?: AiKnowledgeBaseContextFileOptions;
212
+ /** The preferred method for extracting data from the document. */
213
+ preferredExtractionMethod?: DocumentExtractionMethod;
214
+ /**
215
+ * Whether Squid keeps or discards the original file.
216
+ *
217
+ * Keeping the original file allows reprocessing and the ability for the user to download it later.
218
+ *
219
+ * Defaults to false.
220
+ */
221
+ discardOriginalFile?: boolean;
189
222
  }
190
223
  /**
191
224
  * @category AI
@@ -206,20 +239,20 @@ export type BaseAiKnowledgeBaseContextOptions = {
206
239
  chunkOverlap?: number;
207
240
  };
208
241
  /**
209
- * The options for the AI agent search method.
242
+ * Specific options for the AI knowledgebase search method.
210
243
  * @category AI
211
244
  */
212
245
  export interface AiKnowledgeBaseSearchOptions {
213
246
  /** The prompt to search for */
214
247
  prompt: string;
215
- /** A set of filters that will limit the context the AI can access */
216
- contextMetadataFilter?: AiContextMetadataFilter;
217
248
  /** The maximum number of results to return */
218
249
  limit?: number;
219
250
  /** Which provider's reranker to use for reranking the context. Defaults to 'cohere'. */
220
251
  rerankProvider?: AiRerankProvider;
221
252
  /** How many chunks to look over. Defaults to 100 */
222
253
  chunkLimit?: number;
254
+ /** Which chat model to use when asking the question */
255
+ chatModel?: string;
223
256
  }
224
257
  /**
225
258
  * A single chunk of data returned from an AI search operation.
@@ -237,8 +270,35 @@ export interface AiKnowledgeBaseSearchResultChunk {
237
270
  * Response structure for upserting context for an AiKnowledgeBase
238
271
  * @category AI
239
272
  */
273
+ export interface UpsertKnowledgeBaseContextResponse {
274
+ /** List of the upsert status of each item sent in the request. */
275
+ failure?: UpsertContextStatusError;
276
+ }
277
+ /**
278
+ * Response structure for upserting contexts for an AiKnowledgeBase
279
+ * @category AI
280
+ */
240
281
  export interface UpsertKnowledgeBaseContextsResponse {
241
282
  /** List of the upsert status of each item sent in the request. */
242
283
  failures: Array<UpsertContextStatusError>;
243
284
  }
285
+ /**
286
+ * Request structure for searching an AiKnowledgeBase
287
+ * @category AI
288
+ */
289
+ export interface AiKnowledgeBaseSearchRequest {
290
+ /** The id of the AiKnowledgeBase */
291
+ knowledgeBaseId: string;
292
+ /** The user prompt to search on */
293
+ prompt: string;
294
+ /** The search options for this search */
295
+ options: AiKnowledgeBaseSearchOptions;
296
+ }
297
+ /**
298
+ * KnowledgeBase with optional chatModel param, used during upsert
299
+ * @category AI
300
+ */
301
+ export type AiKnowledgeBaseWithOptionalChatModel = Omit<AiKnowledgeBase, 'chatModel'> & {
302
+ chatModel?: AiKnowledgeBase['chatModel'];
303
+ };
244
304
  export {};
@@ -1,4 +1,4 @@
1
- import { AiChatModelName } from './ai-common.public-types';
1
+ import { AiChatOptions } from './ai-agent.public-types';
2
2
  import { ApiOptions } from './api-client.public-types';
3
3
  import { IntegrationId } from './communication.public-types';
4
4
  /**
@@ -20,21 +20,65 @@ export interface ExecuteAiQueryRequest {
20
20
  * @category AI
21
21
  */
22
22
  export interface ExecuteAiQueryOptions {
23
- /** Custom instructions to modify AI query behavior. */
23
+ /**
24
+ * Custom instructions to modify AI query generation behavior.
25
+ * Used for all stages unless there is a per-stage override.
26
+ */
24
27
  instructions?: string;
25
- /** List of collections to use in the AI query. */
26
- collectionsToUse?: Array<string>;
27
28
  /** Whether to enable raw results output. */
28
29
  enableRawResults?: boolean;
29
- /** Whether to enable code interpreter for query execution. */
30
- enableCodeInterpreter?: boolean;
31
- /** Specific AI model override for the query execution. */
32
- overrideModel?: AiChatModelName;
33
30
  /** Whether to generate a step-by-step walkthrough for the response. */
34
31
  generateWalkthrough?: boolean;
35
- /** The number of allowed retries in case of errors during query execution. Defaults to 2. */
32
+ /** Options for the collection selection stage. */
33
+ selectCollectionsOptions?: AiQuerySelectCollectionsOptions;
34
+ /** Options for the query generation stage. */
35
+ generateQueryOptions?: AiQueryGenerateQueryOptions;
36
+ /** Options specify how to query result should be analyzed (processed) before returning it to user. */
37
+ analyzeResultsOptions?: AiQueryAnalyzeResultsOptions;
38
+ }
39
+ /**
40
+ * Options for the collection selection stage.
41
+ *
42
+ * At this stage Squid selects a subset of collections that will be used by the later stage to generate the real query.
43
+ * It is recommended that the set of collections selected by this stage be broad enough so the query generation stage
44
+ * has a good view of the database.
45
+ */
46
+ export interface AiQuerySelectCollectionsOptions {
47
+ /**
48
+ * Limits collections to be used in the query only to these collections.
49
+ * When not provided, all collections are used.
50
+ */
51
+ collectionsToUse?: string[];
52
+ /** Defines the stage algorithm. Default: 'auto'. */
53
+ runMode?: AiQueryCollectionsSelectionRunMode;
54
+ /** Used to customize AI agent behavior used by the stage. */
55
+ aiOptions?: AiChatOptions;
56
+ }
57
+ /**
58
+ * Defines the stage behavior:
59
+ * - 'default' - Squid will decide if to run the collection selection algorithm or not.
60
+ * - 'force' - Collection selection algorithm is run always, even if collectionsToUse are provided.
61
+ * - 'disable' - The stage is disabled. The whole schema (or collectionsToUse) will be passed to the next step.
62
+ */
63
+ export type AiQueryCollectionsSelectionRunMode = 'default' | 'force' | 'disable';
64
+ /**
65
+ * Options for the query generation stage.
66
+ *
67
+ * At this stage Squid generates the database native query based on the user prompt and a set of collections selected
68
+ * in the previous stage. */
69
+ export interface AiQueryGenerateQueryOptions {
70
+ /** Customizes AI agent behavior used by the stage. */
71
+ aiOptions?: AiChatOptions;
72
+ /** Number of retries due to errors in a generated AI query. Default: 2. */
36
73
  maxErrorCorrections?: number;
37
74
  }
75
+ /** Options for the query result analysis. */
76
+ export interface AiQueryAnalyzeResultsOptions {
77
+ /** Enables or disables code interpreter mode. Default: 'false'. */
78
+ enableCodeInterpreter?: boolean;
79
+ /** Customizes AI agent behavior used by the stage. */
80
+ aiOptions?: AiChatOptions;
81
+ }
38
82
  /**
39
83
  * Response from an AI query execution.
40
84
  * Contains the generated answer, optional explanation, and executed query details.
@@ -61,7 +105,7 @@ export interface ExecuteAiQueryResponse {
61
105
  export interface ExecutedQuery {
62
106
  /** Text of the executed query. */
63
107
  query: string;
64
- /** The markdown type of the result (sql, mongo, etc.). */
108
+ /** The Markdown type of the result (sql, mongo, etc.). */
65
109
  markdownType: string;
66
110
  /** URL to access raw results from the query execution. */
67
111
  rawResultsUrl?: string;
@@ -89,10 +133,10 @@ export interface AiApiResult {
89
133
  /** ID of the executed API endpoint. */
90
134
  endpointId: string;
91
135
  /** Name of the executed API endpoint. */
92
- responseBody: string;
136
+ responseBody: string | object;
93
137
  /** Status code of the executed API request. */
94
138
  responseStatusCode: number;
95
- /** Request body of the executed API request. */
139
+ /** Request's body of the executed API request. */
96
140
  requestBody: any;
97
141
  /** Request options of the executed API request. */
98
142
  requestOptions: ApiOptions;
@@ -23,7 +23,7 @@ export interface ApiRequestField {
23
23
  required?: boolean;
24
24
  }
25
25
  /** The options for calling an API. */
26
- export interface CallApiOptions {
26
+ export interface InternalCallApiOptions {
27
27
  /** If true, the response will be returned as-is without any processing. */
28
28
  nativeResponse?: boolean;
29
29
  /**
@@ -32,15 +32,6 @@ export interface CallApiOptions {
32
32
  */
33
33
  originOverride?: string;
34
34
  }
35
- /** A native API call response. */
36
- export interface NativeApiCallResponse<BodyType = unknown> {
37
- /** The response body, typed according to the expected content. */
38
- body: BodyType;
39
- /** A record of HTTP headers returned in the response. */
40
- headers: Record<string, string>;
41
- /** The HTTP status code of the response. */
42
- status: number;
43
- }
44
35
  /** Describes a field included in an API response, optionally including the field path and a description. */
45
36
  export interface ApiResponseField {
46
37
  /** The location of the field in the API response (e.g., header, body). */
@@ -16,7 +16,7 @@ export type SquidDocId = string;
16
16
  export type ClientRequestId = string;
17
17
  /** ID of AI agent. Also known as AI profile id. */
18
18
  export type AiAgentId = string;
19
- /** ID of AI Knowledge Base */
19
+ /** App-level ID of AI Knowledge Base */
20
20
  export type AiKnowledgeBaseId = string;
21
21
  /**
22
22
  * The built-in agent id. Cannot be customized.
@@ -22,6 +22,14 @@ export interface ExtractDataFromDocumentOptions {
22
22
  * The preferred method for extracting data from the document.
23
23
  */
24
24
  preferredExtractionMethod?: DocumentExtractionMethod;
25
+ /**
26
+ * Whether Squid keeps or discards the original file.
27
+ *
28
+ * Keeping the original file allows reprocessing and the ability for the user to download it later.
29
+ *
30
+ * Defaults to false.
31
+ */
32
+ discardOriginalFile?: boolean;
25
33
  }
26
34
  /**
27
35
  * Request payload for extracting data from a document via URL.
@@ -91,6 +99,10 @@ export interface ExtractDataFromDocumentResponse {
91
99
  * Array of pages containing extracted data.
92
100
  */
93
101
  pages: Array<ExtractDataFromDocumentPage>;
102
+ /**
103
+ * Path to the original file in cloud storage, if applicable.
104
+ */
105
+ longTermStoragePath?: string;
94
106
  }
95
107
  /**
96
108
  * Create PDF request type.
@@ -1,6 +1,6 @@
1
1
  import { IntegrationId } from './communication.public-types';
2
2
  /** List of all integration types supported by Squid. */
3
- export declare const INTEGRATION_TYPES: readonly ["active_directory", "ai_agents", "ai_chatbot", "algolia", "alloydb", "api", "auth0", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "built_in_db", "built_in_gcs", "built_in_queue", "built_in_s3", "cassandra", "clickhouse", "cloudsql", "cockroach", "cognito", "confluence", "confluent", "datadog", "db2", "descope", "documentdb", "dynamodb", "elasticsearch", "firebase_auth", "firestore", "gcs", "google_docs", "google_drive", "graphql", "hubspot", "jira", "jwt_hmac", "jwt_rsa", "kafka", "linear", "mariadb", "monday", "mongo", "mssql", "databricks", "mysql", "newrelic", "okta", "onedrive", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce_crm", "sap_hana", "sentry", "servicenow", "snowflake", "spanner", "xata", "zendesk", "mail", "slack", "mcp", "a2a"];
3
+ export declare const INTEGRATION_TYPES: readonly ["active_directory", "ai_agents", "ai_knowledgebases", "ai_chatbot", "algolia", "alloydb", "api", "auth0", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "built_in_db", "built_in_gcs", "built_in_queue", "built_in_s3", "cassandra", "clickhouse", "cloudsql", "cockroach", "cognito", "confluence", "confluent", "datadog", "db2", "descope", "documentdb", "dynamodb", "elasticsearch", "firebase_auth", "firestore", "gcs", "google_docs", "google_drive", "graphql", "hubspot", "jira", "jwt_hmac", "jwt_rsa", "kafka", "linear", "mariadb", "monday", "mongo", "mssql", "databricks", "mysql", "newrelic", "okta", "onedrive", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce_crm", "sap_hana", "sentry", "servicenow", "snowflake", "spanner", "xata", "zendesk", "mail", "slack", "mcp", "a2a"];
4
4
  /**
5
5
  * @category Database
6
6
  */