import { OpenAI } from 'openai'; import { type LLMAssistanceOptions, type LLMAssistanceResult, type LLMAssistanceMessage, type LLMCreateChatOptions, type LLMCreateChatResult, type LLMCreateFileStorageOptions, type LLMCreateFileStorageResult, type LLMInstanceOptions, LLMProviders, type LLMUploadFileOptions, type LLMUploadFileResult, type LLMStructuredResult, type LLMUploadedFile } from '../../../LLMService.typedefs'; import { type LLMLoggerInterface } from '../../../utilities/logger'; import { type LLMReporterInterface } from '../../../utilities/reporter'; import { LLMAssistanceService } from '../../../services'; import { type LLMSchemaInterface } from '../../../utilities/schema'; export declare class LLMAPIAssistanceService | undefined> extends LLMAssistanceService { private fileStorage; private chatState; private toolExecutor; private fileContextInjectedChats; constructor(logger: LLMLoggerInterface | undefined, reporter: Reporter, options?: LLMInstanceOptions[LLMProviders.LLMAPI]); get instance(): OpenAI; uploadFile(fileOptions: LLMUploadFileOptions): Promise; getFile(path: string): Promise; deleteFile(fileId: string): Promise; createFileStorage(options: LLMCreateFileStorageOptions): Promise; deleteFileStorage(storageId: string): Promise; createChat(options: LLMCreateChatOptions): Promise; deleteChat(chatId: string): Promise; countTokens(messages: LLMAssistanceMessage[]): Promise; protected assistInChatText(options: LLMAssistanceOptions): Promise; protected assistInChatStructured(options: LLMAssistanceOptions & { schema: LLMSchemaInterface; }): Promise; private prepareChatForAssist; private appendUserMessageToChat; private injectSchemaInstruction; /** * One round's usage, mapped exactly as `buildToolLoopUsage` maps the run * total, so the per-round generations add up to the single metrics point the * run still writes. */ private buildRoundUsage; private buildToolLoopUsage; /** * The input side of the tool loop's own last round, as opposed to * `buildToolLoopUsage`, which sums every round the loop ran. */ private buildLastRoundUsage; private injectFileContext; private buildToolsArray; private serializeOfferedTools; private executeToolLoop; /** * Executes one tool-loop round trip. Gemini through the proxy occasionally * rejects a previously-issued thought_signature on replay with HTTP 400 * "Corrupted thought signature."; the recovery downgrades every recorded * signature to the documented validator-bypass marker and retries the same * request once. */ private createToolLoopCompletion; private isCorruptedThoughtSignatureError; private resolveToolCalls; /** * The visible assistant text a continuing tool-loop round produced, with * thinking tags stripped. Standard tool-call turns carry prose in * `message.content` alongside the calls; the XML fallback path already split * prose from markup into `assistantContent`. */ private extractVisibleToolRoundText; private appendToolInteractionMessages; private logOutgoingToolCalls; /** * Chat Completions cannot carry images in a `tool`-role message, so any * images a tool returned are surfaced to the model as a separate user * message appended right after the batch of tool results. */ private appendToolResultImages; private dispatchToolCall; }