类 GLMFormatter

所有已实现的接口:
Formatter<OpenAIMessage,OpenAIResponse,OpenAIRequest>

public class GLMFormatter extends OpenAIChatFormatter
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();