@squidcloud/client 1.0.277 → 1.0.278

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.
@@ -10,28 +10,49 @@ export declare const OPENAI_EMBEDDINGS_MODEL_NAMES: readonly ["text-embedding-3-
10
10
  export declare const AI_EMBEDDINGS_MODEL_NAMES: readonly ["text-embedding-3-small", "text-embedding-3-large", "text-embedding-ada-002"];
11
11
  /** The supported AI image generation model names. */
12
12
  export declare const OPENAI_IMAGE_MODEL_NAMES: readonly ["dall-e-3"];
13
- export declare const OPENAI_AUDIO_MODEL_NAMES: readonly ["whisper-1"];
13
+ export declare const OPENAI_AUDIO_TRANSCRIPTION_MODEL_NAMES: readonly ["whisper-1"];
14
+ export declare const OPENAI_AUDIO_CREATE_SPEECH_MODEL_NAMES: readonly ["tts-1", "tts-1-hd"];
15
+ export declare const OPENAI_AUDIO_MODEL_NAMES: readonly ["whisper-1", "tts-1", "tts-1-hd"];
14
16
  export declare const STABLE_DIFFUSION_MODEL_NAMES: readonly ["stable-diffusion-core"];
15
17
  export declare const AI_IMAGE_MODEL_NAMES: readonly ["dall-e-3", "stable-diffusion-core"];
16
- export declare const AI_AUDIO_MODEL_NAMES: readonly ["whisper-1"];
18
+ export declare const AI_AUDIO_TRANSCRIPTION_MODEL_NAMES: readonly ["whisper-1"];
19
+ export declare const AI_AUDIO_CREATE_SPEECH_MODEL_NAMES: readonly ["tts-1", "tts-1-hd"];
20
+ export declare const OPEN_AI_CREATE_SPEECH_FORMATS: readonly ["mp3", "opus", "aac", "flac", "wav", "pcm"];
17
21
  export type AiChatModelName = (typeof AI_CHAT_MODEL_NAMES)[number];
18
22
  export type AiEmbeddingsModelName = (typeof AI_EMBEDDINGS_MODEL_NAMES)[number];
19
23
  export type OpenAiChatModelName = (typeof OPENAI_CHAT_MODEL_NAMES)[number];
20
24
  export type GeminiChatModelName = (typeof GEMINI_CHAT_MODEL_NAMES)[number];
21
25
  export type AnthropicChatModelName = (typeof ANTHROPIC_CHAT_MODEL_NAMES)[number];
22
26
  export type AiImageModelName = (typeof AI_IMAGE_MODEL_NAMES)[number];
23
- export type AiAudioModelName = (typeof AI_AUDIO_MODEL_NAMES)[number];
27
+ export type AiAudioTranscriptionModelName = (typeof AI_AUDIO_TRANSCRIPTION_MODEL_NAMES)[number];
28
+ export type AiAudioCreateSpeechModelName = (typeof OPENAI_AUDIO_CREATE_SPEECH_MODEL_NAMES)[number];
29
+ export type AiAudioModelName = (typeof OPENAI_AUDIO_MODEL_NAMES)[number];
24
30
  export type OpenAiImageModelName = (typeof OPENAI_IMAGE_MODEL_NAMES)[number];
25
- export type OpenAiAudioModelName = (typeof OPENAI_AUDIO_MODEL_NAMES)[number];
31
+ export type OpenAiAudioTranscriptionModelName = (typeof OPENAI_AUDIO_TRANSCRIPTION_MODEL_NAMES)[number];
32
+ export type OpenAiAudioCreateSpeechModelName = (typeof OPENAI_AUDIO_CREATE_SPEECH_MODEL_NAMES)[number];
33
+ export type OpenAiCreateSpeechFormat = (typeof OPEN_AI_CREATE_SPEECH_FORMATS)[number];
26
34
  export type StableDiffusionModelName = (typeof STABLE_DIFFUSION_MODEL_NAMES)[number];
27
35
  export type AiGenerateImageOptions = DallEOptions | StableDiffusionCoreOptions;
28
36
  export type AiAudioTranscribeOptions = WhisperOptions;
37
+ export type AiAudioCreateSpeechOptions = OpenAiCreateSpeechOptions;
29
38
  export type VectorDbType = 'pinecone' | 'postgres';
39
+ export interface AiAudioCreateSpeechResponse {
40
+ mimeType: string;
41
+ extension: string;
42
+ base64File: string;
43
+ }
44
+ export interface AiAudioCreateSpeechRequest {
45
+ input: string;
46
+ options: AiAudioCreateSpeechOptions;
47
+ }
30
48
  export interface BaseAiGenerateImageOptions {
31
49
  modelName: AiImageModelName;
32
50
  }
33
51
  export interface BaseAiAudioTranscribeOptions {
34
- modelName: AiAudioModelName;
52
+ modelName: AiAudioTranscriptionModelName;
53
+ }
54
+ export interface BaseAiAudioCreateSpeechOptions {
55
+ modelName: AiAudioCreateSpeechModelName;
35
56
  }
36
57
  export interface DallEOptions extends BaseAiGenerateImageOptions {
37
58
  modelName: 'dall-e-3';
@@ -45,6 +66,12 @@ export interface WhisperOptions extends BaseAiAudioTranscribeOptions {
45
66
  temperature?: number;
46
67
  prompt?: string;
47
68
  }
69
+ export interface OpenAiCreateSpeechOptions extends BaseAiAudioCreateSpeechOptions {
70
+ modelName: OpenAiAudioCreateSpeechModelName;
71
+ voice?: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer';
72
+ responseFormat?: OpenAiCreateSpeechFormat;
73
+ speed?: number;
74
+ }
48
75
  export interface StableDiffusionCoreOptions extends BaseAiGenerateImageOptions {
49
76
  modelName: 'stable-diffusion-core';
50
77
  aspectRatio?: '16:9' | '1:1' | '21:9' | '2:3' | '3:2' | '4:5' | '5:4' | '9:16' | '9:21';
@@ -89,6 +116,27 @@ export interface AiChatbotChatOptions {
89
116
  instructions?: Array<string>;
90
117
  /** A set of filters that will limit the context the AI can access */
91
118
  contextMetadataFilter?: AiContextMetadataFilter;
119
+ /** The options to use for the response in voice */
120
+ voiceOptions?: AiAudioCreateSpeechOptions;
121
+ }
122
+ export interface AiAskResponse {
123
+ responseString: string;
124
+ }
125
+ export interface AiTranscribeAndAskResponse {
126
+ responseString: string;
127
+ transcribedPrompt: string;
128
+ }
129
+ export interface AiAskWithVoiceResponse {
130
+ responseString: string;
131
+ voiceResponse: AiAudioCreateSpeechResponse;
132
+ }
133
+ export interface AiTranscribeAndAskWithVoiceResponse {
134
+ transcribedPrompt: string;
135
+ responseString: string;
136
+ voiceResponse: AiAudioCreateSpeechResponse;
137
+ }
138
+ export interface AiTranscribeAndChatResponse {
139
+ transcribedPrompt: string;
92
140
  }
93
141
  /** The options for the AI chatbot search method. */
94
142
  export interface AiSearchOptions {
@@ -136,7 +184,7 @@ export interface AiChatbotFileContext extends AiChatbotContextBase {
136
184
  minImageHeight?: number;
137
185
  }
138
186
  export declare class AiChatbotChatContext {
139
- readonly prompt: string;
187
+ readonly prompt?: string;
140
188
  readonly profileId: string;
141
189
  }
142
190
  export type AiChatbotContext = AiChatbotTextContext | AiChatbotUrlContext | AiChatbotFileContext;
@@ -27,6 +27,7 @@ export declare enum IntegrationType {
27
27
  'built_in_s3' = "built_in_s3",
28
28
  'built_in_gcs' = "built_in_gcs",
29
29
  'google_drive' = "google_drive",
30
+ 'ai_agents' = "ai_agents",
30
31
  'algolia' = "algolia",
31
32
  'elastic_observability' = "elastic_observability",
32
33
  'elastic_search' = "elastic_search",
@@ -1,6 +1,21 @@
1
- import { AiChatbotChatOptions, AiChatbotContext, AiChatModelName, AiSearchOptions, AiSearchResponse } from './public-types';
1
+ import { AiChatbotChatOptions, AiChatbotContext, AiChatModelName, AiSearchOptions, AiSearchResponse, AiTranscribeAndAskResponse } from './public-types';
2
2
  import { Observable } from 'rxjs';
3
- export declare class AiChatbotClient {
3
+ interface TranscribeAndChatResponse {
4
+ transcribedPrompt: string;
5
+ responseStream: Observable<string>;
6
+ }
7
+ interface TranscribeAndAskWithVoiceResponse {
8
+ transcribedPrompt: string;
9
+ responseString: string;
10
+ voiceResponseFile: File;
11
+ }
12
+ interface AskWithVoiceResponse {
13
+ responseString: string;
14
+ voiceResponseFile: File;
15
+ }
16
+ type ChatOptionsWithoutVoice = Omit<AiChatbotChatOptions, 'voiceOptions'>;
17
+ type AskOptionsWithoutVoice = Omit<AiChatbotChatOptions, 'voiceOptions' | 'smoothTyping'>;
18
+ export declare class AiAgentClient {
4
19
  private readonly rpcManager;
5
20
  private readonly socketManager;
6
21
  private readonly integrationId;
@@ -13,7 +28,7 @@ export declare class AiChatbotClient {
13
28
  * @param id - The id of the profile.
14
29
  * @returns The profile reference.
15
30
  */
16
- profile(id: string): AiChatbotProfileReference;
31
+ profile(id: string): AiAgentReference;
17
32
  /**
18
33
  * Sends a prompt to the specified profile id.
19
34
  *
@@ -23,8 +38,10 @@ export declare class AiChatbotClient {
23
38
  * @returns An observable that emits when a new response token is received. The emitted value is the entire response
24
39
  * that has been received so far.
25
40
  */
26
- chat(profileId: string, prompt: string, options?: AiChatbotChatOptions): Observable<string>;
27
- search(profileId: string, options: AiSearchOptions): Promise<AiSearchResponse>;
41
+ chat(profileId: string, prompt: string, options?: ChatOptionsWithoutVoice): Observable<string>;
42
+ transcribeAndChat(profileId: string, fileToTranscribe: File, options?: ChatOptionsWithoutVoice): Promise<TranscribeAndChatResponse>;
43
+ private chatInternal;
44
+ search(agentId: string, options: AiSearchOptions): Promise<AiSearchResponse>;
28
45
  /**
29
46
  * Sends a prompt to the specified profile id and returns the response as a Promise of string.
30
47
  *
@@ -33,7 +50,11 @@ export declare class AiChatbotClient {
33
50
  * @param options - The options to send to the chat model.
34
51
  * @returns A promise that resolves when the chat is complete. The resolved value is the entire response.
35
52
  */
36
- ask(profileId: string, prompt: string, options?: Omit<AiChatbotChatOptions, 'smoothTyping'>): Promise<string>;
53
+ ask(profileId: string, prompt: string, options?: AskOptionsWithoutVoice): Promise<string>;
54
+ transcribeAndAsk(profileId: string, fileToTranscribe: File, options?: AskOptionsWithoutVoice): Promise<AiTranscribeAndAskResponse>;
55
+ transcribeAndAskWithVoiceResponse(profileId: string, fileToTranscribe: File, options?: Omit<AiChatbotChatOptions, 'smoothTyping'>): Promise<TranscribeAndAskWithVoiceResponse>;
56
+ askWithVoiceResponse(profileId: string, prompt: string, options?: Omit<AiChatbotChatOptions, 'smoothTyping'>): Promise<AskWithVoiceResponse>;
57
+ askInternal<T>(profileId: string, prompt: string | File, isVoiceResponse: boolean, options?: Omit<AiChatbotChatOptions, 'smoothTyping'>): Promise<T>;
37
58
  private handleChatResponse;
38
59
  }
39
60
  export interface AiChatBotContextData {
@@ -48,7 +69,7 @@ export interface ProfileData {
48
69
  export interface InstructionData {
49
70
  instruction: string;
50
71
  }
51
- export declare class AiChatbotProfileReference {
72
+ export declare class AiAgentReference {
52
73
  private readonly client;
53
74
  private readonly integrationId;
54
75
  private readonly profileId;
@@ -61,12 +82,16 @@ export declare class AiChatbotProfileReference {
61
82
  * that has been received so far.
62
83
  */
63
84
  chat(prompt: string, options?: AiChatbotChatOptions): Observable<string>;
85
+ transcribeAndChat(fileToTranscribe: File, options?: AiChatbotChatOptions): Promise<TranscribeAndChatResponse>;
64
86
  /**
65
87
  * Sends a prompt to the current profile and returns the response as a Promise of string.
66
88
  * @param prompt - The prompt.
67
89
  * @param options - The chat options.
68
90
  */
69
91
  ask(prompt: string, options?: Omit<AiChatbotChatOptions, 'smoothTyping'>): Promise<string>;
92
+ transcribeAndAsk(fileToTranscribe: File, options?: AskOptionsWithoutVoice): Promise<AiTranscribeAndAskResponse>;
93
+ transcribeAndAskWithVoiceResponse(fileToTranscribe: File, options?: Omit<AiChatbotChatOptions, 'smoothTyping'>): Promise<TranscribeAndAskWithVoiceResponse>;
94
+ askWithVoiceResponse(prompt: string, options?: Omit<AiChatbotChatOptions, 'smoothTyping'>): Promise<AskWithVoiceResponse>;
70
95
  search(options: AiSearchOptions): Promise<AiSearchResponse>;
71
96
  /**
72
97
  * Retrieves a context reference for the current profile. A context reference can be used to add a new context entry
@@ -76,7 +101,7 @@ export declare class AiChatbotProfileReference {
76
101
  * generated and the reference will point to a new context entry.
77
102
  * @returns The context reference.
78
103
  */
79
- context(id?: string): AiChatbotContextReference;
104
+ context(id?: string): AiAgentContextReference;
80
105
  /**
81
106
  * Retrieves an instruction reference for the current profile. An instruction reference can be used to add a new
82
107
  * instruction entry to the profile, or update/delete an existing instruction entry.
@@ -85,7 +110,7 @@ export declare class AiChatbotProfileReference {
85
110
  * generated and the reference will point to a new instruction entry.
86
111
  * @returns The instruction reference.
87
112
  */
88
- instruction(id?: string): AiChatbotInstructionReference;
113
+ instruction(id?: string): AiAgentInstructionReference;
89
114
  /**
90
115
  * Adds a new profile to the chatbot. This will result in an error if a profile already exists with the same id.
91
116
  *
@@ -117,7 +142,7 @@ export declare class AiChatbotProfileReference {
117
142
  */
118
143
  delete(): Promise<void>;
119
144
  }
120
- export declare class AiChatbotContextReference {
145
+ export declare class AiAgentContextReference {
121
146
  private readonly client;
122
147
  private readonly integrationId;
123
148
  private readonly profileId;
@@ -157,7 +182,7 @@ export declare class AiChatbotContextReference {
157
182
  */
158
183
  delete(): Promise<void>;
159
184
  }
160
- export declare class AiChatbotInstructionReference {
185
+ export declare class AiAgentInstructionReference {
161
186
  private readonly client;
162
187
  private readonly integrationId;
163
188
  private readonly profileId;
@@ -188,3 +213,12 @@ export declare class AiChatbotInstructionReference {
188
213
  */
189
214
  delete(): Promise<void>;
190
215
  }
216
+ export declare class AiChatbotProfileReference extends AiAgentReference {
217
+ }
218
+ export declare class AiChatbotClient extends AiAgentClient {
219
+ }
220
+ export declare class AiChatbotContextReference extends AiAgentContextReference {
221
+ }
222
+ export declare class AiChatbotInstructionReference extends AiAgentInstructionReference {
223
+ }
224
+ export {};
@@ -1,6 +1,7 @@
1
- import { AiAudioTranscribeOptions } from './public-types';
1
+ import { AiAudioCreateSpeechOptions, AiAudioTranscribeOptions } from './public-types';
2
2
  import { BlobAndFilename } from './types';
3
3
  export declare class AiAudioClient {
4
4
  private readonly rpcManager;
5
5
  transcribe(file: File | BlobAndFilename, options?: AiAudioTranscribeOptions): Promise<string>;
6
+ createSpeech(input: string, options: AiAudioCreateSpeechOptions): Promise<File>;
6
7
  }
@@ -1,4 +1,4 @@
1
- import { AiChatbotClient } from './ai-chatbot-client';
1
+ import { AiAgentReference, AiChatbotClient } from './ai-agent-client';
2
2
  import { AiAssistantClient } from './ai-assistant-client';
3
3
  import { IntegrationId } from './public-types';
4
4
  import { AiImageClient } from './ai-image-client';
@@ -43,6 +43,7 @@ export declare class AiClient {
43
43
  * @returns An instance of AiChatbotClient associated with the given AI integration ID.
44
44
  */
45
45
  chatbot(aiIntegrationId: IntegrationId): AiChatbotClient;
46
+ agent(agentId: string): AiAgentReference;
46
47
  /**
47
48
  * Retrieves the AI assistant client.
48
49
  * @returns An instance of AiAssistantClient.
@@ -0,0 +1 @@
1
+ export declare function base64ToFile(base64: string, filename: string, mimeType?: string): File;
@@ -1,6 +1,6 @@
1
1
  export * from './ai-assistant-client';
2
2
  export * from './ai-chatbot-client.factory';
3
- export * from './ai-chatbot-client';
3
+ export * from './ai-agent-client';
4
4
  export * from './ai-image-client';
5
5
  export * from './ai-audio-client';
6
6
  export * from './ai.types';
@@ -43,3 +43,4 @@ export * from './types';
43
43
  export * from './storage-client';
44
44
  export * from './personal-storage-client';
45
45
  export * from './extraction-client';
46
+ export * from './file-utils';
@@ -1 +1 @@
1
- export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.277";
1
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.278";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.277",
3
+ "version": "1.0.278",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/typescript-client/src/index.d.ts",