Model
public interface Model
io/agentscope/core/model/Model.java:22–85定义模型契约的接口。位于 io.agentscope.core.model 包。核心成员包括 stream、getModelName、supportsNativeStructuredOutput、supportsNativeStructuredOutputWithTools、getContextWindowSize。
An interface in io.agentscope.core.model that defines the contract for components that talks to model services and returns generated or embedded output. Declared in io.agentscope.core.model.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Flux<ChatResponse> stream(List<Msg> messages, List<ToolSchema> tools, GenerateOptions options) | 执行流相关操作。 Stream chat completion responses. |
public String getModelName() | 获取模型名称。 Get model name for logging and identification. |
default public boolean supportsNativeStructuredOutput()default | 判断是否此模型支持原生结构化输出(`response_format`使用`json_schema`)。 Whether this model supports native structured output (`response_format` with
`json_schema`). |
default public boolean supportsNativeStructuredOutputWithTools()default | 返回支持原生结构化输出使用工具。 Whether this model correctly handles native structured output (`response_format`
with `json_schema`) when tools are also present in the request. |
default public int getContextWindowSize()default | 获取 `getContextWindowSize`。 Returns the model's context window size in tokens, or `0` if unknown. |
方法详情Method Detail
stream
public Flux<ChatResponse> stream(List<Msg> messages, List<ToolSchema> tools, GenerateOptions options)
执行流相关操作。
Stream chat completion responses.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
messages | List<Msg> | 消息列表(类型 `List`)。AgentScope messages to send to the model |
tools | List<ToolSchema> | 工具列表(类型 `List`)。Optional list of tool schemas (null or empty if no tools) |
options | GenerateOptions | 选项(类型 `GenerateOptions`)。Optional generation options (null to use defaults) |
Flux<ChatResponse>io/agentscope/core/model/Model.java:33getModelName
public String getModelName()
获取模型名称。
Get model name for logging and identification.
Stringio/agentscope/core/model/Model.java:40supportsNativeStructuredOutput
default public boolean supportsNativeStructuredOutput()
判断是否此模型支持原生结构化输出(response_format使用json_schema)。
Whether this model supports native structured output (response_format with json_schema).
booleanio/agentscope/core/model/Model.java:51–53supportsNativeStructuredOutputWithTools
default public boolean supportsNativeStructuredOutputWithTools()
返回支持原生结构化输出使用工具。
Whether this model correctly handles native structured output (response_format with json_schema) when tools are also present in the request.
booleanio/agentscope/core/model/Model.java:69–71getContextWindowSize
default public int getContextWindowSize()
获取 getContextWindowSize。
Returns the model's context window size in tokens, or 0 if unknown.
intio/agentscope/core/model/Model.java:82–84