AS AgentScopeAPI 手册 / API Reference

ThinkOption

@JsonSerialize(using = ThinkOption.ThinkOptionSerializer.class) @JsonDeserialize(using = ThinkOption.ThinkOptionDeserializer.class) public sealed interface ThinkOption
源码Source 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.

返回Returns Object
返回对象。A `Boolean` for toggle-based options, or a `String` for level-based options.
源码Source io/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.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.