EpisodicMemoryImpl

@daydreamsai/core


@daydreamsai/core / EpisodicMemoryImpl

Class: EpisodicMemoryImpl

Defined in: packages/core/src/memory/episodic-memory.ts:64

Episodic Memory - manages conversational episodes and experiences

Implements

Constructors

Constructor

new EpisodicMemoryImpl(memory, options): EpisodicMemoryImpl

Defined in: packages/core/src/memory/episodic-memory.ts:68

Parameters

memory

Memory

options

EpisodicMemoryOptions = {}

Returns

EpisodicMemoryImpl

Methods

addToCurrentEpisode()

addToCurrentEpisode(contextId, ref): void

Defined in: packages/core/src/memory/episodic-memory.ts:319

Add log to current episode

Parameters

contextId

string

ref

AnyRef

Returns

void


clearContext()

clearContext(contextId): Promise<void>

Defined in: packages/core/src/memory/episodic-memory.ts:252

Clear all episodes for a context

Parameters

contextId

string

Returns

Promise<void>

Implementation of

EpisodicMemory.clearContext


createFromLogs()

createFromLogs(contextId, logs, contextState, agent): Promise<Episode>

Defined in: packages/core/src/memory/episodic-memory.ts:173

Create episode from logs

Parameters

contextId

string

logs

AnyRef[]

contextState

ContextState

agent

AnyAgent

Returns

Promise<Episode>

Implementation of

EpisodicMemory.createFromLogs


delete()

delete(episodeId): Promise<boolean>

Defined in: packages/core/src/memory/episodic-memory.ts:231

Delete episode

Parameters

episodeId

string

Returns

Promise<boolean>

Implementation of

EpisodicMemory.delete


finalizeCurrentEpisode()

finalizeCurrentEpisode(contextId, contextState, agent): Promise<null | Episode>

Defined in: packages/core/src/memory/episodic-memory.ts:329

Finalize current episode

Parameters

contextId

string

contextState

ContextState

agent

AnyAgent

Returns

Promise<null | Episode>


findSimilar()

findSimilar(contextId, query, limit): Promise<Episode[]>

Defined in: packages/core/src/memory/episodic-memory.ts:120

Find episodes similar to a query

Parameters

contextId

string

query

string

limit

number = 5

Returns

Promise<Episode[]>

Implementation of

EpisodicMemory.findSimilar


get()

get(episodeId): Promise<null | Episode>

Defined in: packages/core/src/memory/episodic-memory.ts:146

Get episode by ID

Parameters

episodeId

string

Returns

Promise<null | Episode>

Implementation of

EpisodicMemory.get


getByContext()

getByContext(contextId, limit): Promise<Episode[]>

Defined in: packages/core/src/memory/episodic-memory.ts:151

Get all episodes for a context

Parameters

contextId

string

limit

number = 20

Returns

Promise<Episode[]>

Implementation of

EpisodicMemory.getByContext


shouldEndEpisode()

shouldEndEpisode(ref, contextId, contextState, agent): Promise<boolean>

Defined in: packages/core/src/memory/episodic-memory.ts:293

Check if the current episode should be ended

Parameters

ref

AnyRef

contextId

string

contextState

ContextState

agent

AnyAgent

Returns

Promise<boolean>


shouldStartEpisode()

shouldStartEpisode(ref, contextId, contextState, agent): Promise<boolean>

Defined in: packages/core/src/memory/episodic-memory.ts:267

Check if a new episode should be started

Parameters

ref

AnyRef

contextId

string

contextState

ContextState

agent

AnyAgent

Returns

Promise<boolean>


store()

store(episode): Promise<string>

Defined in: packages/core/src/memory/episodic-memory.ts:73

Store an episode

Parameters

episode

Episode

Returns

Promise<string>

Implementation of

EpisodicMemory.store