@squidcloud/client 1.0.148 → 1.0.150

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 (110) hide show
  1. package/dist/cjs/index.js +8793 -8818
  2. package/dist/common/src/ai-assistant.types.d.ts +25 -25
  3. package/dist/common/src/ai-chatbot.context.d.ts +12 -12
  4. package/dist/common/src/ai-chatbot.schemas.d.ts +1 -1
  5. package/dist/common/src/ai-chatbot.types.d.ts +27 -27
  6. package/dist/common/src/api-call.context.d.ts +13 -13
  7. package/dist/common/src/api.types.d.ts +4 -4
  8. package/dist/common/src/application.schemas.d.ts +66 -66
  9. package/dist/common/src/application.types.d.ts +141 -143
  10. package/dist/common/src/backend-function.schemas.d.ts +1 -1
  11. package/dist/common/src/backend-function.types.d.ts +1 -1
  12. package/dist/common/src/backend-run.types.d.ts +2 -2
  13. package/dist/common/src/bundle-api.types.d.ts +41 -43
  14. package/dist/common/src/bundle-data.types.d.ts +5 -5
  15. package/dist/common/src/communication.types.d.ts +10 -8
  16. package/dist/common/src/context.types.d.ts +40 -40
  17. package/dist/common/src/distributed-lock.context.d.ts +4 -4
  18. package/dist/common/src/document.types.d.ts +22 -22
  19. package/dist/common/src/graphql.context.d.ts +7 -7
  20. package/dist/common/src/graphql.types.d.ts +9 -9
  21. package/dist/common/src/heartbeat.types.d.ts +1 -1
  22. package/dist/common/src/http-status.enum.d.ts +50 -50
  23. package/dist/common/src/index.d.ts +54 -57
  24. package/dist/common/src/integrations/ai_chatbot.types.d.ts +31 -31
  25. package/dist/common/src/integrations/api.types.d.ts +80 -80
  26. package/dist/common/src/integrations/auth.types.d.ts +47 -47
  27. package/dist/common/src/integrations/database.types.d.ts +274 -274
  28. package/dist/common/src/integrations/index.d.ts +134 -134
  29. package/dist/common/src/integrations/observability.types.d.ts +23 -23
  30. package/dist/common/src/logger.types.d.ts +21 -21
  31. package/dist/common/src/metrics.types.d.ts +1 -1
  32. package/dist/common/src/mutation.context.d.ts +14 -14
  33. package/dist/common/src/mutation.schemas.d.ts +1 -1
  34. package/dist/common/src/mutation.types.d.ts +53 -53
  35. package/dist/common/src/native-query.context.d.ts +7 -7
  36. package/dist/common/src/native-query.types.d.ts +16 -16
  37. package/dist/common/src/query/base-query-builder.d.ts +147 -147
  38. package/dist/common/src/query/index.d.ts +4 -4
  39. package/dist/common/src/query/pagination.d.ts +62 -62
  40. package/dist/common/src/query/query-context.d.ts +137 -137
  41. package/dist/common/src/query/serialized-query.types.d.ts +24 -24
  42. package/dist/common/src/query.types.d.ts +64 -64
  43. package/dist/common/src/regions.d.ts +1 -1
  44. package/dist/common/src/schema/schema.types.d.ts +54 -54
  45. package/dist/common/src/secret.schemas.d.ts +1 -1
  46. package/dist/common/src/secret.types.d.ts +22 -22
  47. package/dist/common/src/security.types.d.ts +1 -1
  48. package/dist/common/src/socket.schemas.d.ts +1 -1
  49. package/dist/common/src/socket.types.d.ts +5 -5
  50. package/dist/common/src/time-units.d.ts +1 -1
  51. package/dist/common/src/trigger.types.d.ts +1 -1
  52. package/dist/common/src/types.d.ts +14 -14
  53. package/dist/common/src/utils/array.d.ts +1 -1
  54. package/dist/common/src/utils/assert.d.ts +1 -1
  55. package/dist/common/src/utils/error.d.ts +4 -4
  56. package/dist/common/src/utils/global.utils.d.ts +1 -1
  57. package/dist/common/src/utils/http.d.ts +2 -2
  58. package/dist/common/src/utils/id.d.ts +2 -2
  59. package/dist/common/src/utils/lock.manager.d.ts +14 -14
  60. package/dist/common/src/utils/object.d.ts +5 -5
  61. package/dist/common/src/utils/serialization.d.ts +5 -5
  62. package/dist/common/src/utils/transforms.d.ts +18 -18
  63. package/dist/common/src/utils/url.d.ts +1 -1
  64. package/dist/common/src/utils/validation.d.ts +25 -25
  65. package/dist/common/src/webhook-response.d.ts +1 -1
  66. package/dist/common/src/websocket.impl.d.ts +21 -21
  67. package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
  68. package/dist/typescript-client/src/ai-assistant-client.d.ts +73 -73
  69. package/dist/typescript-client/src/ai-chatbot-client.d.ts +174 -174
  70. package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +8 -8
  71. package/dist/typescript-client/src/ai.types.d.ts +61 -61
  72. package/dist/typescript-client/src/api.manager.d.ts +11 -11
  73. package/dist/typescript-client/src/auth.manager.d.ts +26 -26
  74. package/dist/typescript-client/src/backend-function.manager.d.ts +9 -9
  75. package/dist/typescript-client/src/client-id.service.d.ts +27 -27
  76. package/dist/typescript-client/src/collection-reference.d.ts +80 -80
  77. package/dist/typescript-client/src/collection-reference.factory.d.ts +13 -13
  78. package/dist/typescript-client/src/connection-details.d.ts +23 -23
  79. package/dist/typescript-client/src/data.manager.d.ts +174 -174
  80. package/dist/typescript-client/src/destruct.manager.d.ts +12 -12
  81. package/dist/typescript-client/src/distributed-lock.manager.d.ts +16 -16
  82. package/dist/typescript-client/src/document-identity.service.d.ts +12 -12
  83. package/dist/typescript-client/src/document-reference.d.ts +140 -140
  84. package/dist/typescript-client/src/document-reference.factory.d.ts +13 -13
  85. package/dist/typescript-client/src/document-store.d.ts +14 -14
  86. package/dist/typescript-client/src/graphql-client.d.ts +14 -14
  87. package/dist/typescript-client/src/graphql-client.factory.d.ts +11 -11
  88. package/dist/typescript-client/src/index.d.ts +9 -9
  89. package/dist/typescript-client/src/mutation/mutation-sender.d.ts +10 -10
  90. package/dist/typescript-client/src/native-query-manager.d.ts +7 -7
  91. package/dist/typescript-client/src/query/deserializer.d.ts +3 -3
  92. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +161 -161
  93. package/dist/typescript-client/src/query/local-query-manager.d.ts +9 -9
  94. package/dist/typescript-client/src/query/query-builder.factory.d.ts +77 -77
  95. package/dist/typescript-client/src/query/query-sender.d.ts +33 -33
  96. package/dist/typescript-client/src/query/query-subscription.manager.d.ts +131 -131
  97. package/dist/typescript-client/src/query/query.types.d.ts +49 -49
  98. package/dist/typescript-client/src/rate-limiter.d.ts +32 -32
  99. package/dist/typescript-client/src/rpc.manager.d.ts +30 -30
  100. package/dist/typescript-client/src/secret.client.d.ts +22 -22
  101. package/dist/typescript-client/src/socket.manager.d.ts +43 -43
  102. package/dist/typescript-client/src/squid.d.ts +238 -269
  103. package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -1
  104. package/dist/typescript-client/src/testing/setup-tests.d.ts +1 -1
  105. package/dist/typescript-client/src/types.d.ts +2 -2
  106. package/package.json +2 -2
  107. package/dist/common/src/named-query.context.d.ts +0 -4
  108. package/dist/common/src/named-query.schemas.d.ts +0 -1
  109. package/dist/common/src/named-query.types.d.ts +0 -1
  110. package/dist/typescript-client/src/named-query.manager.d.ts +0 -11
