Class OpenAIMultiAgentFormatter

java.lang.Object
io.agentscope.core.formatter.AbstractBaseFormatter<OpenAIMessage,OpenAIResponse,OpenAIRequest>
All Implemented Interfaces:
io.agentscope.core.formatter.Formatter<OpenAIMessage,OpenAIResponse,OpenAIRequest>
Direct Known Subclasses:
DeepSeekMultiAgentFormatter, DeepSeekMultiAgentFormatter, GLMMultiAgentFormatter, GLMMultiAgentFormatter, KimiMultiAgentFormatter, MiniMaxMultiAgentFormatter

public class OpenAIMultiAgentFormatter extends OpenAIChatFormatter
Multi-agent formatter for OpenAI Chat Completion HTTP API. Converts AgentScope Msg objects to OpenAI DTO types with multi-agent support.

This formatter extends OpenAIChatFormatter and handles conversations between multiple agents by:

  • Grouping multi-agent messages into conversation history
  • Using special markup (e.g., history tags) to structure conversations
  • Consolidating multi-agent conversations into single user messages

Inherits all option, tool, and tool_choice handling from OpenAIChatFormatter.

  • Constructor Details

    • OpenAIMultiAgentFormatter

      public OpenAIMultiAgentFormatter()
      Create an OpenAIMultiAgentFormatter with default conversation history prompt.
    • OpenAIMultiAgentFormatter

      public OpenAIMultiAgentFormatter(String conversationHistoryPrompt)
      Create an OpenAIMultiAgentFormatter with custom conversation history prompt.
      Parameters:
      conversationHistoryPrompt - The prompt to prepend before conversation history
  • Method Details