/** * Abstract base class for structured LLM providers. * Uses Template Method pattern - the agent loop algorithm is common, * only provider-specific API details differ. */ import type { ZodToolDefinition, BaseZodToolDefinition, ToolCall, ToolResult, AgentRunOptions, StructuredGenerateResult, ProviderResponse, ProgressEvent } from "./types"; /** * Abstract base class for structured LLM providers. * Implements the common agent loop algorithm with provider-specific hooks. */ export declare abstract class BaseStructuredLLMProvider { /** Provider name for logging */ protected abstract readonly providerName: string; /** * Main entry point - runs the agent loop with tools until structured output is submitted. * This is a Template Method that calls abstract hooks for provider-specific behavior. */ runAgentLoop(prompt: string, options: AgentRunOptions): Promise>; /** * Common tool execution logic - shared across all providers. */ protected executeTools(toolCalls: ToolCall[], toolRunners: Map, onProgress?: (event: ProgressEvent) => void): Promise; /** * Initialize the conversation state with the initial prompt. * Returns a provider-specific state object that will be passed to other methods. */ protected abstract initializeConversation(prompt: string, options: AgentRunOptions): unknown; /** * Call the provider's API with the current conversation state. * Should convert tools to provider format and make the API call. */ protected abstract callAPI(state: unknown, tools: BaseZodToolDefinition[], options: AgentRunOptions): Promise; /** * Extract the submit_output tool result from the response. * Returns the input arguments if submit_output was called, null otherwise. */ protected abstract extractSubmitOutput(response: ProviderResponse): unknown; /** * Extract all tool calls from the response. * Returns an array of ToolCall objects with normalized id, name, and input. */ protected abstract extractToolCalls(response: ProviderResponse): ToolCall[]; /** * Append the assistant response and tool results to the conversation state. * Mutates the state object to include the new messages. */ protected abstract appendToConversation(state: unknown, response: ProviderResponse, results: ToolResult[]): void; } //# sourceMappingURL=base-provider.d.ts.map