@@ -1,73 +1,73 @@
1
- import { RpcManager } from './rpc.manager';
2
- import { AssistantToolType, FunctionName } from '@squidcloud/common';
3
- import { BlobAndFilename } from './types';
4
- /**
5
- * Client class for interacting with an AI Assistant server.
6
- * Provides functionalities like creating and deleting assistants and threads,
7
- * querying assistants, and managing files associated with assistants and threads.
8
- */
9
- export declare class AiAssistantClient {
10
- private readonly rpcManager;
11
- constructor(rpcManager: RpcManager);
12
- /**
13
- * Creates a new AI assistant with specified characteristics.
14
- * @param name - The name of the assistant.
15
- * @param instructions - Instructions for the assistant.
16
- * @param functions - Array of function names annotated with "@aiFunction" in your Squid backend that will be
17
- * available tol the assistant.
18
- * @param toolTypes - Optional array of tool types. If you want to use files for retrieval, you must add them using
19
- * the addFileToAssistant method.
20
- * @returns A promise that resolves to the created assistant's ID.
21
- */
22
- createAssistant(name: string, instructions: string, functions: Array<FunctionName>, toolTypes?: Array<AssistantToolType>): Promise<string>;
23
- /**
24
- * Deletes an AI assistant.
25
- * @param assistantId - The ID of the assistant to be deleted.
26
- * @returns A promise that resolves when the assistant is deleted.
27
- */
28
- deleteAssistant(assistantId: string): Promise<void>;
29
- /**
30
- * Creates a new thread for an AI assistant. A thread is a long-lived conversation with the assistant that you can
31
- * always send questions to.
32
- * @param assistantId - The ID of the assistant for which the thread is created.
33
- * @returns A promise that resolves to the created thread's ID.
34
- */
35
- createThread(assistantId: string): Promise<string>;
36
- /**
37
- * Deletes a thread of an AI assistant.
38
- * @param threadId - The ID of the thread to be deleted.
39
- * @returns A promise that resolves when the thread is deleted.
40
- */
41
- deleteThread(threadId: string): Promise<void>;
42
- /**
43
- * Queries an AI assistant within a specific thread.
44
- * @param assistantId - The ID of the assistant.
45
- * @param threadId - The ID of the thread.
46
- * @param prompt - The query prompt.
47
- * @param fileIds - Optional array of file IDs to include in the query. These file IDs need to be added using the
48
- * addFileToThread method.
49
- * @returns A promise that resolves to the assistant's response.
50
- */
51
- queryAssistant(assistantId: string, threadId: string, prompt: string, fileIds?: string[]): Promise<string>;
52
- /**
53
- * Adds a file to an AI assistant that can be available for retrieval or code analyzer.
54
- * @param assistantId - The ID of the assistant.
55
- * @param file - The file or blob and filename to be added.
56
- * @returns A promise that resolves to the ID of the added file.
57
- */
58
- addFileToAssistant(assistantId: string, file: File | BlobAndFilename): Promise<string>;
59
- /**
60
- * Removes a file from an AI assistant.
61
- * @param assistantId - The ID of the assistant.
62
- * @param fileId - The ID of the file to be removed.
63
- * @returns A promise that resolves when the file is removed.
64
- */
65
- removeFileFromAssistant(assistantId: string, fileId: string): Promise<void>;
66
- /**
67
- * Adds a file to a specific thread of an AI assistant. These files can be used when asking a question in the thread.
68
- * @param threadId - The ID of the thread.
69
- * @param file - The file or blob and filename to be added.
70
- * @returns A promise that resolves to the ID of the added file.
71
- */
72
- addFileToThread(threadId: string, file: File | BlobAndFilename): Promise<string>;
73
- }
1
+ import { RpcManager } from './rpc.manager';
2
+ import { AssistantToolType, FunctionName } from '@squidcloud/common';
3
+ import { BlobAndFilename } from './types';
4
+ /**
5
+ * Client class for interacting with an AI Assistant server.
6
+ * Provides functionalities like creating and deleting assistants and threads,
7
+ * querying assistants, and managing files associated with assistants and threads.
8
+ */
9
+ export declare class AiAssistantClient {
10
+ private readonly rpcManager;
11
+ constructor(rpcManager: RpcManager);
12
+ /**
13
+ * Creates a new AI assistant with specified characteristics.
14
+ * @param name - The name of the assistant.
15
+ * @param instructions - Instructions for the assistant.
16
+ * @param functions - Array of function names annotated with "@aiFunction" in your Squid backend that will be
17
+ * available tol the assistant.
18
+ * @param toolTypes - Optional array of tool types. If you want to use files for retrieval, you must add them using
19
+ * the addFileToAssistant method.
20
+ * @returns A promise that resolves to the created assistant's ID.
21
+ */
22
+ createAssistant(name: string, instructions: string, functions: Array<FunctionName>, toolTypes?: Array<AssistantToolType>): Promise<string>;
23
+ /**
24
+ * Deletes an AI assistant.
25
+ * @param assistantId - The ID of the assistant to be deleted.
26
+ * @returns A promise that resolves when the assistant is deleted.
27
+ */
28
+ deleteAssistant(assistantId: string): Promise<void>;
29
+ /**
30
+ * Creates a new thread for an AI assistant. A thread is a long-lived conversation with the assistant that you can
31
+ * always send questions to.
32
+ * @param assistantId - The ID of the assistant for which the thread is created.
33
+ * @returns A promise that resolves to the created thread's ID.
34
+ */
35
+ createThread(assistantId: string): Promise<string>;
36
+ /**
37
+ * Deletes a thread of an AI assistant.
38
+ * @param threadId - The ID of the thread to be deleted.
39
+ * @returns A promise that resolves when the thread is deleted.
40
+ */
41
+ deleteThread(threadId: string): Promise<void>;
42
+ /**
43
+ * Queries an AI assistant within a specific thread.
44
+ * @param assistantId - The ID of the assistant.
45
+ * @param threadId - The ID of the thread.
46
+ * @param prompt - The query prompt.
47
+ * @param fileIds - Optional array of file IDs to include in the query. These file IDs need to be added using the
48
+ * addFileToThread method.
49
+ * @returns A promise that resolves to the assistant's response.
50
+ */
51
+ queryAssistant(assistantId: string, threadId: string, prompt: string, fileIds?: string[]): Promise<string>;
52
+ /**
53
+ * Adds a file to an AI assistant that can be available for retrieval or code analyzer.
54
+ * @param assistantId - The ID of the assistant.
55
+ * @param file - The file or blob and filename to be added.
56
+ * @returns A promise that resolves to the ID of the added file.
57
+ */
58
+ addFileToAssistant(assistantId: string, file: File | BlobAndFilename): Promise<string>;
59
+ /**
60
+ * Removes a file from an AI assistant.
61
+ * @param assistantId - The ID of the assistant.
62
+ * @param fileId - The ID of the file to be removed.
63
+ * @returns A promise that resolves when the file is removed.
64
+ */
65
+ removeFileFromAssistant(assistantId: string, fileId: string): Promise<void>;
66
+ /**
67
+ * Adds a file to a specific thread of an AI assistant. These files can be used when asking a question in the thread.
68
+ * @param threadId - The ID of the thread.
69
+ * @param file - The file or blob and filename to be added.
70
+ * @returns A promise that resolves to the ID of the added file.
71
+ */
72
+ addFileToThread(threadId: string, file: File | BlobAndFilename): Promise<string>;
73
+ }
@@ -1,174 +1,174 @@
1
- import { AiChatbotChatOptions, AiChatbotContext, AiModelName, IntegrationId } from '@squidcloud/common';
2
- import { Observable } from 'rxjs';
3
- import { RpcManager } from './rpc.manager';
4
- import { SocketManager } from './socket.manager';
5
- export declare class AiChatbotClient {
6
- private readonly rpcManager;
7
- private readonly socketManager;
8
- private readonly integrationId;
9
- private readonly ongoingChatSequences;
10
- constructor(rpcManager: RpcManager, socketManager: SocketManager, integrationId: IntegrationId);
11
- /**
12
- * Retrieves a profile reference for the provided id. A profile reference
13
- * can be used to create and update profiles, add instructions and context
14
- * and start chats.
15
- *
16
- * @param id - The id of the profile.
17
- * @returns The profile reference.
18
- */
19
- profile(id: string): AiChatbotProfileReference;
20
- /**
21
- * Sends a prompt to the specified profile id.
22
- *
23
- * @param profileId - The profile id.
24
- * @param prompt - The prompt.
25
- * @param options - The options to send to the chat model.
26
- * @returns An observable that emits when a new response token is received. The emitted value is the entire response
27
- * that has been received so far.
28
- */
29
- chat(profileId: string, prompt: string, options?: AiChatbotChatOptions): Observable<string>;
30
- private handleChatResponse;
31
- }
32
- export declare class AiChatbotProfileReference {
33
- private readonly client;
34
- private readonly integrationId;
35
- private readonly profileId;
36
- constructor(client: AiChatbotClient, integrationId: IntegrationId, profileId: string);
37
- /**
38
- * Sends a prompt to the current profile.
39
- *
40
- * @param prompt - The prompt.
41
- * @param options - The chat options.
42
- * @returns An observable that emits when a new response token is received. The emitted value is the entire response
43
- * that has been received so far.
44
- */
45
- chat(prompt: string, options?: AiChatbotChatOptions): Observable<string>;
46
- /**
47
- * Retrieves a context reference for the current profile. A context reference can be used to add a new context entry
48
- * to the profile, or update/delete an existing entry context.
49
- *
50
- * @param id - The id of the context entry. If no id is passed, an id will be
51
- * generated and the reference will point to a new context entry.
52
- * @returns The context reference.
53
- */
54
- context(id?: string): AiChatbotContextReference;
55
- /**
56
- * Retrieves an instruction reference for the current profile. An instruction reference can be used to add a new
57
- * instruction entry to the profile, or update/delete an existing instruction entry.
58
- *
59
- * @param id - The id of the instruction entry. If no id is passed, an id will be
60
- * generated and the reference will point to a new instruction entry.
61
- * @returns The instruction reference.
62
- */
63
- instruction(id?: string): AiChatbotInstructionReference;
64
- /**
65
- * Adds a new profile to the chat bot. This will result in an error if a profile already exists with the same id.
66
- *
67
- * @param data An object containing options for creating the profile.
68
- * @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-2`).
69
- * @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
70
- * @returns A promise that resolves when the profile is successfully created.
71
- */
72
- insert(data: {
73
- modelName: AiModelName;
74
- isPublic: boolean;
75
- }): Promise<void>;
76
- /**
77
- * Updates an existing chatbot profile. This will result in an error if a profile has not yet been created for the
78
- * current profile id.
79
- *
80
- * @param data An object containing options for updating the profile.
81
- * @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-2`).
82
- * @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
83
- * @returns A promise that resolves when the profile is successfully updated.
84
- */
85
- update(data: {
86
- modelName?: AiModelName;
87
- isPublic?: boolean;
88
- }): Promise<void>;
89
- /**
90
- * Deletes an existing chatbot profile. This will result in an error if a profile has not yet been created for the
91
- * current profile id.
92
- *
93
- * @returns A promise that resolves when the profile is successfully deleted.
94
- */
95
- delete(): Promise<void>;
96
- }
97
- declare class AiChatbotContextReference {
98
- private readonly client;
99
- private readonly integrationId;
100
- private readonly profileId;
101
- private readonly id;
102
- constructor(client: AiChatbotClient, integrationId: IntegrationId, profileId: string, id?: string);
103
- /**
104
- * Adds a new context entry to the chatbot profile. This will result in an error if an entry already exists with
105
- * the same id.
106
- *
107
- * @param data An object containing options for creating the entry.
108
- * @param data.title - The title of the entry.
109
- * @param data.context - The context data.
110
- * @param file - The file to insert.
111
- * @returns A promise that resolves when the context is successfully created.
112
- */
113
- insert(data: {
114
- title: string;
115
- context: AiChatbotContext;
116
- }, file?: File): Promise<void>;
117
- /**
118
- * Updates an existing context entry on the chatbot profile. This will result in an error if an entry has not yet
119
- * been created for the current context id.
120
- *
121
- * @param data An object containing options for updated the entry.
122
- * @param data.title - The title of the entry.
123
- * @param data.context - The context data.
124
- * @returns A promise that resolves when the context is successfully updated.
125
- */
126
- update(data: {
127
- title?: string;
128
- context?: AiChatbotContext;
129
- }): Promise<void>;
130
- /**
131
- * Deletes an existing context entry on the chatbot profile. This will result in an error if an entry has not yet
132
- * been created for the current context id.
133
- *
134
- * @returns A promise that resolves when the context is successfully deleted.
135
- */
136
- delete(): Promise<void>;
137
- }
138
- declare class AiChatbotInstructionReference {
139
- private readonly client;
140
- private readonly integrationId;
141
- private readonly profileId;
142
- private readonly id;
143
- constructor(client: AiChatbotClient, integrationId: IntegrationId, profileId: string, id?: string);
144
- /**
145
- * Adds a new instruction entry to the chatbot profile. This will result in an error if an entry already exists with
146
- * the same id.
147
- *
148
- * @param data An object containing options for creating the entry.
149
- * @param data.instruction - The instruction data.
150
- * @returns A promise that resolves when the instruction is successfully created.
151
- */
152
- insert(data: {
153
- instruction: string;
154
- }): Promise<void>;
155
- /**
156
- * Updates an existing instruction entry on the chatbot profile. This will result in an error if an entry has not
157
- * yet been created for the current instruction id.
158
- *
159
- * @param data An object containing options for updated the entry.
160
- * @param data.instruction - The instruction data.
161
- * @returns A promise that resolves when the instruction is successfully updated.
162
- */
163
- update(data: {
164
- instruction: string;
165
- }): Promise<void>;
166
- /**
167
- * Deletes an existing instruction entry on the chatbot profile. This will result in an error if an entry has not
168
- * yet been created for the current instruction id.
169
- *
170
- * @returns A promise that resolves when the instruction is successfully deleted.
171
- */
172
- delete(): Promise<void>;
173
- }
174
- export {};
1
+ import { AiChatbotChatOptions, AiChatbotContext, AiModelName, IntegrationId } from '@squidcloud/common';
2
+ import { Observable } from 'rxjs';
3
+ import { RpcManager } from './rpc.manager';
4
+ import { SocketManager } from './socket.manager';
5
+ export declare class AiChatbotClient {
6
+ private readonly rpcManager;
7
+ private readonly socketManager;
8
+ private readonly integrationId;
9
+ private readonly ongoingChatSequences;
10
+ constructor(rpcManager: RpcManager, socketManager: SocketManager, integrationId: IntegrationId);
11
+ /**
12
+ * Retrieves a profile reference for the provided id. A profile reference
13
+ * can be used to create and update profiles, add instructions and context
14
+ * and start chats.
15
+ *
16
+ * @param id - The id of the profile.
17
+ * @returns The profile reference.
18
+ */
19
+ profile(id: string): AiChatbotProfileReference;
20
+ /**
21
+ * Sends a prompt to the specified profile id.
22
+ *
23
+ * @param profileId - The profile id.
24
+ * @param prompt - The prompt.
25
+ * @param options - The options to send to the chat model.
26
+ * @returns An observable that emits when a new response token is received. The emitted value is the entire response
27
+ * that has been received so far.
28
+ */
29
+ chat(profileId: string, prompt: string, options?: AiChatbotChatOptions): Observable<string>;
30
+ private handleChatResponse;
31
+ }
32
+ export declare class AiChatbotProfileReference {
33
+ private readonly client;
34
+ private readonly integrationId;
35
+ private readonly profileId;
36
+ constructor(client: AiChatbotClient, integrationId: IntegrationId, profileId: string);
37
+ /**
38
+ * Sends a prompt to the current profile.
39
+ *
40
+ * @param prompt - The prompt.
41
+ * @param options - The chat options.
42
+ * @returns An observable that emits when a new response token is received. The emitted value is the entire response
43
+ * that has been received so far.
44
+ */
45
+ chat(prompt: string, options?: AiChatbotChatOptions): Observable<string>;
46
+ /**
47
+ * Retrieves a context reference for the current profile. A context reference can be used to add a new context entry
48
+ * to the profile, or update/delete an existing entry context.
49
+ *
50
+ * @param id - The id of the context entry. If no id is passed, an id will be
51
+ * generated and the reference will point to a new context entry.
52
+ * @returns The context reference.
53
+ */
54
+ context(id?: string): AiChatbotContextReference;
55
+ /**
56
+ * Retrieves an instruction reference for the current profile. An instruction reference can be used to add a new
57
+ * instruction entry to the profile, or update/delete an existing instruction entry.
58
+ *
59
+ * @param id - The id of the instruction entry. If no id is passed, an id will be
60
+ * generated and the reference will point to a new instruction entry.
61
+ * @returns The instruction reference.
62
+ */
63
+ instruction(id?: string): AiChatbotInstructionReference;
64
+ /**
65
+ * Adds a new profile to the chat bot. This will result in an error if a profile already exists with the same id.
66
+ *
67
+ * @param data An object containing options for creating the profile.
68
+ * @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-2`).
69
+ * @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
70
+ * @returns A promise that resolves when the profile is successfully created.
71
+ */
72
+ insert(data: {
73
+ modelName: AiModelName;
74
+ isPublic: boolean;
75
+ }): Promise<void>;
76
+ /**
77
+ * Updates an existing chatbot profile. This will result in an error if a profile has not yet been created for the
78
+ * current profile id.
79
+ *
80
+ * @param data An object containing options for updating the profile.
81
+ * @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-2`).
82
+ * @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
83
+ * @returns A promise that resolves when the profile is successfully updated.
84
+ */
85
+ update(data: {
86
+ modelName?: AiModelName;
87
+ isPublic?: boolean;
88
+ }): Promise<void>;
89
+ /**
90
+ * Deletes an existing chatbot profile. This will result in an error if a profile has not yet been created for the
91
+ * current profile id.
92
+ *
93
+ * @returns A promise that resolves when the profile is successfully deleted.
94
+ */
95
+ delete(): Promise<void>;
96
+ }
97
+ declare class AiChatbotContextReference {
98
+ private readonly client;
99
+ private readonly integrationId;
100
+ private readonly profileId;
101
+ private readonly id;
102
+ constructor(client: AiChatbotClient, integrationId: IntegrationId, profileId: string, id?: string);
103
+ /**
104
+ * Adds a new context entry to the chatbot profile. This will result in an error if an entry already exists with
105
+ * the same id.
106
+ *
107
+ * @param data An object containing options for creating the entry.
108
+ * @param data.title - The title of the entry.
109
+ * @param data.context - The context data.
110
+ * @param file - The file to insert.
111
+ * @returns A promise that resolves when the context is successfully created.
112
+ */
113
+ insert(data: {
114
+ title: string;
115
+ context: AiChatbotContext;
116
+ }, file?: File): Promise<void>;
117
+ /**
118
+ * Updates an existing context entry on the chatbot profile. This will result in an error if an entry has not yet
119
+ * been created for the current context id.
120
+ *
121
+ * @param data An object containing options for updated the entry.
122
+ * @param data.title - The title of the entry.
123
+ * @param data.context - The context data.
124
+ * @returns A promise that resolves when the context is successfully updated.
125
+ */
126
+ update(data: {
127
+ title?: string;
128
+ context?: AiChatbotContext;
129
+ }): Promise<void>;
130
+ /**
131
+ * Deletes an existing context entry on the chatbot profile. This will result in an error if an entry has not yet
132
+ * been created for the current context id.
133
+ *
134
+ * @returns A promise that resolves when the context is successfully deleted.
135
+ */
136
+ delete(): Promise<void>;
137
+ }
138
+ declare class AiChatbotInstructionReference {
139
+ private readonly client;
140
+ private readonly integrationId;
141
+ private readonly profileId;
142
+ private readonly id;
143
+ constructor(client: AiChatbotClient, integrationId: IntegrationId, profileId: string, id?: string);
144
+ /**
145
+ * Adds a new instruction entry to the chatbot profile. This will result in an error if an entry already exists with
146
+ * the same id.
147
+ *
148
+ * @param data An object containing options for creating the entry.
149
+ * @param data.instruction - The instruction data.
150
+ * @returns A promise that resolves when the instruction is successfully created.
151
+ */
152
+ insert(data: {
153
+ instruction: string;
154
+ }): Promise<void>;
155
+ /**
156
+ * Updates an existing instruction entry on the chatbot profile. This will result in an error if an entry has not
157
+ * yet been created for the current instruction id.
158
+ *
159
+ * @param data An object containing options for updated the entry.
160
+ * @param data.instruction - The instruction data.
161
+ * @returns A promise that resolves when the instruction is successfully updated.
162
+ */
163
+ update(data: {
164
+ instruction: string;
165
+ }): Promise<void>;
166
+ /**
167
+ * Deletes an existing instruction entry on the chatbot profile. This will result in an error if an entry has not
168
+ * yet been created for the current instruction id.
169
+ *
170
+ * @returns A promise that resolves when the instruction is successfully deleted.
171
+ */
172
+ delete(): Promise<void>;
173
+ }
174
+ export {};
@@ -1,8 +1,8 @@
1
- import { RpcManager } from './rpc.manager';
2
- import { SocketManager } from './socket.manager';
3
- export declare class AiChatbotClientFactory {
4
- private readonly rpcManager;
5
- private readonly socketManager;
6
- private readonly chatbotsMap;
7
- constructor(rpcManager: RpcManager, socketManager: SocketManager);
8
- }
1
+ import { RpcManager } from './rpc.manager';
2
+ import { SocketManager } from './socket.manager';
3
+ export declare class AiChatbotClientFactory {
4
+ private readonly rpcManager;
5
+ private readonly socketManager;
6
+ private readonly chatbotsMap;
7
+ constructor(rpcManager: RpcManager, socketManager: SocketManager);
8
+ }
@@ -1,61 +1,61 @@
1
- import { IntegrationId } from '@squidcloud/common';
2
- import { AiChatbotClient } from './ai-chatbot-client';
3
- import { AiChatbotClientFactory } from './ai-chatbot-client.factory';
4
- import { RpcManager } from './rpc.manager';
5
- import { AiAssistantClient } from './ai-assistant-client';
6
- export interface ExecuteAiQueryRequest {
7
- integrationId: IntegrationId;
8
- prompt: string;
9
- }
10
- export interface ExecuteAiQueryResponse {
11
- answer: string;
12
- explanation?: string;
13
- executedQuery?: string;
14
- }
15
- /**
16
- * AiClient class serves as a facade for interacting with different AI services.
17
- * It provides simplified access to AI chatbot and assistant functionalities
18
- * through its methods.
19
- */
20
- export declare class AiClient {
21
- private readonly aiChatbotClientFactory;
22
- private readonly rpcManager;
23
- private readonly aiAssistantClient;
24
- constructor(aiChatbotClientFactory: AiChatbotClientFactory, rpcManager: RpcManager);
25
- /**
26
- * Retrieves an AI chatbot client for a specific AI integration.
27
- * @param aiIntegrationId - The identifier for the AI integration.
28
- * @returns An instance of AiChatbotClient associated with the given AI integration ID.
29
- */
30
- chatbot(aiIntegrationId: IntegrationId): AiChatbotClient;
31
- /**
32
- * Retrieves the AI assistant client.
33
- * @returns An instance of AiAssistantClient.
34
- */
35
- assistant(): AiAssistantClient;
36
- /**
37
- * Executes an AI query using a specific DB integration, sending a prompt to the AI and returning its response.
38
- * This function allows for direct interaction with the AI's capabilities by sending text prompts and receiving
39
- * the AI's responses, which can be used for various applications such as automating tasks, generating content,
40
- * or obtaining information.
41
- *
42
- * @param integrationId The identifier for the DB integration which is used to direct the query to the
43
- * appropriate DB.
44
- * @param prompt The text prompt to send to the AI. This should be formulated in a way that the AI can
45
- * understand and respond to, taking into account the nature of the task or the information
46
- * sought.
47
- * @returns A promise that resolves to an `ExecuteAiQueryResponse`. This response includes the AI's
48
- * reply to the provided prompt, along with any other relevant information that is part of
49
- * the AI's response. The promise can be awaited to handle the response asynchronously.
50
- *
51
- * @example
52
- * ```
53
- * const response = await ai().executeAiQuery(myDbIntegrationId, "How many transactions ran yesterday?");
54
- * console.log(response);
55
- * ```
56
- *
57
- * For more details on the usage and capabilities of the AI Assistant, refer to the documentation provided at
58
- * {@link https://docs.squid.cloud/docs/ai}.
59
- */
60
- executeAiQuery(integrationId: IntegrationId, prompt: string): Promise<ExecuteAiQueryResponse>;
61
- }
1
+ import { IntegrationId } from '@squidcloud/common';
2
+ import { AiChatbotClient } from './ai-chatbot-client';
3
+ import { AiChatbotClientFactory } from './ai-chatbot-client.factory';
4
+ import { RpcManager } from './rpc.manager';
5
+ import { AiAssistantClient } from './ai-assistant-client';
6
+ export interface ExecuteAiQueryRequest {
7
+ integrationId: IntegrationId;
8
+ prompt: string;
9
+ }
10
+ export interface ExecuteAiQueryResponse {
11
+ answer: string;
12
+ explanation?: string;
13
+ executedQuery?: string;
14
+ }
15
+ /**
16
+ * AiClient class serves as a facade for interacting with different AI services.
17
+ * It provides simplified access to AI chatbot and assistant functionalities
18
+ * through its methods.
19
+ */
20
+ export declare class AiClient {
21
+ private readonly aiChatbotClientFactory;
22
+ private readonly rpcManager;
23
+ private readonly aiAssistantClient;
24
+ constructor(aiChatbotClientFactory: AiChatbotClientFactory, rpcManager: RpcManager);
25
+ /**
26
+ * Retrieves an AI chatbot client for a specific AI integration.
27
+ * @param aiIntegrationId - The identifier for the AI integration.
28
+ * @returns An instance of AiChatbotClient associated with the given AI integration ID.
29
+ */
30
+ chatbot(aiIntegrationId: IntegrationId): AiChatbotClient;
31
+ /**
32
+ * Retrieves the AI assistant client.
33
+ * @returns An instance of AiAssistantClient.
34
+ */
35
+ assistant(): AiAssistantClient;
36
+ /**
37
+ * Executes an AI query using a specific DB integration, sending a prompt to the AI and returning its response.
38
+ * This function allows for direct interaction with the AI's capabilities by sending text prompts and receiving
39
+ * the AI's responses, which can be used for various applications such as automating tasks, generating content,
40
+ * or obtaining information.
41
+ *
42
+ * @param integrationId The identifier for the DB integration which is used to direct the query to the
43
+ * appropriate DB.
44
+ * @param prompt The text prompt to send to the AI. This should be formulated in a way that the AI can
45
+ * understand and respond to, taking into account the nature of the task or the information
46
+ * sought.
47
+ * @returns A promise that resolves to an `ExecuteAiQueryResponse`. This response includes the AI's
48
+ * reply to the provided prompt, along with any other relevant information that is part of
49
+ * the AI's response. The promise can be awaited to handle the response asynchronously.
50
+ *
51
+ * @example
52
+ * ```
53
+ * const response = await ai().executeAiQuery(myDbIntegrationId, "How many transactions ran yesterday?");
54
+ * console.log(response);
55
+ * ```
56
+ *
57
+ * For more details on the usage and capabilities of the AI Assistant, refer to the documentation provided at
58
+ * {@link https://docs.squid.cloud/docs/ai}.
59
+ */
60
+ executeAiQuery(integrationId: IntegrationId, prompt: string): Promise<ExecuteAiQueryResponse>;
61
+ }