@squidcloud/client 1.0.268 → 1.0.270

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.
@@ -1,4 +1,5 @@
1
1
  import { FunctionName } from './bundle-data.public-types';
2
+ import { IntegrationId } from './communication.public-types';
2
3
  /** The supported OpenAI models */
3
4
  export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-1106", "gpt-4", "gpt-4-turbo-preview", "gpt-4o", "gpt-4o-mini", "gpt-4o-2024-08-06", "gpt-4-turbo"];
4
5
  export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-pro"];
@@ -89,6 +90,20 @@ export interface AiChatbotChatOptions {
89
90
  /** A set of filters that will limit the context the AI can access */
90
91
  contextMetadataFilter?: AiContextMetadataFilter;
91
92
  }
93
+ /** The options for the AI chatbot search method. */
94
+ export interface AiSearchOptions {
95
+ /** The prompt to search for */
96
+ prompt: string;
97
+ /** A set of filters that will limit the context the AI can access */
98
+ contextMetadataFilter?: AiContextMetadataFilter;
99
+ /** The maximum number of results to return */
100
+ limit?: number;
101
+ }
102
+ export interface AiSearchRequest {
103
+ options: AiSearchOptions;
104
+ profileId: string;
105
+ integrationId: IntegrationId;
106
+ }
92
107
  export type AiChatbotMutationType = 'insert' | 'update' | 'delete';
93
108
  export type AiChatbotResourceType = 'instruction' | 'context' | 'profile';
94
109
  export type AiChatbotContextType = 'text' | 'url' | 'file';
@@ -97,6 +112,14 @@ export interface AiChatbotContextBase {
97
112
  data: string;
98
113
  metadata?: AiContextMetadata;
99
114
  }
115
+ export interface AiSearchResponse {
116
+ chunks: Array<AiSearchResultChunk>;
117
+ }
118
+ export interface AiSearchResultChunk {
119
+ data: string;
120
+ metadata?: AiContextMetadata;
121
+ score: number;
122
+ }
100
123
  export interface AiChatbotTextContext extends AiChatbotContextBase {
101
124
  type: 'text';
102
125
  }
@@ -4,6 +4,8 @@ export type DatabaseActionType = 'read' | 'write' | 'update' | 'insert' | 'delet
4
4
  export type StorageActionType = 'read' | 'write' | 'update' | 'insert' | 'delete' | 'all';
5
5
  /** The different types of actions that can be performed on a topic. */
6
6
  export type TopicActionType = 'read' | 'write' | 'all';
7
+ /** The different type of actions for metrics. */
8
+ export type MetricActionType = 'write' | 'all';
7
9
  /** The different types of actions that can be performed on an AI chatbot. */
8
10
  export type AiChatbotActionType = 'chat' | 'mutate' | 'all';
9
11
  export type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date';
