/** * toolCallContinuation — Utilities for detecting and classifying LLM finish * reasons across providers. Used to detect max_tokens truncation and normalize * stop reason extraction from provider-specific metadata formats. * * @module */ import type { AIMessageChunk } from '@langchain/core/messages'; /** * Extract the finish/stop reason from an AIMessageChunk's response_metadata. * Centralizes provider-specific metadata access patterns. * * Provider formats: * - OpenAI/Azure: `response_metadata.finish_reason` * - Anthropic direct: `response_metadata.stop_reason` * - Bedrock invoke: `response_metadata.stopReason` * - Bedrock streaming: `response_metadata.messageStop.stopReason` * - VertexAI/Google: `response_metadata.finishReason` * * @param chunk - The final accumulated AIMessageChunk * @returns The finish reason string, or undefined if not found */ export declare function extractFinishReason(chunk: AIMessageChunk | undefined): string | undefined; /** * Check if a finish reason indicates the response was truncated by token limits. * * @param reason - The finish reason from extractFinishReason() * @returns true if the response was cut short by max_tokens */ export declare function isMaxTokensFinish(reason: string | undefined): boolean;