@squidcloud/client 1.0.369 → 1.0.370
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 +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +0 -14
- package/dist/internal-common/src/public-types/job.public-types.d.ts +59 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +3 -0
- package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +32 -6
- package/dist/typescript-client/src/agent/ai-agent-client.d.ts +1 -0
- package/dist/typescript-client/src/ai-client.d.ts +2 -0
- package/dist/typescript-client/src/index.d.ts +1 -0
- package/dist/typescript-client/src/job-client.d.ts +21 -0
- package/dist/typescript-client/src/public-types.d.ts +1 -0
- package/dist/typescript-client/src/squid.d.ts +6 -2
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -546,20 +546,6 @@ export interface AnthropicChatOptions extends BaseAiChatOptions {
|
|
|
546
546
|
/** The level of reasoning effort to apply. Defaults to no reasoning. */
|
|
547
547
|
reasoningEffort?: AiReasoningEffort;
|
|
548
548
|
}
|
|
549
|
-
/**
|
|
550
|
-
* Optional settings for an AI session, allowing partial specification of identifiers.
|
|
551
|
-
* @category AI
|
|
552
|
-
*/
|
|
553
|
-
export type AiSessionOptions = Partial<{
|
|
554
|
-
/** A unique identifier for tracing the session, if provided. */
|
|
555
|
-
traceId: string;
|
|
556
|
-
/** The ID of the client initiating the session, if specified. */
|
|
557
|
-
clientId: string;
|
|
558
|
-
/** The ID of the AI agent involved in the session, if specified. */
|
|
559
|
-
agentId: string;
|
|
560
|
-
/** The ID of the AI agent involved in starting the session, if specified. */
|
|
561
|
-
rootAgentId: string;
|
|
562
|
-
}>;
|
|
563
549
|
/**
|
|
564
550
|
* The generic options type. When no generic is provided,
|
|
565
551
|
* the type is inferred from the provided overrideModel (or falls back to BaseAiAgentChatOptions).
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a unique identifier for a job.
|
|
3
|
+
*/
|
|
4
|
+
export type JobId = string;
|
|
5
|
+
/** Represents a request to get an asynchronous job by its ID. */
|
|
6
|
+
export interface GetJobRequest {
|
|
7
|
+
/** The unique identifier of the job to retrieve */
|
|
8
|
+
jobId: JobId;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Represents a request to get an asynchronous job by its ID.
|
|
12
|
+
*/
|
|
13
|
+
export interface GetJobResponse {
|
|
14
|
+
/** The job details */
|
|
15
|
+
job: AsyncJob | undefined;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Represents a request to subscribe to job updates.
|
|
19
|
+
* This allows clients to receive real-time updates about the job's status.
|
|
20
|
+
*/
|
|
21
|
+
export interface SubscribeToJobRequest {
|
|
22
|
+
/** The unique identifier of the job to subscribe to */
|
|
23
|
+
jobId: JobId;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Represents an asynchronous job
|
|
27
|
+
*/
|
|
28
|
+
export interface AsyncJob<T = any> {
|
|
29
|
+
/**
|
|
30
|
+
* The unique identifier of the job.
|
|
31
|
+
*/
|
|
32
|
+
id: JobId;
|
|
33
|
+
/**
|
|
34
|
+
* The timestamp when the job was created.
|
|
35
|
+
*/
|
|
36
|
+
createdAt: Date;
|
|
37
|
+
/**
|
|
38
|
+
* The timestamp when the job was last updated.
|
|
39
|
+
*/
|
|
40
|
+
updatedAt: Date;
|
|
41
|
+
/**
|
|
42
|
+
* The current status of the job.
|
|
43
|
+
* Can be one of the following:
|
|
44
|
+
* - 'in_progress': The job is currently being processed.
|
|
45
|
+
* - 'completed': The job has finished successfully.
|
|
46
|
+
* - 'failed': The job has failed.
|
|
47
|
+
*/
|
|
48
|
+
status: 'in_progress' | 'completed' | 'failed';
|
|
49
|
+
/**
|
|
50
|
+
* The result of the job, if available.
|
|
51
|
+
* This is of type `T` and is optional.
|
|
52
|
+
*/
|
|
53
|
+
result?: T;
|
|
54
|
+
/**
|
|
55
|
+
* The error message, if the job has failed.
|
|
56
|
+
* This is optional.
|
|
57
|
+
*/
|
|
58
|
+
error?: string;
|
|
59
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AgentContextRequest, AiAgent, AiAgentContext, AiAudioCreateSpeechOptions, AiChatModelName, AiChatOptions, AiContextMetadata, AiContextMetadataFilter, AiEmbeddingsModelName, AiGenerateImageOptions, AiProviderType, AiSearchOptions, AiSearchResultChunk, AllAiAgentChatOptions, ApplicationAiSettings } from '../public-types/ai-agent.public-types';
|
|
2
2
|
import { AiFunctionId } from '../public-types/backend.public-types';
|
|
3
3
|
import { AiAgentId, AppId, ClientRequestId } from '../public-types/communication.public-types';
|
|
4
|
+
import { JobId } from '../public-types/job.public-types';
|
|
4
5
|
import { SecretKey } from '../public-types/secret.public-types';
|
|
5
6
|
export type ModelDataType = {
|
|
6
7
|
maxTokens: number;
|
|
@@ -12,11 +13,13 @@ export interface AiChatRequest {
|
|
|
12
13
|
clientRequestId: ClientRequestId;
|
|
13
14
|
prompt?: string;
|
|
14
15
|
options?: AllAiAgentChatOptions;
|
|
16
|
+
jobId: JobId;
|
|
15
17
|
}
|
|
16
18
|
export interface AiAskRequest {
|
|
17
19
|
agentId: AiAgentId;
|
|
18
20
|
prompt?: string;
|
|
19
21
|
options?: AllAiAgentChatOptions;
|
|
22
|
+
jobId: JobId;
|
|
20
23
|
}
|
|
21
24
|
export interface AiGenerateImageRequest {
|
|
22
25
|
prompt: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { AgentContextRequest, AiAgent, AiAgentContext, AiChatModelName, AiConnectedAgentMetadata, AiObserveStatusOptions, AiSearchOptions, AiSearchResultChunk, AiStatusMessage, AiTranscribeAndAskResponse, GuardrailsOptions, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
|
|
3
|
+
import { JobId } from '../../../internal-common/src/public-types/job.public-types';
|
|
3
4
|
import { AiAskOptions, AiAskOptionsWithVoice, AiChatOptionsWithoutVoice, AskWithVoiceResponse, TranscribeAndAskWithVoiceResponse, TranscribeAndChatResponse } from './ai-agent-client.types';
|
|
4
5
|
/**
|
|
5
6
|
* Parameters for creating or updating an AI agent.
|
|
@@ -19,6 +20,7 @@ export declare class AiAgentReference {
|
|
|
19
20
|
private readonly statusUpdates;
|
|
20
21
|
private readonly rpcManager;
|
|
21
22
|
private readonly socketManager;
|
|
23
|
+
private readonly jobClient;
|
|
22
24
|
/**
|
|
23
25
|
* Retrieves metadata and configuration of the AI agent.
|
|
24
26
|
*/
|
|
@@ -89,36 +91,60 @@ export declare class AiAgentReference {
|
|
|
89
91
|
deleteCustomGuardrail(): Promise<void>;
|
|
90
92
|
/**
|
|
91
93
|
* Sends a prompt to the agent and receives streamed text responses.
|
|
94
|
+
* @param prompt The text prompt to send to the agent.
|
|
95
|
+
* @param options Optional parameters for the AI ask request.
|
|
96
|
+
* @param jobId Optional job ID for tracking the request using `squid.jobs().awaitJob(jobId)` or
|
|
97
|
+
* `squid.jobs().getJob(jobId)`.
|
|
92
98
|
*/
|
|
93
|
-
chat<T extends AiChatModelName | undefined>(prompt: string, options?: AiChatOptionsWithoutVoice<T
|
|
99
|
+
chat<T extends AiChatModelName | undefined>(prompt: string, options?: AiChatOptionsWithoutVoice<T>, jobId?: JobId): Observable<string>;
|
|
94
100
|
/**
|
|
95
101
|
* Transcribes the given file and performs a chat interaction.
|
|
102
|
+
* @param fileToTranscribe The audio file to transcribe and send to the agent.
|
|
103
|
+
* @param options Optional parameters for the AI ask request.
|
|
104
|
+
* @param jobId Optional job ID for tracking the request using `squid.jobs().awaitJob(jobId)` or
|
|
105
|
+
* `squid.jobs().getJob(jobId)`.
|
|
96
106
|
*/
|
|
97
|
-
transcribeAndChat(fileToTranscribe: File, options?: AiChatOptionsWithoutVoice): Promise<TranscribeAndChatResponse>;
|
|
107
|
+
transcribeAndChat(fileToTranscribe: File, options?: AiChatOptionsWithoutVoice, jobId?: JobId): Promise<TranscribeAndChatResponse>;
|
|
98
108
|
/**
|
|
99
109
|
* Performs a semantic search using the agent's knowledge base.
|
|
100
110
|
*/
|
|
101
111
|
search(options: AiSearchOptions): Promise<Array<AiSearchResultChunk>>;
|
|
102
112
|
/**
|
|
103
113
|
* Sends a prompt and receives a full string response.
|
|
114
|
+
* @param prompt The text prompt to send to the agent.
|
|
115
|
+
* @param options Optional parameters for the AI ask request.
|
|
116
|
+
* @param jobId Optional job ID for tracking the request using `squid.jobs().awaitJob(jobId)` or
|
|
117
|
+
* `squid.jobs().getJob(jobId)`.
|
|
104
118
|
*/
|
|
105
|
-
ask<T extends AiChatModelName | undefined = undefined>(prompt: string, options?: AiAskOptions<T
|
|
119
|
+
ask<T extends AiChatModelName | undefined = undefined>(prompt: string, options?: AiAskOptions<T>, jobId?: JobId): Promise<string>;
|
|
106
120
|
/**
|
|
107
121
|
* Observes live status messages from the agent.
|
|
108
122
|
*/
|
|
109
123
|
observeStatusUpdates(options?: AiObserveStatusOptions): Observable<AiStatusMessage>;
|
|
110
124
|
/**
|
|
111
125
|
* Transcribes audio and sends it to the agent for response.
|
|
126
|
+
* @param fileToTranscribe The audio file to transcribe and send to the agent.
|
|
127
|
+
* @param options Optional parameters for the AI ask request.
|
|
128
|
+
* @param jobId Optional job ID for tracking the request using `squid.jobs().awaitJob(jobId)` or
|
|
129
|
+
* `squid.jobs().getJob(jobId)`.
|
|
112
130
|
*/
|
|
113
|
-
transcribeAndAsk<T extends AiChatModelName | undefined>(fileToTranscribe: File, options?: AiAskOptions<T
|
|
131
|
+
transcribeAndAsk<T extends AiChatModelName | undefined>(fileToTranscribe: File, options?: AiAskOptions<T>, jobId?: JobId): Promise<AiTranscribeAndAskResponse>;
|
|
114
132
|
/**
|
|
115
133
|
* Transcribes audio and gets both text and voice response from the agent.
|
|
134
|
+
* @param fileToTranscribe The audio file to transcribe and send to the agent.
|
|
135
|
+
* @param options Optional parameters for the AI ask request.
|
|
136
|
+
* @param jobId Optional job ID for tracking the request using `squid.jobs().awaitJob(jobId)` or
|
|
137
|
+
* `squid.jobs().getJob(jobId)`.
|
|
116
138
|
*/
|
|
117
|
-
transcribeAndAskWithVoiceResponse<T extends AiChatModelName | undefined>(fileToTranscribe: File, options?: AiAskOptionsWithVoice<T
|
|
139
|
+
transcribeAndAskWithVoiceResponse<T extends AiChatModelName | undefined>(fileToTranscribe: File, options?: AiAskOptionsWithVoice<T>, jobId?: JobId): Promise<TranscribeAndAskWithVoiceResponse>;
|
|
118
140
|
/**
|
|
119
141
|
* Sends a prompt and gets both text and voice response from the agent.
|
|
142
|
+
* @param prompt The text prompt to send to the agent.
|
|
143
|
+
* @param options Optional parameters for the AI ask request.
|
|
144
|
+
* @param jobId Optional job ID for tracking the request using `squid.jobs().awaitJob(jobId)` or
|
|
145
|
+
* `squid.jobs().getJob(jobId)`.
|
|
120
146
|
*/
|
|
121
|
-
askWithVoiceResponse<T extends AiChatModelName | undefined>(prompt: string, options?: AiAskOptionsWithVoice<T
|
|
147
|
+
askWithVoiceResponse<T extends AiChatModelName | undefined>(prompt: string, options?: AiAskOptionsWithVoice<T>, jobId?: JobId): Promise<AskWithVoiceResponse>;
|
|
122
148
|
private askInternal;
|
|
123
149
|
private createStatusSubject;
|
|
124
150
|
private chatInternal;
|
|
@@ -9,6 +9,7 @@ import { AiAgentReference } from './ai-agent-client-reference';
|
|
|
9
9
|
export declare class AiAgentClient {
|
|
10
10
|
private readonly rpcManager;
|
|
11
11
|
private readonly socketManager;
|
|
12
|
+
private readonly jobClient;
|
|
12
13
|
private readonly ongoingChatSequences;
|
|
13
14
|
private readonly statusUpdates;
|
|
14
15
|
/**
|
|
@@ -14,6 +14,7 @@ import { AiAgent, AiAgentId, AiProviderType, ApplicationAiSettings, IntegrationI
|
|
|
14
14
|
export declare class AiClient {
|
|
15
15
|
private readonly socketManager;
|
|
16
16
|
private readonly rpcManager;
|
|
17
|
+
private readonly jobClient;
|
|
17
18
|
private readonly aiAssistantClient;
|
|
18
19
|
private aiAgentClient?;
|
|
19
20
|
/**
|
|
@@ -97,4 +98,5 @@ export declare class AiClient {
|
|
|
97
98
|
* Returns the updated state of the AI application settings.
|
|
98
99
|
*/
|
|
99
100
|
setAiProviderApiKeySecret(providerType: AiProviderType, secretKey: SecretKey | undefined): Promise<ApplicationAiSettings>;
|
|
101
|
+
private getAiAgentClient;
|
|
100
102
|
}
|
|
@@ -27,6 +27,7 @@ export * from './execute-function-options';
|
|
|
27
27
|
export * from './extraction-client';
|
|
28
28
|
export * from './file-utils';
|
|
29
29
|
export * from './integration-client';
|
|
30
|
+
export * from './job-client';
|
|
30
31
|
export * from './mutation/mutation-sender';
|
|
31
32
|
export * from './native-query-manager';
|
|
32
33
|
export * from './observability-client';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AsyncJob, JobId } from '../../internal-common/src/public-types/job.public-types';
|
|
2
|
+
/**
|
|
3
|
+
* JobService is responsible for managing job subscriptions and notifications.
|
|
4
|
+
*/
|
|
5
|
+
export declare class JobClient {
|
|
6
|
+
private readonly socketManager;
|
|
7
|
+
private readonly rpcManager;
|
|
8
|
+
private isListening;
|
|
9
|
+
private readonly listeners;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the job with the given ID.
|
|
12
|
+
* @param jobId used to identify the job.
|
|
13
|
+
*/
|
|
14
|
+
getJob<T = any>(jobId: JobId): Promise<AsyncJob<T> | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Waits for a job to complete and returns its result or throws an error.
|
|
17
|
+
* @param jobId used to identify the job.
|
|
18
|
+
*/
|
|
19
|
+
awaitJob<T = any>(jobId: JobId): Promise<T>;
|
|
20
|
+
private maybeListenToJobs;
|
|
21
|
+
}
|
|
@@ -12,6 +12,7 @@ export * from '../../internal-common/src/public-types/document.public-types';
|
|
|
12
12
|
export * from '../../internal-common/src/public-types/extraction.public-types';
|
|
13
13
|
export * from '../../internal-common/src/public-types/http-status.public-types';
|
|
14
14
|
export * from '../../internal-common/src/public-types/integration.public-types';
|
|
15
|
+
export * from '../../internal-common/src/public-types/job.public-types';
|
|
15
16
|
export * from '../../internal-common/src/public-types/metric.public-types';
|
|
16
17
|
export * from '../../internal-common/src/public-types/openapi.public-types';
|
|
17
18
|
export * from '../../internal-common/src/public-types/query.public-types';
|
|
@@ -6,6 +6,7 @@ import { ConnectionDetails } from './connection-details';
|
|
|
6
6
|
import { DistributedLock } from './distributed-lock.manager';
|
|
7
7
|
import { ExecuteFunctionOptions } from './execute-function-options';
|
|
8
8
|
import { ExtractionClient } from './extraction-client';
|
|
9
|
+
import { JobClient } from './job-client';
|
|
9
10
|
import { ObservabilityClient } from './observability-client';
|
|
10
11
|
import { PersonalStorageClient } from './personal-storage-client';
|
|
11
12
|
import { ApiKey, AppId, CollectionName, DocumentData, EnvironmentId, IntegrationId, SquidDeveloperId, SquidRegion } from './public-types';
|
|
@@ -108,6 +109,7 @@ export declare class Squid {
|
|
|
108
109
|
private readonly querySender;
|
|
109
110
|
private static readonly squidInstancesMap;
|
|
110
111
|
private readonly aiClient;
|
|
112
|
+
private readonly jobClient;
|
|
111
113
|
private readonly apiClient;
|
|
112
114
|
private readonly adminClient;
|
|
113
115
|
private readonly webClient;
|
|
@@ -226,10 +228,12 @@ export declare class Squid {
|
|
|
226
228
|
executeNativeElasticQuery<T = any>(integrationId: IntegrationId, index: string, body: Record<string, any>, endpoint?: string, method?: 'GET' | 'POST'): Promise<Array<T>>;
|
|
227
229
|
/**
|
|
228
230
|
* Returns a set of AI specific clients.
|
|
229
|
-
*
|
|
230
|
-
* @returns A set of AI specific clients.
|
|
231
231
|
*/
|
|
232
232
|
ai(): AiClient;
|
|
233
|
+
/**
|
|
234
|
+
* Returns a set of functionality for interacting with jobs.
|
|
235
|
+
*/
|
|
236
|
+
job(): JobClient;
|
|
233
237
|
/**
|
|
234
238
|
* Returns a set of functionality for interacting with API integrations.
|
|
235
239
|
*/
|