VertexAI会话(Session)服务(Service)

A SessionService backed by the managed Vertex AI Session Service.

This is a Kotlin port of the Java ADK com.google.adk.sessions.VertexAiSessionService. It talks to the service through a VertexAiSessionsClient over a shared GoogleApiClient. The wire format (defined by session.proto) is modeled with a small set of @Serializable DTOs in the dto sub-package; this class only translates between those DTOs and the ADK domain types via the mapper extensions in com.google.adk.kt.sessions.dto.SessionMappers.

The reasoning engine is fixed at construction from project, location, and reasoningEngineId. Unlike the Python and Java ADK, the session key's SessionKey.appName is never parsed to derive the engine - it is only a label - so the engine must be supplied explicitly here.

构造函数(Constructors)

Link copied to clipboard
constructor(project: String, location: String, reasoningEngineId: String, credentials: GoogleCredentials = GoogleApiClient.defaultCredentials(), httpClient: HttpClient = GoogleApiClient.defaultHttpClient(), sessionTtl: Duration? = null)

为推理引擎创建一个服务。 reasoningEngineId 在……下面;在……之下 项目 和 位置.

类型

Link copied to clipboard
class Builder

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

Link copied to clipboard
object Companion

函数

Link copied to clipboard
open suspend override fun appendEvent(session: Session, event: Event): Event

追加(数据) 事件 给……;发送到…… session将该状态变化(即 “状态增量”)应用到内存中的会话数据中,并记录这一事件。 temp: 这些键会被应用到内存中的状态数据上(这样后续参与调用的代理程序就可以读取这些数据),但之后会从内存中删除这些键。 事件 在数据被持久化(即存储到数据库中)之前。

Link copied to clipboard
open suspend fun closeSession(session: Session)

关闭会话。

Link copied to clipboard
open suspend override fun createSession(key: SessionKey, state: Map<String, Any>? = null): Session

使用指定的参数创建一个新的会话。

suspend fun createSession(key: SessionKey, state: Map<String, Any>? = null, ttl: Duration? = null, expireTime: Instant? = null): Session

创建一个会话(session),该会话会在特定时间后失效。这一设计是为了满足推理引擎在系统构建阶段就已确定的特定需求。

Link copied to clipboard
open suspend override fun deleteSession(key: SessionKey)

删除特定的会话。

Link copied to clipboard
open suspend fun flush(key: SessionKey? = null)

在此调用之前,系统会等待所有要写入的数据被追加完成后再进行持久化处理。具体来说,就是那些需要被写入的数据…… key或者,在每次会话开始时(即每次用户登录时)…… key 是 null取消呼叫者的操作会停止等待过程,但不会影响数据的写入操作。

Link copied to clipboard
open suspend override fun getSession(key: SessionKey, config: GetSessionConfig? = null): Session?

检索特定的会话(session),并可选择性地过滤其中包含的事件(events)。

Link copied to clipboard
open suspend override fun listEvents(key: SessionKey): ListEventsResponse

列出特定会话中的所有事件。

Link copied to clipboard
open suspend override fun listSessions(appName: String, userId: String): ListSessionsResponse

列出与特定应用程序和用户关联的会话(session)。