import { OutputParserException } from '@langchain/core/output_parsers'; import type { z } from 'zod'; import type { ChatLunaChatModel } from 'koishi-plugin-chatluna/llm-core/platform/model'; import type { PromptMessages } from '../prompts/prompt_format'; import { type LivingMemoryLogger } from '../logging/logger'; export interface StructuredOutputContext { presetId: string; conversationId: string; } export type StructuredOutputResult = { value: T; output: string; parseError: null; } | { value: null; output: string; parseError: string; }; interface StructuredOutputOptions { model: ChatLunaChatModel; signal?: AbortSignal; prompt: PromptMessages; toolName: string; toolDescription: string; schema: Schema; validateResult?: (value: z.output) => string | undefined; stringifiedArrayField?: Extract, string>; context: StructuredOutputContext; logging?: { logger: LivingMemoryLogger; stage: string; }; } export declare const isOutputParserException: (error: unknown) => error is OutputParserException; export declare function invokeStructuredOutput(options: StructuredOutputOptions): Promise>>; export {};