AI Chat Memory Identifier (service/MemoryId.java)

langchain4j · langchain4j/src/main/java/dev/langchain4j/service/MemoryId.java · java · Apache-2.0
ai, lang:java, tag:annotations, tag:memory

An annotation used to link method parameters to specific chat memory sessions in AI services. Use this to maintain conversation context for individual users.

// Source: https://github.com/langchain4j/langchain4j | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package dev.langchain4j.service;

import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import dev.langchain4j.memory.chat.ChatMemoryProvider;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
 * The value of a method parameter annotated with @MemoryId will be used to find the memory belonging to that user/conversation.
 * <p>
 * A parameter annotated with @MemoryId can be of any type, provided it has properly implemented equals() and hashCode() methods.
 * <p>
 * When {@link MemoryId} i

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key