import { Usage, ThinkingResult, Attachment } from "../providers/Provider.js"; import { ToolCall } from "./Tool.js"; import { Schema } from "../schema/Schema.js"; /** * Enhanced string that includes token usage metadata. * Behaves like a regular string but has .usage and .input_tokens etc. */ export declare class ChatResponseString extends String { readonly usage: Usage; readonly model: string; readonly provider: string; readonly thinking?: ThinkingResult | undefined; readonly reasoning?: string | null | undefined; readonly tool_calls?: ToolCall[] | undefined; readonly finish_reason?: string | null | undefined; readonly schema?: Schema | undefined; readonly metadata?: Record | undefined; readonly attachments?: Attachment[] | undefined; private _cachedData; private _validationError; constructor(content: string, usage: Usage, model: string, provider: string, thinking?: ThinkingResult | undefined, reasoning?: string | null | undefined, tool_calls?: ToolCall[] | undefined, finish_reason?: string | null | undefined, schema?: Schema | undefined, metadata?: Record | undefined, attachments?: Attachment[] | undefined); get finishReason(): string | null | undefined; get input_tokens(): number; get output_tokens(): number; get total_tokens(): number; get cached_tokens(): number | undefined; get cost(): number | undefined; get input_cost(): number | undefined; get output_cost(): number | undefined; get inputTokens(): number; get outputTokens(): number; get totalTokens(): number; get cachedTokens(): number | undefined; get content(): string; get model_id(): string; /** * Returns a serializable object containing all response metadata. * Perfect for database persistence. */ get meta(): { usage: Usage; model: string; provider: string; thinking: ThinkingResult | undefined; reasoning: string | null | undefined; tool_calls: ToolCall[] | undefined; finish_reason: string | null | undefined; metadata: Record | undefined; attachments: Attachment[] | undefined; }; /** * Alias for meta (backwards compatibility) */ get raw(): { usage: Usage; model: string; provider: string; thinking: ThinkingResult | undefined; reasoning: string | null | undefined; tool_calls: ToolCall[] | undefined; finish_reason: string | null | undefined; metadata: Record | undefined; attachments: Attachment[] | undefined; }; toString(): string; /** * Return a new ChatResponseString with modified content but preserved metadata. */ withContent(newContent: string): ChatResponseString; /** * Attempt to extract and parse the content as JSON. */ get parsed(): unknown; /** * Access the parsed data. * If a Zod schema was provided via .withSchema(), this will validate the data. * Throws ZodError if validation fails. */ get data(): unknown; /** * Safe version of .data that returns null instead of throwing on validation error. */ get safeData(): unknown; /** * Returns true if the content contains valid JSON that matches the schema (if provided). */ get isValid(): boolean; /** * Returns the validation error if the content doesn't match the schema. */ get validationError(): Error | null; } //# sourceMappingURL=ChatResponse.d.ts.map