AS AgentScopeAPI 手册 / API Reference

Model

public interface Model
源码Source 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.

参数Parameters
名称Name类型Type说明Description
messagesList<Msg>消息列表(类型 `List`)。AgentScope messages to send to the model
toolsList<ToolSchema>工具列表(类型 `List`)。Optional list of tool schemas (null or empty if no tools)
optionsGenerateOptions选项(类型 `GenerateOptions`)。Optional generation options (null to use defaults)
返回Returns Flux<ChatResponse>
返回Flux。Flux stream of chat responses
源码Source io/agentscope/core/model/Model.java:33

getModelName

public String getModelName()

获取模型名称。

Get model name for logging and identification.

返回Returns String
返回字符串结果。model name
源码Source io/agentscope/core/model/Model.java:40

supportsNativeStructuredOutput

default public boolean supportsNativeStructuredOutput()
default

判断是否此模型支持原生结构化输出(response_format使用json_schema)。

Whether this model supports native structured output (response_format with json_schema).

另见See also @see #supportsNativeStructuredOutputWithTools()
返回Returns boolean
返回布尔值,表示判断结果。`true` if the model supports native structured output
源码Source io/agentscope/core/model/Model.java:51–53

supportsNativeStructuredOutputWithTools

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.

返回Returns boolean
返回布尔值,表示判断结果。`true` if the model handles `response_format` alongside tools correctly
源码Source io/agentscope/core/model/Model.java:69–71

getContextWindowSize

default public int getContextWindowSize()
default

获取 getContextWindowSize。

Returns the model's context window size in tokens, or 0 if unknown.

返回Returns int
返回数值结果。context window size in tokens, or `0` if not available
源码Source io/agentscope/core/model/Model.java:82–84
基于官方固定版本源码静态生成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.