Class OpenAIChatModel
java.lang.Object
io.agentscope.core.model.ChatModelBase
io.agentscope.extensions.model.openai.OpenAIChatModel
- All Implemented Interfaces:
io.agentscope.core.model.Model
public class OpenAIChatModel
extends io.agentscope.core.model.ChatModelBase
OpenAI Chat Model using native HTTP API.
This implementation uses direct HTTP calls to OpenAI-compatible APIs.
Features:
- Streaming and non-streaming modes
- Tool calling support
- Automatic message format conversion
- Timeout and retry configuration
- Multi-provider support via different Formatters
Provider-specific behavior is handled by the Formatter. Use the appropriate formatter for your provider:
OpenAIChatFormatter- Standard OpenAI GPT modelsDeepSeekFormatter- DeepSeek Chat modelsMiniMaxFormatter- MiniMax modelsKimiFormatter- Kimi (Moonshot AI) modelsGLMFormatter- Zhipu GLM models
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for OpenAIChatModel. -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenAIChatModel.Builderbuilder()Creates a new builder for OpenAIChatModel.protected reactor.core.publisher.Flux<io.agentscope.core.model.ChatResponse>doStream(List<io.agentscope.core.message.Msg> messages, List<io.agentscope.core.model.ToolSchema> tools, io.agentscope.core.model.GenerateOptions options) protected reactor.core.publisher.Flux<io.agentscope.core.model.ChatResponse>doStream0(List<io.agentscope.core.message.Msg> messages, List<io.agentscope.core.model.ToolSchema> tools, io.agentscope.core.model.GenerateOptions options) Gets the model name for logging and identification.Methods inherited from class io.agentscope.core.model.ChatModelBase
getContextWindowSize, setContextWindowSize, setNativeStructuredOutput, setNativeStructuredOutputWithTools, stream, supportsNativeStructuredOutput, supportsNativeStructuredOutputWithTools
-
Method Details
-
doStream
protected reactor.core.publisher.Flux<io.agentscope.core.model.ChatResponse> doStream(List<io.agentscope.core.message.Msg> messages, List<io.agentscope.core.model.ToolSchema> tools, io.agentscope.core.model.GenerateOptions options) - Specified by:
doStreamin classio.agentscope.core.model.ChatModelBase
-
doStream0
-
getModelName
Gets the model name for logging and identification.- Returns:
- the model name, or null if not configured
-
builder
Creates a new builder for OpenAIChatModel.- Returns:
- a new Builder instance
-