@squidcloud/client 1.0.197 → 1.0.198

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/cjs/index.js CHANGED
@@ -9485,6 +9485,7 @@ __webpack_require__.r(__webpack_exports__);
9485
9485
 
9486
9486
  // EXPORTS
9487
9487
  __webpack_require__.d(__webpack_exports__, {
9488
+ AI_IMAGE_GENERATION_MODEL_NAMES: () => (/* reexport */ AI_IMAGE_GENERATION_MODEL_NAMES),
9488
9489
  AI_MODEL_NAMES: () => (/* reexport */ AI_MODEL_NAMES),
9489
9490
  ALL_OPERATORS: () => (/* reexport */ ALL_OPERATORS),
9490
9491
  AiAssistantClient: () => (/* reexport */ AiAssistantClient),
@@ -9496,6 +9497,7 @@ __webpack_require__.d(__webpack_exports__, {
9496
9497
  AiChatbotMutationContext: () => (/* reexport */ AiChatbotMutationContext),
9497
9498
  AiChatbotProfileReference: () => (/* reexport */ AiChatbotProfileReference),
9498
9499
  AiClient: () => (/* reexport */ AiClient),
9500
+ AiImageClient: () => (/* reexport */ AiImageClient),
9499
9501
  ApiCallContext: () => (/* reexport */ ApiCallContext),
9500
9502
  ApiClient: () => (/* reexport */ ApiClient),
9501
9503
  ApiKeysSecretClient: () => (/* reexport */ ApiKeysSecretClient),
@@ -11027,8 +11029,26 @@ class AiChatbotClientFactory {
11027
11029
  }
11028
11030
  }
11029
11031
 
11032
+ ;// CONCATENATED MODULE: ./src/ai-image-client.ts
11033
+ class AiImageClient {
11034
+ /** @internal */
11035
+ constructor(rpcManager, integrationId) {
11036
+ this.rpcManager = rpcManager;
11037
+ this.integrationId = integrationId;
11038
+ }
11039
+ async generate(prompt, options) {
11040
+ const request = {
11041
+ prompt,
11042
+ options,
11043
+ integrationId: this.integrationId,
11044
+ };
11045
+ return this.rpcManager.post('ai/image/generate', request);
11046
+ }
11047
+ }
11048
+
11030
11049
  ;// CONCATENATED MODULE: ./src/ai.types.ts
11031
11050
 
11051
+
11032
11052
  /**
11033
11053
  * AiClient class serves as a facade for interacting with different AI services.
11034
11054
  * It provides simplified access to AI chatbot and assistant functionalities
@@ -11056,6 +11076,13 @@ class AiClient {
11056
11076
  assistant() {
11057
11077
  return this.aiAssistantClient;
11058
11078
  }
11079
+ /**
11080
+ * Retrieves an AI image client for a specific AI integration.
11081
+ * @param integrationId - The identifier for the AI integration.
11082
+ */
11083
+ image(integrationId) {
11084
+ return new AiImageClient(this.rpcManager, integrationId);
11085
+ }
11059
11086
  /**
11060
11087
  * Executes an AI query using a specific DB integration, sending a prompt to the AI and returning its response.
11061
11088
  * This function allows for direct interaction with the AI's capabilities by sending text prompts and receiving
@@ -11768,6 +11795,8 @@ const AI_MODEL_NAMES = [
11768
11795
  'claude-3-haiku-20240307',
11769
11796
  'gpt-4-turbo-preview',
11770
11797
  ];
11798
+ /** The supported AI image generation model names. */
11799
+ const AI_IMAGE_GENERATION_MODEL_NAMES = ['dall-e-3'];
11771
11800
 
11772
11801
  ;// CONCATENATED MODULE: ../internal-common/src/public-types/api-call.public-context.ts
11773
11802
  /** The context of an API call. */
@@ -15433,7 +15462,12 @@ class DistributedLockManager {
15433
15462
  lock.release();
15434
15463
  });
15435
15464
  }
15436
- async lock(mutex) {
15465
+ /**
15466
+ * Acquires a lock.
15467
+ * @param mutex The mutex to lock.
15468
+ * @param timeoutMillis The maximum time to wait for the lock to be acquired on the server.
15469
+ */
15470
+ async lock(mutex, timeoutMillis = 1000) {
15437
15471
  /**
15438
15472
  * Wait up to 2 seconds for the connection to be ready and if it is not, consider the client to be not connected.
15439
15473
  * This is useful because right after the Squid client is created, the socket is still not connected but the user
@@ -15449,11 +15483,12 @@ class DistributedLockManager {
15449
15483
  type: 'acquireLock',
15450
15484
  payload: {
15451
15485
  mutex,
15486
+ timeoutMillis,
15452
15487
  clientRequestId,
15453
15488
  },
15454
15489
  };
15455
15490
  this.socketManager.sendMessage(acquireLockMessage);
15456
- const result = await (0,external_rxjs_.firstValueFrom)((0,external_rxjs_.race)((0,external_rxjs_.timer)(5000).pipe((0,external_rxjs_.take)(1), map(() => {
15491
+ const result = await (0,external_rxjs_.firstValueFrom)((0,external_rxjs_.race)((0,external_rxjs_.timer)(timeoutMillis + 4000).pipe((0,external_rxjs_.take)(1), map(() => {
15457
15492
  return {
15458
15493
  payload: {
15459
15494
  error: 'TIMEOUT_GETTING_LOCK',
@@ -34124,6 +34159,7 @@ Squid.squidInstancesMap = {};
34124
34159
 
34125
34160
 
34126
34161
 
34162
+
34127
34163
 
34128
34164
 
34129
34165
  })();
@@ -1,6 +1,19 @@
1
1
  /** The supported AI model names. */
2
2
  export declare const AI_MODEL_NAMES: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-1106", "gpt-4", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "gpt-4-turbo-preview"];
3
+ /** The supported AI image generation model names. */
4
+ export declare const AI_IMAGE_GENERATION_MODEL_NAMES: readonly ["dall-e-3"];
3
5
  export type AiModelName = (typeof AI_MODEL_NAMES)[number];
6
+ export type AiImageGenerationModelName = (typeof AI_IMAGE_GENERATION_MODEL_NAMES)[number];
7
+ export type AiGenerateImageOptions = DallEOptions;
8
+ export interface BaseAiGenerateImageOptions {
9
+ modelName: AiImageGenerationModelName;
10
+ }
11
+ export interface DallEOptions extends BaseAiGenerateImageOptions {
12
+ modelName: 'dall-e-3';
13
+ quality?: 'hd' | 'standard';
14
+ size?: '256x256' | '512x512' | '1024x1024' | '1792x1024' | '1024x1792';
15
+ numberOfImagesToGenerate?: 1;
16
+ }
4
17
  /** The possible sources for the LLM provider API key. */
5
18
  export type ApiKeySource = 'user' | 'system';
6
19
  export type OpenAiResponseFormat = 'text' | 'json_object';
@@ -0,0 +1,6 @@
1
+ import { AiGenerateImageOptions } from './public-types';
2
+ export declare class AiImageClient {
3
+ private readonly rpcManager;
4
+ private readonly integrationId;
5
+ generate(prompt: string, options: AiGenerateImageOptions): Promise<string>;
6
+ }
@@ -1,6 +1,7 @@
1
1
  import { AiChatbotClient } from './ai-chatbot-client';
2
2
  import { AiAssistantClient } from './ai-assistant-client';
3
3
  import { IntegrationId } from './public-types';
4
+ import { AiImageClient } from './ai-image-client';
4
5
  export interface ExecuteAiQueryRequest {
5
6
  integrationId: IntegrationId;
6
7
  prompt: string;
@@ -32,6 +33,11 @@ export declare class AiClient {
32
33
  * @returns An instance of AiAssistantClient.
33
34
  */
34
35
  assistant(): AiAssistantClient;
36
+ /**
37
+ * Retrieves an AI image client for a specific AI integration.
38
+ * @param integrationId - The identifier for the AI integration.
39
+ */
40
+ image(integrationId: IntegrationId): AiImageClient;
35
41
  /**
36
42
  * Executes an AI query using a specific DB integration, sending a prompt to the AI and returning its response.
37
43
  * This function allows for direct interaction with the AI's capabilities by sending text prompts and receiving
@@ -1,6 +1,7 @@
1
1
  export * from './ai-assistant-client';
2
2
  export * from './ai-chatbot-client.factory';
3
3
  export * from './ai-chatbot-client';
4
+ export * from './ai-image-client';
4
5
  export * from './ai.types';
5
6
  export * from './api-client';
6
7
  export * from './api.manager';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.197",
3
+ "version": "1.0.198",
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",