Memory

org.llm4s.agent.memory.Memory
See theMemory companion object
final case class Memory(id: MemoryId, content: String, memoryType: MemoryType, metadata: Map[String, String], timestamp: Instant, importance: Option[Double], embedding: Option[Array[Float]])

A single memory entry in the memory system.

Memories are immutable records that capture information for later retrieval. They include content, metadata for filtering, and timestamps for recency-based retrieval.

Value parameters

content

The actual content/text of the memory

embedding

Optional pre-computed embedding vector for semantic search

id

Unique identifier for this memory

importance

Optional importance score (0.0 to 1.0) for prioritization

memoryType

Classification of the memory

metadata

Key-value pairs for filtering and context

timestamp

When this memory was created

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def agentId: Option[String]

Get the agent ID that created this memory (if any).

Get the agent ID that created this memory (if any).

Attributes

def conversationId: Option[String]

Get the conversation ID this memory belongs to (if any).

Get the conversation ID this memory belongs to (if any).

Attributes

def getMetadata(key: String): Option[String]

Get metadata value by key.

Get metadata value by key.

Attributes

def isEmbedded: Boolean

Check if this memory has been embedded.

Check if this memory has been embedded.

Attributes

def source: Option[String]

Get the source of this memory (if recorded).

Get the source of this memory (if recorded).

Attributes

def withEmbedding(vector: Array[Float]): Memory

Create a copy with an embedding vector.

Create a copy with an embedding vector.

Attributes

def withImportance(score: Double): Memory

Create a copy with an importance score.

Create a copy with an importance score.

Attributes

def withMetadata(key: String, value: String): Memory

Create a copy with updated metadata.

Create a copy with updated metadata.

Attributes

def withMetadata(newMetadata: Map[String, String]): Memory

Create a copy with merged metadata.

Create a copy with merged metadata.

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product