langchain.js
    Preparing search index...

    Variable convertStandardContentMessageToResponsesInputConst

    convertStandardContentMessageToResponsesInput: BaseDynamicToolInput<
        BaseDynamicToolInput,
        OpenAIClient.Responses.ResponseInputItem[],
    > = ...

    Converts a single LangChain BaseMessage to OpenAI Responses API input format.

    This converter transforms a LangChain message into one or more ResponseInputItem objects that can be used with OpenAI's Responses API. It handles complex message structures including tool calls, reasoning blocks, multimodal content, and various content block types.

    The LangChain BaseMessage to convert. Can be any message type including HumanMessage, AIMessage, SystemMessage, ToolMessage, etc.

    An array of ResponseInputItem objects.

    Basic text message conversion:

    const message = new HumanMessage("Hello, how are you?");
    const items = convertStandardContentMessageToResponsesInput(message);
    // Returns: [{ type: "message", role: "user", content: [{ type: "input_text", text: "Hello, how are you?" }] }]

    AI message with tool calls:

    const message = new AIMessage({
    content: "I'll check the weather for you.",
    tool_calls: [{
    id: "call_123",
    name: "get_weather",
    args: { location: "San Francisco" }
    }]
    });
    const items = convertStandardContentMessageToResponsesInput(message);
    // Returns:
    // [
    // { type: "message", role: "assistant", content: [{ type: "input_text", text: "I'll check the weather for you." }] },
    // { type: "function_call", call_id: "call_123", name: "get_weather", arguments: '{"location":"San Francisco"}' }
    // ]