VertexAiRagMemoryService

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 = HttpClient(Java))

Creates a service for the given RAG corpus in project and location.

Types

Link copied to clipboard
class Builder

Fluent builder for VertexAiRagMemoryService, provided primarily for Java callers. Any property left unset falls back to the same default as the constructor.

Link copied to clipboard
object Companion

Functions

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

Adds an explicit list of events to the memory service.

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

Adds explicit memory items directly to the memory service.

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

Adds a session to the memory service.

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

Searches for sessions that match the query asynchronously.