Class OpenAIMultiAgentFormatter
java.lang.Object
io.agentscope.core.formatter.AbstractBaseFormatter<OpenAIMessage,OpenAIResponse,OpenAIRequest>
io.agentscope.extensions.model.openai.formatter.OpenAIBaseFormatter
io.agentscope.extensions.model.openai.formatter.OpenAIChatFormatter
io.agentscope.extensions.model.openai.formatter.OpenAIMultiAgentFormatter
- All Implemented Interfaces:
io.agentscope.core.formatter.Formatter<OpenAIMessage,OpenAIResponse, OpenAIRequest>
- Direct Known Subclasses:
DeepSeekMultiAgentFormatter,DeepSeekMultiAgentFormatter,GLMMultiAgentFormatter,GLMMultiAgentFormatter,KimiMultiAgentFormatter,MiniMaxMultiAgentFormatter
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.
-
Field Summary
Fields inherited from class io.agentscope.extensions.model.openai.formatter.OpenAIBaseFormatter
messageConverter, responseParser -
Constructor Summary
ConstructorsConstructorDescriptionCreate an OpenAIMultiAgentFormatter with default conversation history prompt.OpenAIMultiAgentFormatter(String conversationHistoryPrompt) Create an OpenAIMultiAgentFormatter with custom conversation history prompt. -
Method Summary
Modifier and TypeMethodDescriptionprotected List<OpenAIMessage>protected List<OpenAIMessage>doFormat(List<io.agentscope.core.message.Msg> msgs, io.agentscope.core.model.GenerateOptions options) Methods inherited from class io.agentscope.extensions.model.openai.formatter.OpenAIChatFormatter
applyAdditionalBodyParams, applyMaxTokens, applyOptions, applyToolChoice, applyTools, convertMessage, supportsStrictMethods inherited from class io.agentscope.extensions.model.openai.formatter.OpenAIBaseFormatter
applyToolChoice, applyTools, buildRequest, buildRequest, parseResponseMethods inherited from class io.agentscope.core.formatter.AbstractBaseFormatter
convertToolResultToString, extractTextContent, extractTextContent, format, format, formatRoleLabel, getOptionOrDefault, hasMediaContent, saveBase64DataToTempFile, shouldBypassHistory
-
Constructor Details
-
OpenAIMultiAgentFormatter
public OpenAIMultiAgentFormatter()Create an OpenAIMultiAgentFormatter with default conversation history prompt. -
OpenAIMultiAgentFormatter
Create an OpenAIMultiAgentFormatter with custom conversation history prompt.- Parameters:
conversationHistoryPrompt- The prompt to prepend before conversation history
-
-
Method Details
-
doFormat
- Overrides:
doFormatin classOpenAIChatFormatter
-
doFormat
protected List<OpenAIMessage> doFormat(List<io.agentscope.core.message.Msg> msgs, io.agentscope.core.model.GenerateOptions options) - Overrides:
doFormatin classOpenAIChatFormatter
-