Mojentic.LLM.Gateways.OpenAIMessagesAdapter (Mojentic v1.2.0)

Copy Markdown View Source

Adapter for converting LLM messages to OpenAI format.

This module handles the conversion of universal message format to OpenAI's API format, including multimodal content with images.

Summary

Functions

Adapts LLM messages to OpenAI format.

Converts tool calls from OpenAI format to internal format.

Functions

adapt_messages(messages)

@spec adapt_messages([Mojentic.LLM.Message.t()]) :: [map()]

Adapts LLM messages to OpenAI format.

Parameters

  • messages - List of LLM messages to adapt

Returns

List of messages in OpenAI API format

convert_tool_calls(tool_calls)

@spec convert_tool_calls([map()]) :: [Mojentic.LLM.ToolCall.t()]

Converts tool calls from OpenAI format to internal format.

Parameters

  • tool_calls - List of tool calls in OpenAI format

Returns

List of ToolCall structs