@@ -26,6 +26,7 @@ export declare enum IntegrationType {
26
26
  'gcs' = "gcs",
27
27
  'built_in_s3' = "built_in_s3",
28
28
  'built_in_gcs' = "built_in_gcs",
29
+ 'google_drive' = "google_drive",
29
30
  'algolia' = "algolia",
30
31
  'elastic_observability' = "elastic_observability",
31
32
  'elastic_search' = "elastic_search",
@@ -1,4 +1,4 @@
1
- import { AiChatbotChatOptions, AiChatbotContext, AiChatModelName } from './public-types';
1
+ import { AiChatbotChatOptions, AiChatbotContext, AiChatModelName, AiSearchOptions, AiSearchResponse } from './public-types';
2
2
  import { Observable } from 'rxjs';
3
3
  export declare class AiChatbotClient {
4
4
  private readonly rpcManager;
@@ -24,6 +24,7 @@ export declare class AiChatbotClient {
24
24
  * that has been received so far.
25
25
  */
26
26
  chat(profileId: string, prompt: string, options?: AiChatbotChatOptions): Observable<string>;
27
+ search(profileId: string, options: AiSearchOptions): Promise<AiSearchResponse>;
27
28
  /**
28
29
  * Sends a prompt to the specified profile id and returns the response as a Promise of string.
29
30
  *
@@ -66,6 +67,7 @@ export declare class AiChatbotProfileReference {
66
67
  * @param options - The chat options.
67
68
  */
68
69
  ask(prompt: string, options?: Omit<AiChatbotChatOptions, 'smoothTyping'>): Promise<string>;
70
+ search(options: AiSearchOptions): Promise<AiSearchResponse>;
69
71
  /**
70
72
  * Retrieves a context reference for the current profile. A context reference can be used to add a new context entry
71
73
  * to the profile, or update/delete an existing entry context.
@@ -41,4 +41,5 @@ export * from './squid-http-client';
41
41
  export * from './squid';
42
42
  export * from './types';
43
43
  export * from './storage-client';
44
+ export * from './personal-storage-client';
44
45
  export * from './extraction-client';
@@ -0,0 +1,59 @@
1
+ import { AiContextMetadata } from '../../internal-common/src/public-types/ai-chatbot.public-types';
2
+ import { DocumentTextDataResponse } from '../../internal-common/src/public-types/extraction.public-types';
3
+ interface PsGetAccessTokenResponse {
4
+ accessToken: string;
5
+ expirationTime: Date;
6
+ }
7
+ /**
8
+ * Client to handle personal storage integrations such as Google Drive or Microsoft OneDrive.
9
+ * Provides methods for saving authentication tokens, indexing documents or folders for AI processing,
10
+ * and unindexing documents from AI processing.
11
+ */
12
+ export declare class PersonalStorageClient {
13
+ private readonly integrationId;
14
+ private readonly rpcManager;
15
+ /**
16
+ * Saves an authentication token for the personal storage service.
17
+ *
18
+ * @param authCode - The authorization code obtained from the OAuth flow for the personal storage service.
19
+ * @param identifier - A user-provided identifier (usually a user ID) that will be associated with the token.
20
+ * @returns A promise that resolves with the access token and expiration time.
21
+ */
22
+ saveToken(authCode: string, identifier: string): Promise<PsGetAccessTokenResponse>;
23
+ /**
24
+ * Retrieves an access token for the personal storage service.
25
+ *
26
+ * @param identifier - A user-provided identifier (usually a user ID) that is associated with the token.
27
+ * @returns A promise that resolves with the access token and expiration time.
28
+ */
29
+ getAccessToken(identifier: string): Promise<PsGetAccessTokenResponse>;
30
+ /**
31
+ * Extracts text data from a document.
32
+ * @param documentId - The ID of the document to extract text data from.
33
+ * @param identifier - A user-provided identifier (usually a user ID) that is associated with the document.
34
+ * @returns A promise that resolves with the extracted text data.
35
+ */
36
+ extractDataFromDocument(documentId: string, identifier: string): Promise<DocumentTextDataResponse>;
37
+ /**
38
+ * Indexes a document or folder for AI processing.
39
+ *
40
+ * @param documentOrFolderId - The ID of the document or folder to be indexed.
41
+ * @param identifier - A user-provided identifier (usually a user ID) that will be associated with the document.
42
+ * @param aiProfileId - The profile ID for the AI processing configuration.
43
+ * @param aiIntegrationId - The integration ID for the AI processing configuration.
44
+ * @param metadata - Metadata to include with the index
45
+ * @returns A promise that resolves when the document or folder is successfully indexed.
46
+ */
47
+ indexDocumentOrFolder(documentOrFolderId: string, identifier: string, aiProfileId: string, aiIntegrationId: string, metadata?: AiContextMetadata): Promise<void>;
48
+ /**
49
+ * Unindexes a previously indexed document, removing it from AI processing.
50
+ *
51
+ * @param documentId - The ID of the document to be unindexed.
52
+ * @param identifier - A user-provided identifier (usually a user ID) that was associated with the document.
53
+ * @param aiProfileId - The profile ID for the AI processing configuration.
54
+ * @param aiIntegrationId - The integration ID for the AI processing configuration.
55
+ * @returns A promise that resolves when the document is successfully unindexed.
56
+ */
57
+ unindexDocument(documentId: string, identifier: string, aiProfileId: string, aiIntegrationId: string): Promise<void>;
58
+ }
59
+ export {};
@@ -9,6 +9,7 @@ import { SecretClient } from './secret.client';
9
9
  import { StorageClient } from './storage-client';
10
10
  import { TransactionId } from './types';
11
11
  import { ExtractionClient } from './extraction-client';
12
+ import { PersonalStorageClient } from './personal-storage-client';
12
13
  /** The different options that can be used to initialize a Squid instance. */
13
14
  export interface SquidOptions {
14
15
  /**
@@ -201,6 +202,7 @@ export declare class Squid {
201
202
  ai(): AiClient;
202
203
  api(): ApiClient;
203
204
  storage(integrationId?: IntegrationId): StorageClient;
205
+ personalStorage(integrationId: IntegrationId): PersonalStorageClient;
204
206
  extraction(): ExtractionClient;
205
207
  get secrets(): SecretClient;
206
208
  /**
@@ -1 +1 @@
1
- export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.268";
1
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.270";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.268",
3
+ "version": "1.0.270",
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",