aiwrapper
Version:
A Universal AI Wrapper for JavaScript & TypeScript
42 lines (41 loc) • 1.77 kB
TypeScript
import { LangMessages, LangMessage, LangContentImage, LangTool } from "../../messages";
export type BodyPartForOpenAIResponses = {
input?: any[];
previous_response_id?: string;
instructions?: string;
tools?: any[];
tool_choice?: string;
};
export declare function prepareBodyPartForOpenAIResponsesAPI(messages: LangMessages): BodyPartForOpenAIResponses;
/**
* Converts our internal message format to OpenAI Responses API input format.
*
* The Responses API expects a flat array of items, where:
* - Regular messages (system/user/assistant) become message items with content arrays
* - Tool calls become function_call items
* - Tool results become function_call_output items
* - Previous raw output items are preserved for context
*/
export declare function transformMessagesToResponsesInput(messages: LangMessages): any;
/**
* Transform a regular message (user/assistant) to Responses API format
*/
export declare function transformMessageToResponsesItems(message: LangMessage): any;
/**
* Transform tool results message to function_call_output or apply_patch_call_output items
*/
export declare function transformToolResultsToResponsesItems(message: LangMessage): any;
/**
* Transform tool call messages to function_call items
*/
/**
* Transform tool result messages to function_call_output items
* Also includes any previous raw output items that need to be preserved
*/
export declare function mapImageInput(image: LangContentImage): any;
/**
* Maps assistant images to output_text format for Responses API.
* Assistant messages can only contain output_text or refusal, not input_image.
*/
export declare function mapImageOutput(image: LangContentImage): any;
export declare function transformToolsForProvider(tools: LangTool[]): any[];