UNPKG

@squidcloud/client

Version:

A typescript implementation of the Squid client

69 lines (68 loc) 2.97 kB
import { AiFileUrl } from './ai-agent.public-types'; import { ServiceFunctionName } from './backend.public-types'; import { IntegrationType } from './integration.public-types'; /** Represents the possible data types for an AI function parameter. */ export type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date' | 'files'; /** Defines the structure of a parameter for an AI function. */ export interface AiFunctionParam { /** Name of the parameter. */ name: string; /** Description of the parameter's purpose. */ description: string; /** Data type of the parameter. */ type: AiFunctionParamType; /** Indicates if the parameter is mandatory. */ required: boolean; /** List of possible values for the parameter, if applicable. */ enum?: Array<Omit<AiFunctionParamType, 'date'>>; } /** Represents an AI function response that also includes files. */ export interface AiFunctionResponseWithFiles<ResponseType = unknown> { /** Indicates that this is an AI function response with files. */ __isAiFunctionResponseWithFiles: true; /** The response from the AI function. */ response: ResponseType; /** Optional list of files associated with the response. */ files: Array<AiFileUrl>; } /** Additional optional readonly metadata for AI function. */ export interface AiFunctionAttributes { /** * Type of integration this function is used for. * Functions with defined 'integrationType' require 'integrationId' to be passed as part of the function context. */ integrationType?: Array<IntegrationType>; } /** Metadata describing an AI function available in the application. */ export interface AiFunctionMetadata { /** The fully qualified name of the function (serviceName:functionName). */ serviceFunction: ServiceFunctionName; /** * Description of what the function does. Optional when {@link promptId} is set, * in which case the description is resolved server-side from the prompt * registry at the point the LLM tool definition is built. */ description?: string; /** * Opaque id of a registered prompt that supplies this function's description. * Stored verbatim (the public SDK never resolves it — that would ship the * internal prompt registry to customers); resolution happens server-side. */ promptId?: string; /** Parameters that the function accepts. */ params: Array<AiFunctionParam>; /** Additional attributes for the function. */ attributes?: AiFunctionAttributes; /** Categories this function belongs to. */ categories?: string[]; /** Whether this function is internal and not meant for direct use. */ internal?: boolean; } /** * Response containing the list of AI functions registered in an application. * @category AI */ export interface ListAiFunctionsResponse { /** All AI functions registered for the application. */ functions: Array<AiFunctionMetadata>; }