@squidcloud/client 1.0.326 → 1.0.327

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 (25) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +64 -39
  3. package/dist/internal-common/src/public-types/communication.public-types.d.ts +0 -1
  4. package/dist/internal-common/src/public-types/http-status.enum.d.ts +414 -50
  5. package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
  6. package/dist/internal-common/src/public-types/query.public-types.d.ts +1 -0
  7. package/dist/internal-common/src/public-types/socket.public-types.d.ts +3 -5
  8. package/dist/internal-common/src/types/ai-agent.types.d.ts +1 -34
  9. package/dist/internal-common/src/utils/validation.d.ts +3 -4
  10. package/dist/typescript-client/src/admin-client.d.ts +0 -3
  11. package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +36 -0
  12. package/dist/typescript-client/src/agent/ai-agent-client.d.ts +13 -0
  13. package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +17 -0
  14. package/dist/typescript-client/src/ai-client.d.ts +3 -2
  15. package/dist/typescript-client/src/collection-reference.d.ts +1 -1
  16. package/dist/typescript-client/src/document-reference.d.ts +1 -1
  17. package/dist/typescript-client/src/index.d.ts +4 -2
  18. package/dist/typescript-client/src/public-types.d.ts +0 -1
  19. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +1 -1
  20. package/dist/typescript-client/src/squid.d.ts +4 -4
  21. package/dist/typescript-client/src/version.d.ts +1 -1
  22. package/package.json +1 -1
  23. package/dist/internal-common/src/public-types/integrations/ai_agent.public-types.d.ts +0 -47
  24. package/dist/typescript-client/src/agent-client.d.ts +0 -6
  25. package/dist/typescript-client/src/ai-agent-client.d.ts +0 -228
@@ -1,5 +1,3 @@
1
- export declare enum ClientConnectionState {
2
- CONNECTED = "CONNECTED",
3
- DISCONNECTED = "DISCONNECTED",
4
- REMOVED = "REMOVED"
5
- }
1
+ export declare const CLIENT_CONNECTION_STATES: readonly ["CONNECTED", "DISCONNECTED", "REMOVED"];
2
+ /** Squid client connection state. */
3
+ export type ClientConnectionState = (typeof CLIENT_CONNECTION_STATES)[number];
@@ -1,34 +1 @@
1
- import { AiChatPromptQuotas, AiConnectedAgentMetadata, AiConnectedIntegrationMetadata, AiFileUrl } from '../public-types/ai-agent.public-types';
2
- import { AiAgentId } from '../public-types/communication.public-types';
3
- import { FunctionName, FunctionNameWithContext } from '../public-types/bundle-data.public-types';
4
- export type AiChatResponseFormat = 'text' | 'json_object';
5
- export interface AiChatOptions {
6
- maxTokens: number;
7
- responseFormat: AiChatResponseFormat;
8
- temperature: number;
9
- topP: number;
10
- instructions: Array<string>;
11
- clientId: string;
12
- fileUrls: Array<AiFileUrl>;
13
- /** Constrains effort on reasoning for reasoning models. o1 models only. */
14
- reasoningEffort?: 'low' | 'medium' | 'high';
15
- /** Current AI profile ID (AI agent ID). */
16
- agentId?: AiAgentId;
17
- /** A unique chat ID for the conversation. */
18
- chatId?: string;
19
- /** A unique ID for the currentt trace. */
20
- traceId?: string;
21
- /** Global per-agent context passed to all AI functions. Must be a serializable JSON. */
22
- agentContext?: Record<string, unknown>;
23
- /** List of AI functions available for the agent. Overrides the stored list.*/
24
- functions?: Array<FunctionName | FunctionNameWithContext>;
25
- /** List of connected AI agents can be called by the current agent. Overrides the stored list.*/
26
- connectedAgents?: Array<AiConnectedAgentMetadata>;
27
- /** List of connected integrations. Overrides the stored list. */
28
- connectedIntegrations?: Array<AiConnectedIntegrationMetadata>;
29
- /** Current budget for nested or recursive AI chat calls per single prompt. */
30
- quotas?: AiChatPromptQuotas;
31
- /** Enables grounding with real-time web search to enhance AI responses with up-to-date information.
32
- * Currently supported only for gemini-2.0-flash. */
33
- groundingWithWebSearch?: boolean;
34
- }
1
+ export {};
@@ -1,9 +1,8 @@
1
- import { HttpStatus } from '../public-types/http-status.enum';
2
- export type StatusCode = HttpStatus.BAD_REQUEST | HttpStatus.NOT_FOUND | HttpStatus.FORBIDDEN | HttpStatus.UNAUTHORIZED | HttpStatus.CONFLICT | HttpStatus.INTERNAL_SERVER_ERROR;
1
+ import { HttpStatusCode } from '../public-types/http-status.enum';
3
2
  export declare class ValidationError extends Error {
4
- readonly statusCode: StatusCode;
3
+ readonly statusCode: HttpStatusCode;
5
4
  readonly details?: any;
6
- constructor(error: string, statusCode: StatusCode, details?: Record<string, any>);
5
+ constructor(error: string, statusCode: HttpStatusCode, details?: Record<string, any>);
7
6
  }
