/**
 * Optimized ChatBedrockConverse wrapper that fixes content block merging for
 * streaming responses and adds support for latest @langchain/aws features:
 *
 * - Application Inference Profiles (PR #9129)
 * - Service Tiers (Priority/Standard/Flex) (PR #9785) - requires AWS SDK 3.966.0+
 *
 * Bedrock's `@langchain/aws` library does not include an `index` property on content
 * blocks (unlike Anthropic/OpenAI), which causes LangChain's `_mergeLists` to append
 * each streaming chunk as a separate array entry instead of merging by index.
 *
 * This wrapper takes full ownership of the stream by directly interfacing with the
 * AWS SDK client (`this.client`) and using custom handlers from `./utils/` that
 * include `contentBlockIndex` in response_metadata for every delta type. It then
 * promotes `contentBlockIndex` to an `index` property on each content block
 * (mirroring Anthropic's pattern) and strips it from metadata to avoid
 * `_mergeDicts` conflicts.
 *
 * When multiple content block types are present (e.g. reasoning + text), text deltas
 * are promoted from strings to array form with `index` so they merge correctly once
 * the accumulated content is already an array.
 */
import { ChatBedrockConverse } from '@langchain/aws';
import { ChatGenerationChunk, ChatResult } from '@langchain/core/outputs';
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
import type { ChatBedrockConverseInput } from '@langchain/aws';
import type { BaseMessage } from '@langchain/core/messages';
/**
 * Service tier type for Bedrock invocations.
 * Requires AWS SDK >= 3.966.0 to actually work.
 * @see https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html
 */
export type ServiceTierType = 'priority' | 'default' | 'flex' | 'reserved';
/**
 * Extended input interface with additional features:
 * - applicationInferenceProfile: Use an inference profile ARN instead of model ID
 * - serviceTier: Specify service tier (Priority, Standard, Flex, Reserved)
 */
export interface CustomChatBedrockConverseInput extends ChatBedrockConverseInput {
    /**
     * Application Inference Profile ARN to use for the model.
     * For example, "arn:aws:bedrock:eu-west-1:123456789102:application-inference-profile/fm16bt65tzgx"
     * When provided, this ARN will be used for the actual inference calls instead of the model ID.
     * Must still provide `model` as normal modelId to benefit from all the metadata.
     * @see https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-create.html
     */
    applicationInferenceProfile?: string;
    /**
     * Service tier for model invocation.
     * Specifies the processing tier type used for serving the request.
     * Supported values are 'priority', 'default', 'flex', and 'reserved'.
     *
     * - 'priority': Prioritized processing for lower latency
     * - 'default': Standard processing tier
     * - 'flex': Flexible processing tier with lower cost
     * - 'reserved': Reserved capacity for consistent performance
     *
     * If not provided, AWS uses the default tier.
     * Note: Requires AWS SDK >= 3.966.0 to work.
     * @see https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html
     */
    serviceTier?: ServiceTierType;
}
/**
 * Extended call options with serviceTier override support.
 */
export interface CustomChatBedrockConverseCallOptions {
    serviceTier?: ServiceTierType;
}
export declare class CustomChatBedrockConverse extends ChatBedrockConverse {
    /**
     * Application Inference Profile ARN to use instead of model ID.
     */
    applicationInferenceProfile?: string;
    /**
     * Service tier for model invocation.
     */
    serviceTier?: ServiceTierType;
    constructor(fields?: CustomChatBedrockConverseInput);
    static lc_name(): string;
    /**
     * Get the model ID to use for API calls.
     * Returns applicationInferenceProfile if set, otherwise returns this.model.
     */
    protected getModelId(): string;
    /**
     * Override invocationParams to add serviceTier support.
     */
    invocationParams(options?: this['ParsedCallOptions'] & CustomChatBedrockConverseCallOptions): ReturnType<ChatBedrockConverse['invocationParams']> & {
        serviceTier?: {
            type: ServiceTierType;
        };
    };
    /**
     * Override _generateNonStreaming to use applicationInferenceProfile as modelId.
     * Uses the same model-swapping pattern as streaming for consistency.
     */
    _generateNonStreaming(messages: BaseMessage[], options: this['ParsedCallOptions'] & CustomChatBedrockConverseCallOptions, runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
    /**
     * Own the stream end-to-end so we have direct access to every
     * `contentBlockDelta.contentBlockIndex` from the AWS SDK.
     *
     * This replaces the parent's implementation which strips contentBlockIndex
     * from text and reasoning deltas, making it impossible to merge correctly.
     */
    _streamResponseChunks(messages: BaseMessage[], options: this['ParsedCallOptions'] & CustomChatBedrockConverseCallOptions, runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
    /**
     * Inject `index` on content blocks for proper merge behaviour, then strip
     * `contentBlockIndex` from response_metadata to prevent `_mergeDicts` conflicts.
     *
     * Text string content is promoted to array form only when the stream contains
     * multiple content block indices (e.g. reasoning at index 0, text at index 1),
     * ensuring text merges correctly with the already-array accumulated content.
     */
    private enrichChunk;
    /**
     * Extract `contentBlockIndex` from the top level of response_metadata.
     * Our custom handlers always place it at the top level.
     */
    private extractContentBlockIndex;
    private removeContentBlockIndex;
}
export type { ChatBedrockConverseInput };
