EpisodicMemoryImpl
@daydreamsai/core / EpisodicMemoryImpl
Class: EpisodicMemoryImpl
Defined in: packages/core/src/memory/episodic-memory.ts:84
Episodic Memory - manages conversational episodes and experiences
Implements
Constructors
Constructor
new EpisodicMemoryImpl(
memory
,options
):EpisodicMemoryImpl
Defined in: packages/core/src/memory/episodic-memory.ts:88
Parameters
memory
options
EpisodicMemoryOptions
= {}
Returns
EpisodicMemoryImpl
Methods
addToCurrentEpisode()
addToCurrentEpisode(
contextId
,ref
):void
Defined in: packages/core/src/memory/episodic-memory.ts:479
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:412
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:334
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:391
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:489
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:281
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:307
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:312
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:453
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:427
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:93
Store an episode
Parameters
episode
Returns
Promise
<string
>