8
7
  export declare function isValidId(id: unknown, maxLength?: number): boolean;
9
8
  export declare function validateFieldSort(fieldSort: unknown): void;
@@ -1,14 +1,11 @@
1
1
  import { IntegrationClient } from './integration-client';
2
2
  import { SecretClient } from './secret.client';
3
- import { AgentClient } from './agent-client';
4
3
  export declare class AdminClient {
5
4
  private readonly rpcManager;
6
5
  private readonly region;
7
6
  private readonly appId;
8
7
  private readonly integrationClient;
9
8
  private readonly secretClient;
10
- private readonly agentClient;
11
9
  integrations(): IntegrationClient;
12
10
  secrets(): SecretClient;
13
- agents(): AgentClient;
14
11
  }
@@ -0,0 +1,36 @@
1
+ import { AgentContextRequest, AiAgent, AiAgentChatOptions, AiAgentContext, AiChatModelName, AiConnectedAgentMetadata, AiObserveStatusOptions, AiSearchOptions, AiSearchResponse, AiStatusMessage, AiTranscribeAndAskResponse, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
2
+ import { BlobAndFilename } from '../types';
3
+ import { Observable } from 'rxjs';
4
+ import { AskOptionsWithoutVoice, AskWithVoiceResponse, ChatOptionsWithoutVoice, TranscribeAndAskWithVoiceResponse, TranscribeAndChatResponse } from './ai-agent-client.types';
5
+ export type UpsertAgentRequestParams = Omit<UpsertAgentRequest, 'id'>;
6
+ export declare class AiAgentReference {
7
+ private readonly agentId;
8
+ private readonly ongoingChatSequences;
9
+ private readonly statusUpdates;
10
+ private readonly rpcManager;
11
+ get(): Promise<AiAgent | undefined>;
12
+ upsert(agent: UpsertAgentRequestParams): Promise<void>;
13
+ delete(): Promise<void>;
14
+ updateInstructions(instructions: string): Promise<void>;
15
+ updateModel(model: AiChatModelName): Promise<void>;
16
+ updateConnectedAgents(connectedAgents: Array<AiConnectedAgentMetadata>): Promise<void>;
17
+ getContext(contextId: string): Promise<AiAgentContext | undefined>;
18
+ listContexts(): Promise<Array<AiAgentContext>>;
19
+ deleteContext(contextId: string): Promise<void>;
20
+ deleteContexts(contextIds: Array<string>): Promise<void>;
21
+ upsertContext(contextRequest: AgentContextRequest, file?: File | BlobAndFilename): Promise<void>;
22
+ upsertContexts(contextRequests: Array<AgentContextRequest>, files?: Array<File | BlobAndFilename>): Promise<void>;
23
+ provideFeedback(feedback: string): Promise<void>;
24
+ resetFeedback(): Promise<void>;
25
+ chat(prompt: string, options?: ChatOptionsWithoutVoice): Observable<string>;
26
+ transcribeAndChat(fileToTranscribe: File, options?: ChatOptionsWithoutVoice): Promise<TranscribeAndChatResponse>;
27
+ search(options: AiSearchOptions): Promise<AiSearchResponse>;
28
+ ask(prompt: string, options?: AskOptionsWithoutVoice): Promise<string>;
29
+ observeStatusUpdates(options?: AiObserveStatusOptions): Observable<AiStatusMessage>;
30
+ transcribeAndAsk(fileToTranscribe: File, options?: AskOptionsWithoutVoice): Promise<AiTranscribeAndAskResponse>;
31
+ transcribeAndAskWithVoiceResponse(fileToTranscribe: File, options?: Omit<AiAgentChatOptions, 'smoothTyping'>): Promise<TranscribeAndAskWithVoiceResponse>;
32
+ askWithVoiceResponse(prompt: string, options?: Omit<AiAgentChatOptions, 'smoothTyping'>): Promise<AskWithVoiceResponse>;
33
+ private askInternal;
34
+ private createStatusSubject;
35
+ private chatInternal;
36
+ }
@@ -0,0 +1,13 @@
1
+ import { AiAgent, AiAgentId } from '../public-types';
2
+ import { AiAgentReference } from './ai-agent-client-reference';
3
+ export declare class AiAgentClient {
4
+ private readonly rpcManager;
5
+ private readonly socketManager;
6
+ private readonly ongoingChatSequences;
7
+ private readonly statusUpdates;
8
+ agent(id: AiAgentId): AiAgentReference;
9
+ listAgents(): Promise<Array<AiAgent>>;
10
+ private handleChatResponse;
11
+ private handleStatusMessage;
12
+ private getStatusSubject;
13
+ }
@@ -0,0 +1,17 @@
1
+ import { AiAgentChatOptions } from '../../../internal-common/src/public-types/ai-agent.public-types';
2
+ import { Observable } from 'rxjs';
3
+ export interface TranscribeAndChatResponse {
4
+ transcribedPrompt: string;
5
+ responseStream: Observable<string>;
6
+ }
7
+ export interface TranscribeAndAskWithVoiceResponse {
8
+ transcribedPrompt: string;
9
+ responseString: string;
10
+ voiceResponseFile: File;
11
+ }
12
+ export interface AskWithVoiceResponse {
13
+ responseString: string;
14
+ voiceResponseFile: File;
15
+ }
16
+ export type ChatOptionsWithoutVoice = Omit<AiAgentChatOptions, 'voiceOptions'>;
17
+ export type AskOptionsWithoutVoice = Omit<AiAgentChatOptions, 'voiceOptions' | 'smoothTyping'>;
@@ -1,10 +1,10 @@
1
- import { AiAgentReference } from './ai-agent-client';
2
1
  import { AiAssistantClient } from './ai-assistant-client';
3
- import { AiAgentId, IntegrationId } from './public-types';
2
+ import { AiAgent, AiAgentId, IntegrationId } from './public-types';
4
3
  import { AiImageClient } from './ai-image-client';
5
4
  import { AiAudioClient } from './ai-audio-client';
6
5
  import { AiMatchMakingClient } from './ai-matchmaking-client';
7
6
  import { ExecuteAiApiResponse, ExecuteAiQueryMultiResponse, ExecuteAiQueryOptions, ExecuteAiQueryResponse } from './ai.types';
7
+ import { AiAgentReference } from './agent/ai-agent-client-reference';
8
8
  /**
9
9
  * AiClient class serves as a facade for interacting with different AI services.
10
10
  * It provides simplified access to AI chatbot and assistant functionalities
@@ -16,6 +16,7 @@ export declare class AiClient {
16
16
  private readonly aiAssistantClient;
17
17
  private aiAgentClient?;
18
18
  agent(agentId?: AiAgentId): AiAgentReference;
19
+ listAgents(): Promise<Array<AiAgent>>;
19
20
  /**
20
21
  * Retrieves the AI assistant client.
21
22
  * @returns An instance of AiAssistantClient.
@@ -20,7 +20,7 @@ export interface DocIdAndData<T extends DocumentData> {
20
20
  * collection in a NoSQL database.
21
21
  *
22
22
  * Read more about collection references in the
23
- * {@link https://docs.getsquid.ai/docs/database/collection-reference documentation}.
23
+ * {@link https://docs.getsquid.ai/docs/client-sdk/database/collection-reference documentation}.
24
24
  * @typeParam T The type of the document data.
25
25
  */
26
26
  export declare class CollectionReference<T extends DocumentData> {
@@ -9,7 +9,7 @@ import { DeepRecord, Paths } from '../../internal-common/src/public-types/typesc
9
9
  * use to create a new document.
10
10
  *
11
11
  * Read more about document references in the
12
- * {@link https://docs.getsquid.ai/docs/database/document-reference documentation}.
12
+ * {@link https://docs.getsquid.ai/docs/client-sdk/database/document-reference documentation}.
13
13
  * @typeParam T The type of the document data.
14
14
  */
15
15
  export declare class DocumentReference<T extends DocumentData = any> {
@@ -1,5 +1,5 @@
1
1
  export * from './ai-assistant-client';
2
- export * from './ai-agent-client';
2
+ export * from './agent/ai-agent-client';
3
3
  export * from './ai-image-client';
4
4
  export * from './ai-audio-client';
5
5
  export * from './ai.types';
@@ -38,7 +38,6 @@ export * from './observability-client';
38
38
  export * from './secret.client';
39
39
  export * from './scheduler-client';
40
40
  export * from './integration-client';
41
- export * from './agent-client';
42
41
  export * from './socket.manager';
43
42
  export * from './squid-http-client';
44
43
  export * from './squid';
@@ -51,3 +50,6 @@ export * from './ai-matchmaking-client';
51
50
  export * from './admin-client';
52
51
  export * from './console-utils';
53
52
  export * from './ai-client';
53
+ export * from './agent/ai-agent-client';
54
+ export * from './agent/ai-agent-client.types';
55
+ export * from './agent/ai-agent-client-reference';
@@ -8,7 +8,6 @@ export * from '../../internal-common/src/public-types/context.public-types';
8
8
  export * from '../../internal-common/src/public-types/document.public-types';
9
9
  export * from '../../internal-common/src/public-types/http-status.enum';
10
10
  export * from '../../internal-common/src/public-types/integration.public-types';
11
- export * from '../../internal-common/src/public-types/integrations/ai_agent.public-types';
12
11
  export * from '../../internal-common/src/public-types/integrations/api.public-types';
13
12
  export * from '../../internal-common/src/public-types/metric.public-types';
14
13
  export * from '../../internal-common/src/public-types/mutation.public-types';
@@ -40,7 +40,7 @@ interface HasGrouped {
40
40
  /**
41
41
  * A query builder that can participate in a join.
42
42
  * To learn more about join queries, see the
43
- * {@link https://docs.getsquid.ai/docs/database/queries#joining-data-across-collections-and-integrations
43
+ * {@link https://docs.getsquid.ai/docs/client-sdk/database/queries#joining-data-across-collections-and-integrations
44
44
  * documentation}.
45
45
  */
46
46
  export declare class JoinQueryBuilder<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, LatestAlias extends Alias, RootAlias extends Alias> extends BaseQueryBuilder<ReturnType> implements SnapshotEmitter<WithDocumentReferences<ReturnType>>, HasGrouped, HasDereference {
@@ -142,7 +142,7 @@ export declare class Squid {
142
142
  * If the integrationId is not provided, the `built_in_db` integration id will be used.
143
143
  *
144
144
  * For more information on the CollectionReference object, please refer to the
145
- * {@link https://docs.getsquid.ai/docs/database/collection-reference documentation}.
145
+ * {@link https://docs.getsquid.ai/docs/client-sdk/database/collection-reference documentation}.
146
146
  *
147
147
  * @param collectionName The name of the collection.
148
148
  * @param integrationId The id of the integration, default to `built_in_db`.
@@ -155,7 +155,7 @@ export declare class Squid {
155
155
  * will be atomic. Note that mutations for different integrations will not be atomic.
156
156
  *
157
157
  * For more information about transactions in Squid, please refer to the
158
- * {@link https://docs.getsquid.ai/docs/database/transactions documentation}.
158
+ * {@link https://docs.getsquid.ai/docs/client-sdk/database/transactions documentation}.
159
159
  *
160
160
  * @param fn The callback to run as an atomic change. The function receives a transactionId that should be used for
161
161
  * all the mutations that should be atomic. The function should return a promise.
@@ -177,7 +177,7 @@ export declare class Squid {
177
177
  executeFunction<T = any>(functionName: string, ...params: any[]): Promise<T>;
178
178
  /**
179
179
  * Executes a native relational query with the given parameters and returns a promise with the result.
180
- * See https://docs.getsquid.ai/docs/database/native-queries.
180
+ * See https://docs.getsquid.ai/docs/client-sdk/database/native-queries.
181
181
  *
182
182
  * @param integrationId The id of the integration that the query is associated with.
183
183
  * @param query The raw SQL or other database-specific query to execute.
@@ -188,7 +188,7 @@ export declare class Squid {
188
188
  executeNativeRelationalQuery<T = any>(integrationId: IntegrationId, query: string, params?: Record<string, any>): Promise<Array<T>>;
189
189
  /**
190
190
  * Executes a native Mongo/built-in-db query with the given pipeline and returns a promise with the result.
191
- * See https://docs.getsquid.ai/docs/database/native-queries#native-mongodb-queries.
191
+ * See https://docs.getsquid.ai/docs/client-sdk/database/native-queries#native-mongodb-queries.
192
192
  *
193
193
  * @param integrationId The id of the integration that the query is associated with.
194
194
  * @param collectionName The collection to query.
@@ -1 +1 @@
1
- export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.326";
1
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.327";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.326",
3
+ "version": "1.0.327",
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",
@@ -1,47 +0,0 @@
1
- import { AiChatModelName, AiConnectedAgentMetadata, AiConnectedIntegrationMetadata, AiEmbeddingsModelName, VectorDbType } from '../ai-agent.public-types';
2
- import { FunctionName } from '../bundle-data.public-types';
3
- import { AiAgentId } from '../communication.public-types';
4
- export type AiAgentConfiguration = {
5
- apiKey?: string;
6
- };
7
- export type AiAgentMetadata = {
8
- modelName: AiChatModelName;
9
- description?: string;
10
- isPublic: boolean;
11
- strictContext?: boolean;
12
- instructions: Record<string, string>;
13
- feedbackInstructions?: string;
14
- /** 'text-embedding-ada-002' if undefined. */
15
- embeddingModelName?: AiEmbeddingsModelName;
16
- /** 'pinecone' if undefined. */
17
- vectorDbType?: VectorDbType;
18
- /** List of AI functions attached to the profile by default. */
19
- functions?: Array<FunctionName>;
20
- /** List of child AI agents that can be used by the current agent. */
21
- connectedAgents?: Array<AiConnectedAgentMetadata>;
22
- /** List of connected integrations. */
23
- connectedIntegrations?: Array<AiConnectedIntegrationMetadata>;
24
- auditLog?: boolean;
25
- };
26
- export interface AiAgent extends AiAgentMetadata {
27
- agentId: AiAgentId;
28
- }
29
- export type AiAgentContextMetadata = {
30
- title: string;
31
- text: string;
32
- preview: boolean;
33
- sizeBytes?: number;
34
- type?: 'text' | 'url' | 'file';
35
- };
36
- export type MutableAiAgentMetadataFieldsType = keyof Pick<AiAgentMetadata, 'modelName' | 'description' | 'isPublic' | 'functions' | 'connectedAgents' | 'connectedIntegrations' | 'auditLog'>;
37
- /** List of fields that can be updated in runtime via API. */
38
- export declare const MUTABLE_AI_AGENT_METADATA_FIELDS: Array<MutableAiAgentMetadataFieldsType>;
39
- export interface ListAgentsResponse {
40
- agents: Array<AiAgent>;
41
- }
42
- export interface GetAgentRequest {
43
- agentId: AiAgentId;
44
- }
45
- export interface GetAgentResponse {
46
- agent: AiAgent | undefined;
47
- }
@@ -1,6 +0,0 @@
1
- import { AiAgent, AiAgentId } from './public-types';
2
- export declare class AgentClient {
3
- private readonly rpcManager;
4
- list(): Promise<Array<AiAgent>>;
5
- get(agentId: AiAgentId): Promise<AiAgent | undefined>;
6
- }
@@ -1,228 +0,0 @@
1
- import { AiAgentChatOptions, AiAgentId, AiAgentMetadata, AiContext, AiObserveStatusOptions, AiSearchOptions, AiSearchResponse, AiStatusMessage, AiTranscribeAndAskResponse, AiTranscribeAndChatResponse, MUTABLE_AI_AGENT_METADATA_FIELDS } from './public-types';
2
- import { Observable } from 'rxjs';
3
- import { BlobAndFilename } from './types';
4
- export interface TranscribeAndChatResponse {
5
- transcribedPrompt: string;
6
- responseStream: Observable<string>;
7
- }
8
- export interface TranscribeAndAskWithVoiceResponse {
9
- transcribedPrompt: string;
10
- responseString: string;
11
- voiceResponseFile: File;
12
- }
13
- export interface AskWithVoiceResponse {
14
- responseString: string;
15
- voiceResponseFile: File;
16
- }
17
- export interface ChatInternalResponse {
18
- responseStream: Observable<string>;
19
- serverResponse?: Promise<AiTranscribeAndChatResponse>;
20
- }
21
- export type ChatOptionsWithoutVoice = Omit<AiAgentChatOptions, 'voiceOptions'>;
22
- export type AskOptionsWithoutVoice = Omit<AiAgentChatOptions, 'voiceOptions' | 'smoothTyping'>;
23
- export declare class AiAgentClient {
24
- private readonly rpcManager;
25
- private readonly socketManager;
26
- private readonly ongoingChatSequences;
27
- private readonly statusUpdates;
28
- /**
29
- * Retrieves a reference to an agent with the specified ID.
30
- * The returned agent reference can be used to create and update the agent,
31
- * add instructions and context, and initiate chats.
32
- *
33
- * @param id - The ID of the agent.
34
- * @returns A reference to the agent.
35
- */
36
- agent(id: AiAgentId): AiAgentReference;
37
- /**
38
- * Sends a prompt to the specified agent id.
39
- *
40
- * @param agentId - The agent id.
41
- * @param prompt - The prompt.
42
- * @param options - The options to send to the chat model.
43
- * @returns An observable that emits when a new response token is received. The emitted value is the entire response
44
- * that has been received so far.
45
- */
46
- chat(agentId: AiAgentId, prompt: string, options?: ChatOptionsWithoutVoice): Observable<string>;
47
- transcribeAndChat(agentId: AiAgentId, fileToTranscribe: File, options?: ChatOptionsWithoutVoice): Promise<TranscribeAndChatResponse>;
48
- private chatInternal;
49
- search(agentId: AiAgentId, options: AiSearchOptions): Promise<AiSearchResponse>;
50
- /**
51
- * Sends a prompt to the specified agent id and returns the response as a Promise of string.
52
- *
53
- * @param agentId - The agent id.
54
- * @param prompt - The prompt.
55
- * @param options - The options to send to the chat model.
56
- * @returns A promise that resolves when the chat is complete. The resolved value is the entire response.
57
- */
58
- ask(agentId: AiAgentId, prompt: string, options?: AskOptionsWithoutVoice): Promise<string>;
59
- observeStatusUpdates(agentId: AiAgentId, options?: AiObserveStatusOptions): Observable<AiStatusMessage>;
60
- transcribeAndAsk(agentId: AiAgentId, fileToTranscribe: File, options?: AskOptionsWithoutVoice): Promise<AiTranscribeAndAskResponse>;
61
- transcribeAndAskWithVoiceResponse(agentId: AiAgentId, fileToTranscribe: File, options?: Omit<AiAgentChatOptions, 'smoothTyping'>): Promise<TranscribeAndAskWithVoiceResponse>;
62
- askWithVoiceResponse(agentId: AiAgentId, prompt: string, options?: Omit<AiAgentChatOptions, 'smoothTyping'>): Promise<AskWithVoiceResponse>;
63
- askInternal<T>(agentId: AiAgentId, prompt: string | File, isVoiceResponse: boolean, options?: Omit<AiAgentChatOptions, 'smoothTyping'>): Promise<T>;
64
- private handleChatResponse;
65
- private handleStatusMessage;
66
- private createStatusSubject;
67
- }
68
- export interface AiChatBotContextData {
69
- title: string;
70
- context: AiContext;
71
- }
72
- export interface AiChatBotContextDataWithId extends AiChatBotContextData {
73
- id?: string;
74
- }
75
- export type AiAgentData = Pick<AiAgentMetadata, (typeof MUTABLE_AI_AGENT_METADATA_FIELDS)[number]>;
76
- export interface AiInstructionData {
77
- instruction: string;
78
- }
79
- export declare class AiAgentReference {
80
- private readonly client;
81
- private readonly integrationId;
82
- private readonly agentId;
83
- /**
84
- * Sends a prompt to the current agent.
85
- *
86
- * @param prompt - The prompt.
87
- * @param options - The chat options.
88
- * @returns An observable that emits when a new response token is received. The emitted value is the entire response
89
- * that has been received so far.
90
- */
91
- chat(prompt: string, options?: AiAgentChatOptions): Observable<string>;
92
- transcribeAndChat(fileToTranscribe: File, options?: AiAgentChatOptions): Promise<TranscribeAndChatResponse>;
93
- /**
94
- * Sends a prompt to the current agent and returns the response.
95
- * @param prompt - The prompt.
96
- * @param options - The chat options.
97
- */
98
- ask(prompt: string, options?: Omit<AiAgentChatOptions, 'smoothTyping'>): Promise<string>;
99
- observeStatusUpdates(options?: AiObserveStatusOptions): Observable<AiStatusMessage>;
100
- transcribeAndAsk(fileToTranscribe: File, options?: AskOptionsWithoutVoice): Promise<AiTranscribeAndAskResponse>;
101
- transcribeAndAskWithVoiceResponse(fileToTranscribe: File, options?: Omit<AiAgentChatOptions, 'smoothTyping'>): Promise<TranscribeAndAskWithVoiceResponse>;
102
- askWithVoiceResponse(prompt: string, options?: Omit<AiAgentChatOptions, 'smoothTyping'>): Promise<AskWithVoiceResponse>;
103
- search(options: AiSearchOptions): Promise<AiSearchResponse>;
104
- /**
105
- * Retrieves a context reference for the current agent. A context reference can be used to add a new context entry
106
- * to the agent, or update/delete an existing entry context.
107
- *
108
- * @param id - The id of the context entry. If no id is passed, an id will be
109
- * generated and the reference will point to a new context entry.
110
- * @returns The context reference.
111
- */
112
- context(id?: string): AiAgentContextReference;
113
- insertContexts(contexts: Array<AiChatBotContextDataWithId>, files?: Array<File | BlobAndFilename>): Promise<void>;
114
- /**
115
- * Retrieves an instruction reference for the current agent. An instruction reference can be used to add a new
116
- * instruction entry to the agent, or update/delete an existing instruction entry.
117
- *
118
- * @param id - The id of the instruction entry. If no id is passed, an id will be
119
- * generated and the reference will point to a new instruction entry.
120
- * @returns The instruction reference.
121
- */
122
- instruction(id?: string): AiAgentInstructionReference;
123
- /**
124
- * Creates a new AI Agent.
125
- * This will result in an error if an agent already exists with the same id.
126
- *
127
- * @param data An object containing options for creating the agent.
128
- * @param data.modelName - The name of the AI model (`gpt-3.5, `gpt-4`, `claude-3-5-sonnet-latest` or
129
- * `claude-3-5-haiku-latest`, `gemini-1.5-pro`, `gemini-2.0-flash`).
130
- * @param data.isPublic - Whether the chat functionality of the agent can be accessed without security rules.
131
- * @returns A promise that resolves when the agent is successfully created.
132
- */
133
- create(data: AiAgentData): Promise<void>;
134
- /**
135
- * Updates an existing agent.
136
- * An error will be thrown if the agent has not yet been created for the current agent ID.
137
- *
138
- * @param data - An object containing options for updating the agent.
139
- * @param data.modelName - The name of the OpenAI model (`gpt-3.5`, `gpt-4`, `claude-3-5-sonnet-latest`,
140
- * `claude-3-5-haiku-latest`, `gemini-1.5-pro`, `gemini-2.0-flash`).
141
- * @param data.isPublic - Whether the chat functionality of the agent can be accessed without security rules.
142
- * @param file - The file to upload (optional).
143
- * @returns A promise that resolves when the agent is successfully updated.
144
- */
145
- update(data: Partial<AiAgentData>, file?: File | BlobAndFilename): Promise<void>;
146
- /**
147
- * Deletes an existing agent.
148
- * Throws an error if the agent has not been created for the current agent ID.
149
- *
150
- * @returns A promise that resolves when the agent is successfully deleted.
151
- */
152
- delete(): Promise<void>;
153
- feedback(feedback: string): Promise<void>;
154
- resetFeedback(): Promise<void>;
155
- }
156
- export declare class AiAgentContextReference {
157
- private readonly client;
158
- private readonly integrationId;
159
- private readonly agentId;
160
- private readonly id;
161
- /**
162
- * Adds a new context entry to the agent.
163
- * Throws an error if an entry with the same ID already exists.
164
- *
165
- * @param data - An object containing options for creating the entry.
166
- * @param data.title - The title of the entry.
167
- * @param data.context - The context data.
168
- * @param file - The file to upload (optional).
169
- * @returns A promise that resolves when the context entry is successfully created.
170
- */
171
- insert(data: AiChatBotContextData, file?: File | BlobAndFilename): Promise<void>;
172
- /**
173
- * Appends data to an existing context entry on the agent.
174
- * This will result in an error if an entry is not found.
175
- *
176
- * @param data An object containing options for appending the entry.
177
- * @param file - The file to append.
178
- */
179
- append(data: AiChatBotContextData, file?: File): Promise<void>;
180
- /**
181
- * Updates an existing context entry for the agent.
182
- * Throws an error if an entry with the specified context ID does not exist.
183
- *
184
- * @param data - An object containing options for updating the entry.
185
- * @param data.title - The title of the entry.
186
- * @param data.context - The context data.
187
- * @returns A promise that resolves when the context entry is successfully updated.
188
- */
189
- update(data: Partial<AiChatBotContextData>): Promise<void>;
190
- /**
191
- * Deletes an existing context entry for the agent.
192
- * Throws an error if an entry with the specified context ID does not exist.
193
- *
194
- * @returns A promise that resolves when the context entry is successfully deleted.
195
- */
196
- delete(): Promise<void>;
197
- }
198
- export declare class AiAgentInstructionReference {
199
- private readonly client;
200
- private readonly integrationId;
201
- private readonly agentId;
202
- private readonly id;
203
- /**
204
- * Adds a new instruction entry to the agent.
205
- * Throws an error if an entry with the same ID already exists.
206
- *
207
- * @param data - An object containing options for creating the entry.
208
- * @param data.instruction - The instruction data.
209
- * @returns A promise that resolves when the instruction entry is successfully created.
210
- */
211
- insert(data: AiInstructionData): Promise<void>;
212
- /**
213
- * Updates an existing instruction entry for the agent.
214
- * Throws an error if an entry with the specified instruction ID does not exist.
215
- *
216
- * @param data - An object containing options for updating the entry.
217
- * @param data.instruction - The instruction data.
218
- * @returns A promise that resolves when the instruction entry is successfully updated.
219
- */
220
- update(data: AiInstructionData): Promise<void>;
221
- /**
222
- * Deletes an existing instruction entry for the agent.
223
- * Throws an error if an entry with the specified instruction ID does not exist.
224
- *
225
- * @returns A promise that resolves when the instruction entry is successfully deleted.
226
- */
227
- delete(): Promise<void>;
228
- }