UNPKG

contentful-management

Version:
36 lines (35 loc) 1.79 kB
import type { RawAxiosRequestHeaders } from 'axios'; import type { CollectionProp, GetSpaceEnvironmentParams, QueryParams } from '../../common-types'; import type { AgentGeneratePayload, AgentProps } from '../../entities/agent'; import type { AgentGenerateResponse } from '../../entities/agent-run'; import type { OptionalDefaults } from '../wrappers/wrap'; export type AgentPlainClientAPI = { /** * Fetches the AI Agent. * @param params Entity IDs to identify the AI Agent. * @returns The AI Agent. * @throws if the request fails or the AI Agent is not found. */ get(params: OptionalDefaults<GetSpaceEnvironmentParams & { agentId: string; }>): Promise<AgentProps>; /** * Fetches all AI Agents for the given space and environment. * @param params Entity IDs and query options. * @returns A collection containing an array of AI Agents. * @throws if the request fails or the entities are not found. */ getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams>): Promise<CollectionProp<AgentProps>>; /** * Generates a response from an AI Agent. * @param params Entity IDs to identify the AI Agent. * @param payload The generation payload. * @param headers Optional headers for the request. * @returns A promise resolving with a simplified response containing `sys.id`, `sys.type`, and `sys.status`. * Use `agentRun.get()` with the returned `sys.id` to poll for full results. * @throws if the request fails or the payload is malformed. */ generate(params: OptionalDefaults<GetSpaceEnvironmentParams & { agentId: string; }>, payload: AgentGeneratePayload, headers?: Partial<RawAxiosRequestHeaders>): Promise<AgentGenerateResponse>; };