VertexAIRag内存服务(Service)

A MemoryService backed by a Vertex AI RAG corpus.

This is a Kotlin port of the Python ADK VertexAiRagMemoryService. addSessionToMemory uploads a session's text events to the corpus as a single newline-delimited-JSON file whose display name encodes the app/user/session scope; searchMemory retrieves relevant contexts, keeps only those whose scope matches the requested app and user, and reconstructs the stored events into MemoryEntry results.

It follows the VertexAiSessionService port: a thin VertexAiRagClient over a shared GoogleApiClient handles the Vertex AI RAG REST calls, and @Serializable wire DTOs live in the dto sub-package.

构造函数(Constructors)

Link copied to clipboard
constructor(project: String, location: String, ragCorpus: String, similarityTopK: Int? = null, vectorDistanceThreshold: Double = DEFAULT_VECTOR_DISTANCE_THRESHOLD, credentials: GoogleCredentials = GoogleApiClient.defaultCredentials(), httpClient: HttpClient = GoogleApiClient.defaultHttpClient(UPLOAD_READ_TIMEOUT))

为给定的 RAG(Retrieval with Annotation)语料库创建一个服务。 项目 和 位置.

类型

Link copied to clipboard
class Builder

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

Link copied to clipboard
object Companion

函数

Link copied to clipboard
open suspend fun addEventsToMemory(appName: String, userId: String, events: List<Event>, sessionId: String? = null, customMetadata: Map<String, Any?>? = null)

向内存服务中添加一个明确指定的事件列表。

Link copied to clipboard
open suspend fun addMemory(appName: String, userId: String, memories: List<MemoryEntry>, customMetadata: Map<String, Any?>? = null)

将明确指定的内存项直接添加到内存服务中。

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

将一个会话添加到内存服务中。

Link copied to clipboard
open suspend override fun searchMemory(appName: String, userId: String, query: String): SearchMemoryResponse

异步地搜索与查询条件匹配的会话(session)。