@squidcloud/client 1.0.363 → 1.0.364

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.
@@ -128,6 +128,10 @@ export type OpenAiReasoningChatModelName = (typeof OPENAI_REASONING_CHAT_MODEL_N
128
128
  * @category AI
129
129
  */
130
130
  export type GeminiChatModelName = (typeof GEMINI_CHAT_MODEL_NAMES)[number];
131
+ /**
132
+ * @category AI
133
+ */
134
+ export type SquidAiModelName = (typeof SQUID_AI_MODEL_NAMES)[number];
131
135
  /**
132
136
  * @category AI
133
137
  */
@@ -392,7 +396,7 @@ export interface AiChatPromptQuotas {
392
396
  * The base AI agent chat options, should not be used directly.
393
397
  * @category AI
394
398
  */
395
- export interface BaseAiAgentChatOptions {
399
+ export interface BaseAiChatOptions {
396
400
  /** The maximum number of tokens to use when making the request to the AI model. Defaults to the max tokens the model can accept. */
397
401
  maxTokens?: number;
398
402
  /** A unique chat ID, if the same chat ID is used again and history is not disabled, it will continue the conversation. */
@@ -447,7 +451,7 @@ export interface BaseAiAgentChatOptions {
447
451
  * Chat options specific to Gemini models, extending base options.
448
452
  * @category AI
449
453
  */
450
- export interface GeminiChatOptions extends BaseAiAgentChatOptions {
454
+ export interface GeminiChatOptions extends BaseAiChatOptions {
451
455
  /** The Gemini model to use for the chat. */
452
456
  model?: GeminiChatModelName;
453
457
  /** Enables grounding with web search for more informed responses; defaults to false. */
@@ -457,7 +461,7 @@ export interface GeminiChatOptions extends BaseAiAgentChatOptions {
457
461
  * Chat options specific to OpenAI models, extending base options.
458
462
  * @category AI
459
463
  */
460
- export interface OpenAiChatOptions extends BaseAiAgentChatOptions {
464
+ export interface OpenAiChatOptions extends BaseAiChatOptions {
461
465
  /** The OpenAI model to use for the chat. */
462
466
  model?: OpenAiChatModelName;
463
467
  /** An array of file URLs to include in the chat context. */
@@ -481,7 +485,7 @@ export interface OpenAiReasoningChatOptions extends OpenAiChatOptions {
481
485
  * Chat options specific to Anthropic models, extending base options.
482
486
  * @category AI
483
487
  */
484
- export interface AnthropicChatOptions extends BaseAiAgentChatOptions {
488
+ export interface AnthropicChatOptions extends BaseAiChatOptions {
485
489
  /** The Anthropic model to use for the chat. */
486
490
  model?: AnthropicChatModelName;
487
491
  /** The level of reasoning effort to apply. Defaults to no reasoning. */
@@ -506,12 +510,12 @@ export type AiSessionOptions = Partial<{
506
510
  * the type is inferred from the provided overrideModel (or falls back to BaseAiAgentChatOptions).
507
511
  * @category AI
508
512
  */
509
- export type AiAgentChatOptions<T extends AiChatModelName | undefined = undefined> = T extends undefined ? BaseAiAgentChatOptions | GeminiChatOptions | OpenAiReasoningChatOptions | OpenAiChatOptions | AnthropicChatOptions : T extends GeminiChatModelName ? GeminiChatOptions : T extends OpenAiReasoningChatModelName ? OpenAiReasoningChatOptions : T extends OpenAiChatModelName ? OpenAiChatOptions : T extends AnthropicChatModelName ? AnthropicChatOptions : never;
513
+ 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 SquidAiModelName ? BaseAiChatOptions : never;
510
514
  /**
511
515
  * @category AI
512
516
  */
513
517
  export type AllAiAgentChatOptions = {
514
- [K in keyof BaseAiAgentChatOptions | keyof GeminiChatOptions | keyof OpenAiReasoningChatOptions | keyof OpenAiChatOptions | keyof AnthropicChatOptions]?: (K extends keyof BaseAiAgentChatOptions ? BaseAiAgentChatOptions[K] : never) | (K extends keyof GeminiChatOptions ? GeminiChatOptions[K] : never) | (K extends keyof OpenAiReasoningChatOptions ? OpenAiReasoningChatOptions[K] : never) | (K extends keyof OpenAiChatOptions ? OpenAiChatOptions[K] : never) | (K extends keyof AnthropicChatOptions ? AnthropicChatOptions[K] : never);
518
+ [K in keyof BaseAiChatOptions | keyof GeminiChatOptions | keyof OpenAiReasoningChatOptions | keyof OpenAiChatOptions | keyof AnthropicChatOptions]?: (K extends keyof BaseAiChatOptions ? BaseAiChatOptions[K] : never) | (K extends keyof GeminiChatOptions ? GeminiChatOptions[K] : never) | (K extends keyof OpenAiReasoningChatOptions ? OpenAiReasoningChatOptions[K] : never) | (K extends keyof OpenAiChatOptions ? OpenAiChatOptions[K] : never) | (K extends keyof AnthropicChatOptions ? AnthropicChatOptions[K] : never);
515
519
  };
516
520
  /**
517
521
  * A definition of an AI agent with its properties and default chat options.
@@ -531,7 +535,7 @@ export interface AiAgent<T extends AiChatModelName | undefined = undefined> {
531
535
  /** Enables audit logging for the agent's activities if true; defaults to false. */
532
536
  auditLog?: boolean;
533
537
  /** The default chat options for the agent, overridable by the user during use. */
534
- options: AiAgentChatOptions<T>;
538
+ options: AiChatOptions<T>;
535
539
  /** The embedding model name used by the agent. */
536
540
  embeddingModelName: AiEmbeddingsModelName;
537
541
  }
@@ -539,7 +543,7 @@ export interface AiAgent<T extends AiChatModelName | undefined = undefined> {
539
543
  * @category AI
540
544
  */
541
545
  export type UpsertAgentRequest = Omit<AiAgent, 'createdAt' | 'updatedAt' | 'options' | 'embeddingModelName'> & {
542
- options?: AiAgentChatOptions;
546
+ options?: AiChatOptions;
543
547
  embeddingModelName?: AiEmbeddingsModelName;
544
548
  };
545
549
  /**
@@ -92,3 +92,80 @@ export interface ExtractDataFromDocumentResponse {
92
92
  */
93
93
  pages: Array<ExtractDataFromDocumentPage>;
94
94
  }
95
+ /**
96
+ * Create PDF request type.
97
+ */
98
+ export type CreatePdfType = 'html' | 'url';
99
+ /** The type of output options to apply when creating a PDF document. */
100
+ export type CreatePdfOutputOptionsType = 'format' | 'dimensions';
101
+ /** Base interface for PDF output options. This is used to define the type of output options. */
102
+ export interface BaseCreatePdfOutputOptions {
103
+ /** The type of output options, either 'format' or 'dimensions'. */
104
+ type: CreatePdfOutputOptionsType;
105
+ }
106
+ /** Output options by format */
107
+ export interface CreatePdfOutputFormatOptions extends BaseCreatePdfOutputOptions {
108
+ /** The type of output options, always 'format' for this interface. */
109
+ type: 'format';
110
+ /** The type of formatting, always 'format' for this interface. */
111
+ format: 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6';
112
+ }
113
+ /** Output options by custom dimensions */
114
+ export interface CreatePdfOutputDimensionsOptions extends BaseCreatePdfOutputOptions {
115
+ /** The type of formatting, always 'dimensions' for this interface. */
116
+ type: 'dimensions';
117
+ /** The width of the PDF document in pixels. */
118
+ width: number;
119
+ /** The height of the PDF document in pixels. */
120
+ height: number;
121
+ }
122
+ /** Combined formatting options for creating a PDF document. */
123
+ export type CreatePdfOutputOptions = CreatePdfOutputFormatOptions | CreatePdfOutputDimensionsOptions;
124
+ /**
125
+ * Base request for creating a PDF document.
126
+ */
127
+ export interface BaseCreatePdfRequest {
128
+ /**
129
+ * The type of PDF creation to perform, either from HTML or a URL.
130
+ */
131
+ type: CreatePdfType;
132
+ /** The formatting options for the PDF document. Can be either a predefined format (like 'letter') or custom dimensions. */
133
+ outputOptions?: CreatePdfOutputOptions;
134
+ /** Optional title for the PDF document. */
135
+ title?: string;
136
+ }
137
+ /**
138
+ * Request payload for creating a PDF from a URL.
139
+ */
140
+ export interface CreatePdfFromUrlRequest extends BaseCreatePdfRequest {
141
+ /** The type of PDF creation, always 'url' for this request. */
142
+ type: 'url';
143
+ /**
144
+ * The URL of the webpage to convert into a PDF.
145
+ */
146
+ url: string;
147
+ }
148
+ /**
149
+ * Request payload for creating a PDF from HTML content.
150
+ */
151
+ export interface CreatePdfFromHtmlRequest extends BaseCreatePdfRequest {
152
+ /** The type of PDF creation, always 'html' for this request. */
153
+ type: 'html';
154
+ /** The HTML content to convert into a PDF. Should not contain <html>, <body>, <head>, should just include the inner HTML */
155
+ innerHtml: string;
156
+ /** Optional URL for CSS styles to apply to the HTML content. */
157
+ cssUrl?: string;
158
+ }
159
+ /**
160
+ * Combined request type for creating a PDF, which can be either from a URL or HTML content.
161
+ */
162
+ export type CreatePdfRequest = CreatePdfFromUrlRequest | CreatePdfFromHtmlRequest;
163
+ /**
164
+ * Response type for the PDF creation operation, containing the URL of the generated PDF.
165
+ */
166
+ export interface CreatePdfResponse {
167
+ /**
168
+ * The publicly accessible URL where the generated PDF can be downloaded.
169
+ */
170
+ url: string;
171
+ }
@@ -1,4 +1,4 @@
1
- import { AgentContextRequest, AiAgent, AiAgentChatOptions, AiAgentContext, AiAudioCreateSpeechOptions, AiChatModelName, AiContextMetadata, AiContextMetadataFilter, AiEmbeddingsModelName, AiGenerateImageOptions, AiSearchOptions, AiSearchResultChunk, AllAiAgentChatOptions } from '../public-types/ai-agent.public-types';
1
+ import { AgentContextRequest, AiAgent, AiChatOptions, AiAgentContext, AiAudioCreateSpeechOptions, AiChatModelName, AiContextMetadata, AiContextMetadataFilter, AiEmbeddingsModelName, AiGenerateImageOptions, AiSearchOptions, AiSearchResultChunk, AllAiAgentChatOptions } from '../public-types/ai-agent.public-types';
2
2
  import { AiAgentId, AppId, ClientRequestId } from '../public-types/communication.public-types';
3
3
  import { AiFunctionId } from '../public-types/backend.public-types';
4
4
  type ModelDataType = {
@@ -24,7 +24,7 @@ export interface AiGenerateImageRequest {
24
24
  export interface AiAskQuestionInternalRequest {
25
25
  appId: AppId;
26
26
  prompt: string;
27
- options: AiAgentChatOptions;
27
+ options: AiChatOptions;
28
28
  }
29
29
  export interface AiAskQuestionInternalResponse {
30
30
  answer: string;
@@ -1,6 +1,6 @@
1
- import { AgentContextRequest, AiAgent, AiAgentChatOptions, AiAgentContext, AiChatModelName, AiConnectedAgentMetadata, AiObserveStatusOptions, AiSearchOptions, AiSearchResultChunk, AiStatusMessage, AiTranscribeAndAskResponse, GuardrailsOptions, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
1
+ import { AgentContextRequest, AiAgent, AiAgentContext, AiChatModelName, AiConnectedAgentMetadata, AiObserveStatusOptions, AiSearchOptions, AiSearchResultChunk, AiStatusMessage, AiTranscribeAndAskResponse, GuardrailsOptions, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
2
2
  import { Observable } from 'rxjs';
3
- import { AskOptionsWithoutVoice, AskWithVoiceResponse, ChatOptionsWithoutVoice, TranscribeAndAskWithVoiceResponse, TranscribeAndChatResponse } from './ai-agent-client.types';
3
+ import { AiAskOptions, AiAskOptionsWithVoice, AiChatOptionsWithoutVoice, AskWithVoiceResponse, TranscribeAndAskWithVoiceResponse, TranscribeAndChatResponse } from './ai-agent-client.types';
4
4
  /**
5
5
  * Parameters for creating or updating an AI agent.
6
6
  * Excludes the `id` field, as it is derived from the agent instance.
@@ -90,11 +90,11 @@ export declare class AiAgentReference {
90
90
  /**
91
91
  * Sends a prompt to the agent and receives streamed text responses.
92
92
  */
93
- chat(prompt: string, options?: ChatOptionsWithoutVoice): Observable<string>;
93
+ chat<T extends AiChatModelName | undefined>(prompt: string, options?: AiChatOptionsWithoutVoice<T>): Observable<string>;
94
94
  /**
95
95
  * Transcribes the given file and performs a chat interaction.
96
96
  */
97
- transcribeAndChat(fileToTranscribe: File, options?: ChatOptionsWithoutVoice): Promise<TranscribeAndChatResponse>;
97
+ transcribeAndChat(fileToTranscribe: File, options?: AiChatOptionsWithoutVoice): Promise<TranscribeAndChatResponse>;
98
98
  /**
99
99
  * Performs a semantic search using the agent's knowledge base.
100
100
  */
@@ -102,7 +102,7 @@ export declare class AiAgentReference {
102
102
  /**
103
103
  * Sends a prompt and receives a full string response.
104
104
  */
105
- ask(prompt: string, options?: AskOptionsWithoutVoice): Promise<string>;
105
+ ask<T extends AiChatModelName | undefined = undefined>(prompt: string, options?: AiAskOptions<T>): Promise<string>;
106
106
  /**
107
107
  * Observes live status messages from the agent.
108
108
  */
@@ -110,15 +110,15 @@ export declare class AiAgentReference {
110
110
  /**
111
111
  * Transcribes audio and sends it to the agent for response.
112
112
  */
113
- transcribeAndAsk(fileToTranscribe: File, options?: AskOptionsWithoutVoice): Promise<AiTranscribeAndAskResponse>;
113
+ transcribeAndAsk<T extends AiChatModelName | undefined>(fileToTranscribe: File, options?: AiAskOptions<T>): Promise<AiTranscribeAndAskResponse>;
114
114
  /**
115
115
  * Transcribes audio and gets both text and voice response from the agent.
116
116
  */
117
- transcribeAndAskWithVoiceResponse(fileToTranscribe: File, options?: Omit<AiAgentChatOptions, 'smoothTyping'>): Promise<TranscribeAndAskWithVoiceResponse>;
117
+ transcribeAndAskWithVoiceResponse<T extends AiChatModelName | undefined>(fileToTranscribe: File, options?: AiAskOptionsWithVoice<T>): Promise<TranscribeAndAskWithVoiceResponse>;
118
118
  /**
119
119
  * Sends a prompt and gets both text and voice response from the agent.
120
120
  */
121
- askWithVoiceResponse(prompt: string, options?: Omit<AiAgentChatOptions, 'smoothTyping'>): Promise<AskWithVoiceResponse>;
121
+ askWithVoiceResponse<T extends AiChatModelName | undefined>(prompt: string, options?: AiAskOptionsWithVoice<T>): Promise<AskWithVoiceResponse>;
122
122
  private askInternal;
123
123
  private createStatusSubject;
124
124
  private chatInternal;
@@ -1,4 +1,4 @@
1
- import { AiAgentChatOptions } from '../../../internal-common/src/public-types/ai-agent.public-types';
1
+ import { AiChatModelName, AiChatOptions } from '../../../internal-common/src/public-types/ai-agent.public-types';
2
2
  import { Observable } from 'rxjs';
3
3
  /**
4
4
  * Response format for transcribing audio and generating a chat response.
@@ -39,9 +39,20 @@ export interface AskWithVoiceResponse {
39
39
  * Chat options that exclude voice-specific configurations.
40
40
  * @category AI
41
41
  */
42
- export type ChatOptionsWithoutVoice = Omit<AiAgentChatOptions, 'voiceOptions'>;
42
+ export type AiChatOptionsWithoutVoice<T extends AiChatModelName | undefined = undefined> = Omit<AiChatOptions<T>, 'voiceOptions'> & {
43
+ model?: T;
44
+ };
43
45
  /**
44
46
  * Options for AI-generated responses that exclude voice-specific settings and smooth typing behavior.
45
47
  * @category AI
46
48
  */
47
- export type AskOptionsWithoutVoice = Omit<AiAgentChatOptions, 'voiceOptions' | 'smoothTyping'>;
49
+ export type AiAskOptions<T extends AiChatModelName | undefined = undefined> = Omit<AiChatOptions<T>, 'voiceOptions' | 'smoothTyping'> & {
50
+ model?: T;
51
+ };
52
+ /**
53
+ * Options for AI-generated responses that include voice-specific settings but excludes smooth typing.
54
+ * @category AI
55
+ */
56
+ export type AiAskOptionsWithVoice<T extends AiChatModelName | undefined = undefined> = Omit<AiChatOptions<T>, 'smoothTyping'> & {
57
+ model?: T;
58
+ };
@@ -1,4 +1,4 @@
1
- import { ExtractDataFromDocumentOptions, ExtractDataFromDocumentResponse } from '../../internal-common/src/public-types/extraction.public-types';
1
+ import { CreatePdfRequest, CreatePdfResponse, ExtractDataFromDocumentOptions, ExtractDataFromDocumentResponse } from '../../internal-common/src/public-types/extraction.public-types';
2
2
  /**
3
3
  * ExtractionClient provides methods for extracting structured data
4
4
  * from document files using AI-driven processing.
@@ -22,4 +22,9 @@ export declare class ExtractionClient {
22
22
  * @returns A promise that resolves with the extracted document data.
23
23
  */
24
24
  extractDataFromDocumentUrl(url: string, options?: ExtractDataFromDocumentOptions): Promise<ExtractDataFromDocumentResponse>;
25
+ /**
26
+ * Creates a PDF document from the provided request parameters.
27
+ * @param request - The request containing details for PDF creation, such as content or url.
28
+ */
29
+ createPdf(request: CreatePdfRequest): Promise<CreatePdfResponse>;
25
30
  }
@@ -2,4 +2,4 @@
2
2
  * The current version of the SquidCloud client package.
3
3
  * @category Platform
4
4
  */
5
- export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.363";
5
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.364";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.363",
3
+ "version": "1.0.364",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",