可完成的(任务或操作)未来内存服务(Service)

Java-friendly wrapper around a MemoryService that it owns: each method calls the suspend method of the same name and returns a CompletableFuture of its result, so Java callers never pass a Continuation. Each call runs in the caller's OpenTelemetry context and in the coroutineContext passed to it, such as MDCContext() from kotlinx-coroutines-slf4j to carry the caller's MDC. Canceling a future cancels its call, a Job in coroutineContext is ignored, and close cancels every call in flight, then closes the service if it is AutoCloseable.

类型

Link copied to clipboard
object Companion

函数

Link copied to clipboard
fun addEventsToMemory(appName: String, userId: String, events: List<Event>, sessionId: String? = null, customMetadata: Map<String, Any?>? = null, coroutineContext: CoroutineContext = EmptyCoroutineContext): CompletableFuture<Void?>

调用(函数或方法) MemoryService.addEventsToMemory……未来总是以失败告终。 `UnsupportedOperationException` 如果该服务不支持事件增量更新(即不支持“事件增量”功能),则……

Link copied to clipboard
fun addMemory(appName: String, userId: String, memories: List<MemoryEntry>, customMetadata: Map<String, Any?>? = null, coroutineContext: CoroutineContext = EmptyCoroutineContext): CompletableFuture<Void?>

调用(函数或方法) MemoryService.addMemory……未来总是以失败告终。 `UnsupportedOperationException` 如果该服务不支持直接写入内存(即不能直接将数据写入内存),则需要采取其他方法来实现数据传输。

Link copied to clipboard
fun addSessionToMemory(session: Session, coroutineContext: CoroutineContext = EmptyCoroutineContext): CompletableFuture<Void?>

调用(函数或方法) MemoryService.addSessionToMemory.

Link copied to clipboard

适用于已转换为 Kotlin 语言的代码的“封装内存服务”(wrapped memory service)。

Link copied to clipboard
open override fun close()

在通话进行中取消通话;如果该服务仍处于开启状态,则关闭该服务。 AutoCloseable后续的每次调用都会返回一个已被取消的“future”对象(即那些原本应该在未来某个时间执行的操作)。

Link copied to clipboard
fun searchMemory(appName: String, userId: String, query: String, coroutineContext: CoroutineContext = EmptyCoroutineContext): CompletableFuture<SearchMemoryResponse>

调用(函数或方法) MemoryService.searchMemory.