AS AgentScopeAPI 手册 / API Reference

TrinityModelAdapter

public class TrinityModelAdapter extends ChatModelBase
源码Source io/agentscope/core/training/backend/TrinityModelAdapter.java:52–185

Trinity 模型适配器,对智能体行为进行评测、追踪与可观测性分析。位于 io.agentscope.core.training.backend 包,继承自 ChatModelBase。核心成员包括 doStream、getModelName、getExecutionContext、builder。

Trinity Model Adapter

Lightweight adapter using composition pattern to wrap OpenAIChatModel for:

  • Routing model calls to Trinity Chat API

  • Automatically collecting msg_ids and associating them with RunExecutionContext

Trinity's Chat API is fully compatible with OpenAI format, so OpenAIChatModel can be used directly. This adapter simply intercepts responses and collects msg_id (response.id) for subsequent feedback.

Automated design:

  • Internal component, created and managed by TrainingRouter

  • Automatically collects msg_ids to RunExecutionContext

  • Completely transparent to users

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
TrinityModelAdapter的构建器。
Builder for TrinityModelAdapter

方法摘要Method Summary

方法Method说明Description
protected Flux<ChatResponse> doStream(List<Msg> messages, List<ToolSchema> tools, GenerateOptions options)
以流式方式执行并返回结果。
Performs the do stream operation.
public String getModelName()
获取模型名称。
Returns the model name.
public RunExecutionContext getExecutionContext()
获取任务执行上下文。
Get task execution context
public static Builder builder()
static
创建构建器。
Create Builder

方法详情Method Detail

doStream

protected Flux<ChatResponse> doStream(List<Msg> messages, List<ToolSchema> tools, GenerateOptions options)

以流式方式执行并返回结果。

Performs the do stream operation.

参数Parameters
名称Name类型Type说明Description
messagesList<Msg>消息列表(类型 `List`)。The messages.
toolsList<ToolSchema>工具列表(类型 `List`)。The tools.
optionsGenerateOptions选项(类型 `GenerateOptions`)。The options.
返回Returns Flux<ChatResponse>
返回Flux。Returns flux.
源码Source io/agentscope/core/training/backend/TrinityModelAdapter.java:73–99

getModelName

public String getModelName()

获取模型名称。

Returns the model name.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/training/backend/TrinityModelAdapter.java:101–104

getExecutionContext

public RunExecutionContext getExecutionContext()

获取任务执行上下文。

Get task execution context

返回Returns RunExecutionContext
返回RunExecutionContext。Execution context (may be null)
源码Source io/agentscope/core/training/backend/TrinityModelAdapter.java:111–113

builder

public static Builder builder()
static

创建构建器。

Create Builder

返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/training/backend/TrinityModelAdapter.java:118–120

嵌套类详情Nested Class Detail

Builder

public static class Builder

TrinityModelAdapter的构建器。位于 io.agentscope.core.training.backend 包。核心成员包括 baseUrl、modelName、apiKey、executionContext、build。

Builder for TrinityModelAdapter

继承成员Inherited Members

基于官方固定版本源码静态生成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.