Big查询代理(Agent)Analytics插件(Plugin)

An ADK Plugin that records agent execution events to a BigQuery table. If the destination table does not exist, the plugin automatically creates and configures the partitioned table on first use. Rows are queued and written in the background in batches with the BigQuery Storage Write API; call close when done to write the rows still queued.

构造函数(Constructors)

Link copied to clipboard
constructor(config: BigQueryLoggerConfig, bigQuery: BigQuery = createBigQuery(config), ioContext: CoroutineContext = Dispatchers.IO, timeSource: TimeSource = TimeSource.Monotonic)

创建一个插件,该插件会将日志数据写入指定的表格中。 config names.

类型

Link copied to clipboard
class Builder

Fluent Builder for BigQueryAgentAnalyticsPlugin该功能主要为 Java 语言的调用者提供支持;如果某个属性未被设置,其值将默认使用构造函数中指定的默认值。

Link copied to clipboard
object Companion

属性(Properties)

Link copied to clipboard
open override val name: String

函数

Link copied to clipboard
open suspend override fun afterAgent(context: CallbackContext): CallbackChoice<Unit, Content>
Link copied to clipboard
open suspend override fun afterModel(context: CallbackContext, response: LlmResponse): LlmResponse
Link copied to clipboard
open suspend override fun afterRun(invocationContext: InvocationContext)
Link copied to clipboard
open suspend override fun afterTool(context: ToolContext, tool: BaseTool, args: Map<String, Any?>, result: Map<String, Any?>): Map<String, Any?>
Link copied to clipboard
open suspend override fun beforeAgent(context: CallbackContext): CallbackChoice<EventActions, Content>
Link copied to clipboard
open suspend override fun beforeModel(context: CallbackContext, request: LlmRequest): CallbackChoice<LlmRequest, LlmResponse>
Link copied to clipboard
open suspend override fun beforeRun(invocationContext: InvocationContext): CallbackChoice<Unit, Content>
Link copied to clipboard
open suspend override fun beforeTool(context: ToolContext, tool: BaseTool, args: Map<String, Any?>): CallbackChoice<Map<String, Any?>, Map<String, Any?>>
Link copied to clipboard
open override fun close()

将那些仍待处理的、尚未被写入数据库的记录写入数据库。 BigQueryLoggerConfig.shutdownTimeout然后释放写入客户端(write client)。接下来记录的那一行数据标志着一个新的记录的开始。

Link copied to clipboard
suspend fun flush()

该操作会等待所有记录都被写入日志后,才会将相关数据写入 BigQuery 或从数据库中删除。

Link copied to clipboard

返回迄今为止因各种原因被删除的行数(例如: queue_full 或者 retry_exhausted所有可能的理由都被列了出来,包括那些“没有产生任何结果”(即没有实现预期效果)的情况。

Link copied to clipboard
open suspend override fun onEvent(invocationContext: InvocationContext, event: Event): Event
Link copied to clipboard
open suspend override fun onModelError(context: CallbackContext, request: LlmRequest, error: Throwable): CallbackChoice<Unit, LlmResponse>
Link copied to clipboard
open suspend override fun onRunError(invocationContext: InvocationContext, error: Throwable)
Link copied to clipboard
open suspend override fun onToolError(context: ToolContext, tool: BaseTool, args: Map<String, Any?>, error: Throwable): CallbackChoice<Unit, Map<String, Any?>>
Link copied to clipboard
open suspend override fun onUserMessage(invocationContext: InvocationContext, userMessage: Content): Content