@squidcloud/client
Version:
A typescript implementation of the Squid client
113 lines (112 loc) • 4.02 kB
TypeScript
import { AiChatModelName, ApiOptions, IntegrationId } from './public-types';
/**
* Request to execute an AI query using a specific integration.
* Supports additional query execution options.
* @category AI
*/
export interface ExecuteAiQueryRequest {
/** ID of the integration to execute the AI query. */
integrationId: IntegrationId;
/** User-provided prompt for the AI query. */
prompt: string;
/** Additional options for query execution. */
options?: ExecuteAiQueryOptions;
}
/**
* Options for configuring AI query execution.
* Includes instructions, model overrides, and additional execution settings.
* @category AI
*/
export interface ExecuteAiQueryOptions {
/** Custom instructions to modify AI query behavior. */
instructions?: string;
/** List of collections to use in the AI query. */
collectionsToUse?: Array<string>;
/** Whether to enable raw results output. */
enableRawResults?: boolean;
/** Whether to enable code interpreter for query execution. */
enableCodeInterpreter?: boolean;
/** Specific AI model override for the query execution. */
overrideModel?: AiChatModelName;
/** Whether to generate a step-by-step walkthrough for the response. */
generateWalkthrough?: boolean;
}
/**
* Response from an AI query execution.
* Contains the generated answer, optional explanation, and executed query details.
* @category AI
*/
export interface ExecuteAiQueryResponse {
/** AI-generated answer for the query. */
answer: string;
/** Optional explanation for the AI-generated answer. */
explanation?: string;
/** Query executed by the AI, if applicable. */
executedQuery?: string;
/** Markdown format type of the executed query response. */
queryMarkdownType?: string;
/** URL to access raw results from the query execution. */
rawResultsUrl?: string;
/** Indicates whether the query execution was successful. */
success: boolean;
}
/**
* Details of an executed query, including the query text and result type.
* @category AI
*/
export interface ExecutedQuery {
/** Text of the executed query. */
query: string;
/** The markdown type of the result (sql, mongo, etc.). */
markdownType: string;
/** URL to access raw results from the query execution. */
rawResultsUrl?: string;
}
/**
* Response from executing an AI query across multiple integrations.
* Includes answers and explanations for each executed query.
* @category AI
*/
export interface ExecuteAiQueryMultiResponse {
/** AI-generated answer for the multi-integration query. */
answer: string;
/** Optional explanation for the AI-generated response. */
explanation?: string;
/** List of executed queries with details. */
executedQueries: Array<ExecutedQuery>;
/** Indicates whether the query execution was successful. */
success: boolean;
}
/**
* The AI API call response
* @category AI
*/
export interface AiApiResult {
/** ID of the executed API endpoint. */
endpointId: string;
/** Name of the executed API endpoint. */
responseBody: string;
/** Status code of the executed API request. */
responseStatusCode: number;
/** Request body of the executed API request. */
requestBody: any;
/** Request options of the executed API request. */
requestOptions: ApiOptions;
}
/**
* Response from executing an AI-powered API request.
* Includes the AI-generated answer and details of executed API calls.
* @category AI
*/
export interface ExecuteAiApiResponse {
/** AI-generated answer for the API request. */
answer: string;
/** Optional explanation for the AI-generated API response. */
explanation?: string;
/** List of executed API requests and their results. */
executedApis?: Array<AiApiResult>;
/** Markdown format type of the executed query response. */
queryMarkdownType?: string;
/** Indicates whether the API request execution was successful. */
success: boolean;
}