Class KimiMultiAgentFormatter
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
io.agentscope.extensions.model.openai.compat.kimi.KimiMultiAgentFormatter
- All Implemented Interfaces:
io.agentscope.core.formatter.Formatter<OpenAIMessage,OpenAIResponse, OpenAIRequest>
Multi-agent formatter for Kimi (Moonshot AI) models.
This formatter extends OpenAIMultiAgentFormatter with the same Kimi-specific
handling as KimiFormatter:
- Fixed sampling parameters (
temperature/top_p/ penalties) are stripped onkimi-*models reasoning_effortis only kept forkimi-k3;thinking_budgetis always strippedmax_tokensis mapped tomax_completion_tokenstool_choiceis degraded when the target model does not support the requested mode (seeKimiFormatterfor details)- The
strictparameter in tool definitions is not sent
Usage:
OpenAIChatModel.builder()
.formatter(new KimiMultiAgentFormatter())
.modelName("kimi-k3")
.baseUrl("https://api.moonshot.cn/v1")
.apiKey(apiKey)
.build();
- See Also:
-
Field Summary
Fields inherited from class io.agentscope.extensions.model.openai.formatter.OpenAIBaseFormatter
messageConverter, responseParser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyOptions(OpenAIRequest request, io.agentscope.core.model.GenerateOptions options, io.agentscope.core.model.GenerateOptions defaultOptions) Apply generation options to the request.voidapplyToolChoice(OpenAIRequest request, io.agentscope.core.model.ToolChoice toolChoice) Apply tool choice configuration to the request.protected booleanReturns whether this formatter's target API supports the strict parameter in tool definitions.Methods inherited from class io.agentscope.extensions.model.openai.formatter.OpenAIMultiAgentFormatter
doFormat, doFormatMethods inherited from class io.agentscope.extensions.model.openai.formatter.OpenAIChatFormatter
applyAdditionalBodyParams, applyMaxTokens, applyTools, convertMessageMethods 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
-
KimiMultiAgentFormatter
public KimiMultiAgentFormatter() -
KimiMultiAgentFormatter
-
-
Method Details
-
supportsStrict
protected boolean supportsStrict()Description copied from class:OpenAIChatFormatterReturns whether this formatter's target API supports the strict parameter in tool definitions.Subclasses can override this method to disable strict parameter for providers that don't support it (e.g., DeepSeek).
- Overrides:
supportsStrictin classOpenAIChatFormatter- Returns:
- true if strict parameter is supported, false otherwise
-
applyOptions
public void applyOptions(OpenAIRequest request, io.agentscope.core.model.GenerateOptions options, io.agentscope.core.model.GenerateOptions defaultOptions) Description copied from class:OpenAIBaseFormatterApply generation options to the request. Subclasses implement provider-specific option handling.- Specified by:
applyOptionsin interfaceio.agentscope.core.formatter.Formatter<OpenAIMessage,OpenAIResponse, OpenAIRequest> - Overrides:
applyOptionsin classOpenAIChatFormatter- Parameters:
request- OpenAI request DTOoptions- Generation options to applydefaultOptions- Default options to use if options parameter is null
-
applyToolChoice
Description copied from class:OpenAIBaseFormatterApply tool choice configuration to the request. Subclasses implement provider-specific tool choice handling.- Specified by:
applyToolChoicein interfaceio.agentscope.core.formatter.Formatter<OpenAIMessage,OpenAIResponse, OpenAIRequest> - Overrides:
applyToolChoicein classOpenAIChatFormatter- Parameters:
request- OpenAI request DTOtoolChoice- Tool choice configuration (null means auto)
-