ExecuteToolScope class
为 AI 工具执行作提供 OpenTelemetry 跟踪范围。
方法
| record |
记录遥测跟踪的响应信息。 |
| start(Tool |
创建并启动工具执行跟踪的新范围。 |
继承的方法
| dispose() | 用于兼容性的旧释放方法 |
| record |
记录作期间发生的错误 |
| with |
使此范围在异步回调执行期间处于活动状态 |
方法详细信息
recordResponse(string)
记录遥测跟踪的响应信息。
function recordResponse(response: string)
参数
- response
-
string
工具执行响应
start(ToolCallDetails, AgentDetails, TenantDetails)
创建并启动工具执行跟踪的新范围。
static function start(details: ToolCallDetails, agentDetails: AgentDetails, tenantDetails: TenantDetails): ExecuteToolScope
参数
- details
- ToolCallDetails
工具调用详细信息
- agentDetails
- AgentDetails
代理详细信息
- tenantDetails
- TenantDetails
租户详细信息
返回
新的 ExecuteToolScope 实例。
继承的方法详细信息
dispose()
recordError(Error)
记录作期间发生的错误
function recordError(error: Error)
参数
- error
-
Error
发生的错误
withActiveSpanAsync<T>(() => Promise<T>)
使此范围在异步回调执行期间处于活动状态
function withActiveSpanAsync<T>(callback: () => Promise<T>): Promise<T>
参数
- callback
-
() => Promise<T>
返回
Promise<T>