import type { AiAgentActionRequest } from "./Agents/AiAgentActionRequest.js"; import type { AiConversationCreationOptions } from "./Agents/AiConversationCreationOptions.js"; import type { AiAnswer } from "./AiAnswer.js"; import type { AiStreamCallback } from "./AiStreamCallback.js"; import type { IDocumentStore } from "../../IDocumentStore.js"; import type { UnhandledActionEventArgs } from "./UnhandledActionEventArgs.js"; export declare enum AiHandleErrorStrategy { SendErrorsToModel = "SendErrorsToModel", RaiseImmediately = "RaiseImmediately" } export type ActionInvocation = (request: AiAgentActionRequest) => Promise; export declare class AiConversation { private readonly _store; private readonly _databaseName; private readonly _agentId; private _conversationId; private readonly _options?; private _actionRequests; private readonly _actionResponses; private readonly _artificialActions; private readonly _promptParts; private readonly _invocations; onUnhandledAction?: (args: UnhandledActionEventArgs) => Promise | void; constructor(store: IDocumentStore, databaseName: string, agentId: string, conversationId: string, options?: AiConversationCreationOptions, changeVector?: string); private _changeVector; get changeVector(): string; get id(): string; requiredActions(): AiAgentActionRequest[]; addActionResponse(toolId: string, actionResponse: TResponse | string): void; /** * Inject an artificial tool action and a string response into the conversation context. * The model will "believe" it executed the tool and received this response. */ addArtificialActionWithResponse(toolId: string, actionResponse: string): void; /** * Inject an artificial tool action and a structured response object into the conversation context. * The object will be serialized to JSON before being sent. */ addArtificialActionWithResponseObject(toolId: string, actionResponse: TResponse | string): void; /** * Sets the user prompt for the next conversation turn. * This replaces any previously set prompts. * @param userPrompt - The text of the user's message */ setUserPrompt(userPrompt: string): void; /** * Adds one or more user prompts to the conversation. * Use this to build multi-part prompts. * @param prompts - One or more text prompts to add * * @example * ```typescript * conversation.addUserPrompt("First part of the question."); * conversation.addUserPrompt("Second part with more context."); * ``` */ addUserPrompt(...prompts: string[]): void; handle(actionName: string, action: (args: TArgs) => Promise, aiHandleError?: AiHandleErrorStrategy): void; handle(actionName: string, action: (args: TArgs) => object, aiHandleError?: AiHandleErrorStrategy): void; handle(actionName: string, action: (request: AiAgentActionRequest, args: TArgs) => Promise, aiHandleError?: AiHandleErrorStrategy): void; handle(actionName: string, action: (request: AiAgentActionRequest, args: TArgs) => object, aiHandleError?: AiHandleErrorStrategy): void; receive(actionName: string, action: (request: AiAgentActionRequest, args: TArgs) => Promise | void, aiHandleError?: AiHandleErrorStrategy): void; run(): Promise>; /** * Executes one "turn" of the conversation with streaming enabled. * Streams the specified property's value in real-time by invoking the callback with each chunk. * * @param streamPropertyPath - The property path of the answer to stream (e.g., "suggestedReward") * @param streamCallback - Callback invoked with each streamed chunk * @returns A promise that resolves to the full answer after streaming completes * * @example * ```typescript * const answer = await chat.stream("propertyName", async (chunk) => { * console.log("Received chunk:", chunk); * }); * ``` */ stream(streamPropertyPath: string, streamCallback: AiStreamCallback): Promise>; private _runInternal; private _parseArgs; private _createErrorMessageForLlm; } //# sourceMappingURL=AiConversation.d.ts.map