@squidcloud/client
Version:
A typescript implementation of the Squid client
243 lines (242 loc) • 7.27 kB
TypeScript
import { AgentContextRequest, AiAgent, AiAgentContext, AiAnnotation, AiAudioCreateSpeechOptions, AiChatMessage, AiChatOptions, AiGenerateImageOptions, AllAiAgentChatOptions, ApplicationAiSettings, BuildAgentOptions } from '../public-types/ai-agent.public-types';
import { AiProviderType, ModelIdSpec } from '../public-types/ai-common.public-types';
import { AiContextMetadata, AiContextMetadataFilter } from '../public-types/ai-knowledge-base.public-types';
import { AiAgentId, AiKnowledgeBaseId, AppId, ClientRequestId } from '../public-types/communication.public-types';
import { JobId } from '../public-types/job.public-types';
import { SecretKey } from '../public-types/secret.public-types';
/** Specification for an AI model, defining its operational parameters. */
export type AiModelSpec = {
/** Maximum tokens the model can generate in a single response. */
maxOutputTokens: number;
/** Total context window size: input (aka prompt) + output (aka completion) tokens combined. */
contextWindowTokens: number;
};
export interface AiChatRequest {
agentId: AiAgentId;
clientRequestId: ClientRequestId;
prompt?: string;
options?: AllAiAgentChatOptions;
jobId: JobId;
}
export interface AiAskRequest {
agentId: AiAgentId;
prompt?: string;
options?: AllAiAgentChatOptions;
jobId: JobId;
}
export interface AiGenerateImageRequest {
prompt: string;
options: AiGenerateImageOptions;
}
export interface AiAskQuestionInternalRequest {
appId: AppId;
prompt: string;
options: AiChatOptions;
}
export interface AiAskQuestionInternalResponse {
answer: string;
}
export interface GetSharedAgentsInternalRequest {
organizationId: string;
}
export interface GetSharedAgentsInternalResponse {
sharedAgents: Array<{
agentId: AiAgentId;
appId: AppId;
}>;
}
export interface ClearSharedAgentsForOrgInternalRequest {
organizationId: string;
}
export interface AiContextSizeRequest {
appId: AppId;
agentId: AiAgentId;
}
export interface AiContextSizeResponse {
sizeBytes: number;
}
export interface AiAskResponse {
responseString: string;
annotations?: Record<string, AiAnnotation>;
}
export interface AiAskWithVoiceResponse {
responseString: string;
voiceResponse: AiAudioCreateSpeechResponse;
annotations?: Record<string, AiAnnotation>;
}
export interface AiTranscribeAndAskWithVoiceResponse {
transcribedPrompt: string;
responseString: string;
voiceResponse: AiAudioCreateSpeechResponse;
annotations?: Record<string, AiAnnotation>;
}
export interface AiTranscribeAndChatResponse {
transcribedPrompt: string;
}
export interface AiAudioCreateSpeechResponse {
mimeType: string;
extension: string;
base64File: string;
}
export interface AiAudioCreateSpeechRequest {
input: string;
options: AiAudioCreateSpeechOptions;
}
export interface GetAgentRequest {
agentId: AiAgentId;
}
export interface GetAgentResponse {
agent: AiAgent | undefined;
}
export interface GetAgentContextRequest {
agentId: AiAgentId;
contextId: string;
}
export interface ConnectAgentKnowledgeBaseRequest {
agentId: AiAgentId;
knowledgeBaseId: AiKnowledgeBaseId;
description: string;
}
export interface DisconnectAgentKnowledgeBaseRequest {
agentId: AiAgentId;
knowledgeBaseId: AiKnowledgeBaseId;
}
export interface DeleteAgentRequest {
agentId: AiAgentId;
}
export interface UnshareAgentRequest {
agentId: AiAgentId;
}
export interface SetAgentOptionInPathRequest {
agentId: AiAgentId;
path: string;
value: unknown;
}
export interface AddConnectedIntegrationRequest {
agentId: AiAgentId;
integrationId: string;
integrationType: string;
description: string;
}
export interface AddConnectedAgentRequest {
agentId: AiAgentId;
connectedAgentId: string;
description: string;
}
export interface AddConnectedKnowledgeBaseRequest {
agentId: AiAgentId;
knowledgeBaseId: string;
description: string;
/** Mirrors {@link AiConnectedKnowledgeBaseMetadata.includeMetadata}; forwarded so this atomic API honors it. */
includeMetadata?: boolean;
}
export interface AddFunctionRequest {
agentId: AiAgentId;
functionId: string;
}
export interface RemoveConnectedAgentRequest {
agentId: AiAgentId;
connectedAgentId: string;
}
export interface RemoveConnectedIntegrationRequest {
agentId: AiAgentId;
integrationId: string;
}
export interface RemoveConnectedKnowledgeBaseRequest {
agentId: AiAgentId;
knowledgeBaseId: string;
}
export interface RemoveFunctionRequest {
agentId: AiAgentId;
functionId: string;
}
export interface SetAgentDescriptionRequest {
agentId: AiAgentId;
description: string;
}
export interface ListAgentContextsRequest {
agentId: AiAgentId;
}
export interface ListAgentContextsResponse {
contexts: Array<AiAgentContext>;
}
export interface DeleteAgentContextsRequest {
agentId: AiAgentId;
contextIds: Array<string>;
}
export interface UpsertAgentContextsRequest {
agentId: AiAgentId;
contextRequests: Array<AgentContextRequest>;
}
export interface UpsertAgentCustomGuardrailsRequest {
agentId: AiAgentId;
customGuardrail: string;
}
export interface DeleteAgentCustomGuardrailsRequest {
agentId: AiAgentId;
}
export interface ListAgentsResponse {
agents: Array<AiAgent>;
}
export interface GetApplicationAiSettingsResponse {
settings: ApplicationAiSettings;
}
export interface GetApplicationAiSettingsResponse {
settings: ApplicationAiSettings;
}
export interface SetApplicationAiSettingsRequest {
settings: ApplicationAiSettings;
}
export interface SetAiProviderApiKeySecretRequest {
providerType: AiProviderType;
secretKey: SecretKey | undefined;
}
export interface SetAiProviderApiKeySecretResponse {
settings: ApplicationAiSettings;
}
export interface ListChatModelsResponse {
models: ModelIdSpec[];
}
export interface RegenerateAgentApiKeyRequest {
agentId: AiAgentId;
}
export interface GetAgentApiKeyRequest {
agentId: AiAgentId;
}
export declare function validateAiContextMetadata(metadata: AiContextMetadata): void;
export declare function validateAiContextMetadataFilter(filter: AiContextMetadataFilter): void;
export declare const METADATA_SERVICE_FUNCTION_NAME = "default:metadata";
export interface GetChatHistoryRequest {
agentId: AiAgentId;
memoryId: string;
}
export interface GetChatHistoryResponse {
messages: Array<AiChatMessage>;
}
export interface ProvideAgentFeedbackRequest {
agentId: string;
feedback: string;
}
export interface BuildAgentRequest {
agentId: string;
request: string;
memoryId?: string;
options?: BuildAgentOptions;
}
export interface UploadAiFileRequest {
/** AI provider to upload file to. */
provider: AiProviderType;
/** Optional expiration time in seconds. If provided, file will be registered for automatic cleanup. */
expirationInSeconds?: number;
}
export interface UploadAiFileResponse {
fileId: string;
}
export interface DeleteAiFileRequest {
fileId: string;
/** AI provider that owns the file. */
provider: AiProviderType;
}
export interface DeleteAiFileResponse {
deleted: boolean;
}