All Implemented Interfaces:
io.agentscope.core.formatter.Formatter<OpenAIMessage,OpenAIResponse,OpenAIRequest>

@Deprecated public class GLMFormatter extends OpenAIChatFormatter
Deprecated.
Formatter for Zhipu GLM models (glm-4, glm-3-turbo, etc.).

Zhipu GLM API has the following specific requirements:

  • At least one user message is required (error 1214 otherwise)
  • Only supports "auto" for tool_choice
  • Does NOT support strict parameter in tool definitions
  • Supports temperature, top_p, max_tokens, seed (but not frequency/presence penalty)

Usage:


 OpenAIChatModel.builder()
     .formatter(new GLMFormatter())
     .modelName("glm-4")
     .baseUrl("https://open.bigmodel.cn/api/paas/v4/")
     .apiKey(apiKey)
     .build();
 
  • Constructor Details

    • GLMFormatter

      public GLMFormatter()
      Deprecated.
  • Method Details

    • doFormat

      protected List<OpenAIMessage> doFormat(List<io.agentscope.core.message.Msg> msgs)
      Deprecated.
      Overrides:
      doFormat in class OpenAIChatFormatter
    • supportsStrict

      protected boolean supportsStrict()
      Deprecated.
      Description copied from class: OpenAIChatFormatter
      Returns 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:
      supportsStrict in class OpenAIChatFormatter
      Returns:
      true if strict parameter is supported, false otherwise
    • applyToolChoice

      public void applyToolChoice(OpenAIRequest request, io.agentscope.core.model.ToolChoice toolChoice)
      Deprecated.
      Description copied from class: OpenAIBaseFormatter
      Apply tool choice configuration to the request. Subclasses implement provider-specific tool choice handling.
      Specified by:
      applyToolChoice in interface io.agentscope.core.formatter.Formatter<OpenAIMessage,OpenAIResponse,OpenAIRequest>
      Overrides:
      applyToolChoice in class OpenAIChatFormatter
      Parameters:
      request - OpenAI request DTO
      toolChoice - Tool choice configuration (null means auto)