A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://ts.llamaindex.ai/docs/api/classes/Memory below:

Build LLM-powered document agents and workflows

Defined in: packages/core/src/memory/memory.ts:49

TAdapters

TAdapters extends Record<string, MessageAdapter<unknown, TMessageOptions>> = Record<string, never>

TMessageOptions

TMessageOptions extends object = object

Constructor

new Memory<TAdapters, TMessageOptions>(messages, options): Memory<TAdapters, TMessageOptions>

Defined in: packages/core/src/memory/memory.ts:90

Parameters messages

MemoryMessage<TMessageOptions>[] = []

options

MemoryOptions<TMessageOptions> = {}

Returns

Memory<TAdapters, TMessageOptions>

add()

add(message): Promise<void>

Defined in: packages/core/src/memory/memory.ts:123

Add a message to the memory

Parameters message

unknown

The message to add to the memory

Returns

Promise<void>

get()

get<K>(options): Promise<K extends keyof TAdapters | keyof BuiltinAdapters<TMessageOptions> ? ReturnType<TAdapters & BuiltinAdapters<TMessageOptions>[K<K>]["fromMemory"]>[] : never>

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

Get the messages of specific type from the memory

Type Parameters K

K extends string | number | symbol = "llamaindex"

Parameters options

The options for the get method

type?

K

transientMessages?

ChatMessage<TMessageOptions>[]

Returns

Promise<K extends keyof TAdapters | keyof BuiltinAdapters<TMessageOptions> ? ReturnType<TAdapters & BuiltinAdapters<TMessageOptions>[K<K>]["fromMemory"]>[] : never>

The messages of specific type

getLLM()

getLLM(llm, transientMessages?): Promise<ChatMessage[]>

Defined in: packages/core/src/memory/memory.ts:200

Get the messages from the memory, optionally including transient messages. only return messages that are within context window of the LLM

Parameters llm

To fit the result messages to the context window of the LLM (fallback to default llm if not provided). If llm is not specified in both the constructor and the method, the default token limit will be used.

undefined | LLM<object, object>

transientMessages?

ChatMessage<TMessageOptions>[]

Optional transient messages to include.

Returns

Promise<ChatMessage[]>

The messages from the memory, optionally including transient messages.

manageMemoryBlocks()

manageMemoryBlocks(): Promise<void>

Defined in: packages/core/src/memory/memory.ts:338

Manage the memory blocks This method processes new messages into memory blocks when short-term memory exceeds its token limit. It uses a cursor system to track which messages have already been processed into long-term memory.

Returns

Promise<void>

clear()

clear(): Promise<void>

Defined in: packages/core/src/memory/memory.ts:409

Clear all the messages in the memory

Returns

Promise<void>

snapshot()

snapshot(): string

Defined in: packages/core/src/memory/memory.ts:420

Creates a snapshot of the current memory state Note: Memory blocks are not included in snapshots as they may contain non-serializable content. Memory blocks should be recreated when loading from snapshot.

Returns

string

A JSON-serializable object containing the memory state


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4