/** * Formatting utilities for the OpenRouter Kit library. */ import { Message } from '../types'; /** * Formats an array of message objects for sending to the OpenRouter/OpenAI API. * Ensures only the necessary fields (`role`, `content`, `name`, `tool_call_id`, `tool_calls`) * are included and `content` is explicitly `null` if missing (as required by API). * * @param history - Array of history messages (`Message[]`). * @returns A new array containing formatted `Message` objects suitable for the API. * Returns an empty array if the input is not a valid array. */ export declare function formatMessages(history: Message[]): Message[]; /** * Formats a Date object or a timestamp string into an ISO 8601 UTC string. * Uses the current time if no valid input is provided. * * @param timestamp - Optional: A Date object, or a string parsable by `new Date()`. * @returns Date and time string in ISO 8601 UTC format (e.g., "2023-10-27T10:30:00.123Z"). */ export declare function formatDateTime(timestamp?: string | Date): string; /** * @deprecated Functionality is context-dependent and better handled by `_parseAndValidateJsonResponse` in client.ts. * Avoid using this function for response parsing. */ export declare function formatResponseByType(responseText: string, type?: string): any; /** * Ensures all messages in an array have a `timestamp` field. * Adds the current timestamp (in ISO 8601 UTC format) if missing. * Modifies the array in place? No, returns a new array. * * @param messages - Array of messages (`Message[]`) to process. * @returns A new array of messages, each guaranteed to have a `timestamp`. * Returns an empty array if the input is not a valid array. */ export declare function addRenderingInfoToMessages(messages: Message[]): Message[]; /** * Formats model response content (of any type) into a string suitable for display or logging. * Objects and arrays are pretty-printed as JSON strings. * Handles primitives, null, and undefined appropriately. * * @param content - The response content (can be string, object, array, number, boolean, null, undefined). * @returns A string representation of the content. */ export declare function formatResponseForDisplay(content: any): string;