ThinkOption
@JsonSerialize(using = ThinkOption.ThinkOptionSerializer.class) @JsonDeserialize(using = ThinkOption.ThinkOptionDeserializer.class) public sealed interface ThinkOption
io/agentscope/extensions/model/ollama/options/ThinkOption.java:44–167定义 Think 选项契约的接口。位于 io.agentscope.extensions.model.ollama.options 包。核心成员包括 toJsonValue。
Defines the configuration contract for the "thinking" capability (Chain of Thought) in AgentScope's Ollama integration. This interface allows users to control how the underlying model exposes its internal reasoning process.
The configuration supports two distinct strategies:
-
ThinkBoolean: A simple toggle to enable or disable thinking (suitable for models like DeepSeek R1). -
ThinkLevel: A granular control to set the depth of reasoning (e.g., "low", "medium", "high" for models like GPT-OSS).
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
ThinkOptionSerializer | 类class | Think 选项序列化器,与模型服务通信并返回生成或向量化结果。 Custom serializer implementation for `ThinkOption`. |
ThinkOptionDeserializer | 类class | Think 选项反序列化器,与模型服务通信并返回生成或向量化结果。 Custom deserializer implementation for `ThinkOption`. |
ThinkBoolean | 记录record | 承载 Think Boolean数据的记录类型。 Implementation of `ThinkOption` representing a binary state (Enabled/Disabled). |
ThinkLevel | 记录record | 承载 Think 级别数据的记录类型。 Implementation of `ThinkOption` representing a specific level of reasoning effort. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Object toJsonValue() | 返回到 JSON 值。 Transforms the current option into a format compatible with the Ollama JSON API. |
方法详情Method Detail
toJsonValue
public Object toJsonValue()
返回到 JSON 值。
Transforms the current option into a format compatible with the Ollama JSON API.
Objectio/agentscope/extensions/model/ollama/options/ThinkOption.java:53嵌套类详情Nested Class Detail
ThinkOptionSerializer
class ThinkOptionSerializer extends JsonSerializer<ThinkOption>Think 选项序列化器,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.ollama.options 包,继承自 JsonSerializer<ThinkOption>。核心成员包括 serialize。
Custom serializer implementation for ThinkOption.
Responsible for converting the option object into the appropriate JSON primitive (boolean or string).
ThinkOptionDeserializer
class ThinkOptionDeserializer extends JsonDeserializer<ThinkOption>Think 选项反序列化器,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.ollama.options 包,继承自 JsonDeserializer<ThinkOption>。核心成员包括 deserialize。
Custom deserializer implementation for ThinkOption.
Detects the JSON token type (boolean or string) and instantiates the corresponding ThinkOption implementation.
ThinkBoolean
record ThinkBoolean(boolean enabled) implements ThinkOption承载 Think Boolean数据的记录类型。位于 io.agentscope.extensions.model.ollama.options 包,实现 ThinkOption。核心成员包括 enabled、toJsonValue、ENABLED、DISABLED。
Implementation of ThinkOption representing a binary state (Enabled/Disabled).
Ideal for models that do not support granular thinking levels.
ThinkLevel
record ThinkLevel(String level) implements ThinkOption承载 Think 级别数据的记录类型。位于 io.agentscope.extensions.model.ollama.options 包,实现 ThinkOption。核心成员包括 level、toJsonValue、ThinkLevel、LOW、MEDIUM、HIGH。
Implementation of ThinkOption representing a specific level of reasoning effort.
Designed for models that allow tuning the "effort" or "depth" of the chain of thought.