Class MemoryManager

Constructors

Properties

client: IZepClient

Methods

  • Adds a new memory to a specific session.

    Parameters

    • sessionID: string

      The ID of the session to add the memory to.

    • memory: Memory

      The memory object to add to the session.

    Returns Promise<string>

    A promise that resolves to the added memory.

    Throws

    If the request fails.

  • Adds a session.

    Parameters

    • session: Session

      The session to add.

    Returns Promise<Session>

    The added session.

    Throws

    Will throw an error if the session is not provided.

    Throws

    Will throw an error if the session.session_id is not provided.

    Throws

    Will throw an error if the fetch request fails.

  • Deletes the memory of a specific session.

    Parameters

    • sessionID: string

      The ID of the session for which the memory should be deleted.

    Returns Promise<string>

    • Promise message indicating the memory has been deleted.

    Throws

    • If the request fails.

    Throws

    • If the session is not found.
  • Retrieves memory for a specific session.

    Parameters

    • sessionID: string

      The ID of the session to retrieve memory for.

    • Optional type: MemoryType

      Optional. The type of memory to retrieve.

    • Optional lastn: number

      Optional. The number of most recent memories to retrieve.

    Returns Promise<null | Memory>

    • A promise that returns a Memory object.

    Throws

    • If the request fails.

    Throws

    • If the session is not found.
  • Retrieves a session with the specified ID.

    Parameters

    • sessionId: string

      The ID of the session to retrieve.

    Returns Promise<Session>

    A promise that resolves to the Session object.

    Throws

    Will throw an error if the sessionId is not provided.

    Throws

    Will throw an error if the fetch request fails.

    Throws

    Will throw an error if the session is not found.

  • Asynchronously retrieve a list of paginated sessions.

    Parameters

    • Optional limit: number

      Limit the number of results returned.

    • Optional cursor: number

      Cursor for pagination.

    Returns Promise<Session[]>

    A list of all sessions paginated.

    Throws

    If the API response format is unexpected.

  • Retrieve all sessions, handling pagination automatically. Yields a generator of lists of sessions.

    Parameters

    • Optional chunkSize: number = 100

      The number of sessions to retrieve at a time.

    Returns AsyncGenerator<Session[], void, unknown>

    The next chunk of sessions from the server.

    Throws

    If the API response format is unexpected.

    Throws

    If the connection to the server fails.

  • Searches memory of a specific session based on search payload provided.

    Parameters

    • sessionID: string

      ID of the session for which the memory should be searched.

    • searchPayload: MemorySearchPayload

      The search payload containing the search criteria.

    • Optional limit: number

      Optional limit on the number of search results returned.

    Returns Promise<MemorySearchResult[]>

    • Promise that resolves to array of search results.

    Throws

    • If the request fails.
  • Parameters

    • sessionId: string
    • lastN: number = 3

    Returns Promise<string>

  • Updates the specified session.

    Parameters

    • session: Session

      The session data to update.

    Returns Promise<Session>

    The updated session.

    Throws

    Will throw an error if the session is not provided.

    Throws

    Will throw an error if the session.session_id is not provided.

    Throws

    Will throw an error if the fetch request fails.

    Throws

    Will throw an error if the session is not found.

Generated using TypeDoc