EpisodicMemoryImpl
@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
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
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
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
agent
Returns
Promise
<Episode
>
Implementation of
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
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
agent
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
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
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
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
contextId
string
contextState
agent
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
contextId
string
contextState
agent
Returns
Promise
<boolean
>
store()
store(
episode
):Promise
<string
>
Defined in: packages/core/src/memory/episodic-memory.ts:73
Store an episode
Parameters
episode
Returns
Promise
<string
>