Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,13 @@ async def __aexit__(
await self.app.__aexit__(exc_type, exc_val, exc_tb)
self._app_started = False

async def get_memory(self) -> list[Msg]:
async def get_memory(
self,
mark: str | None = None,
exclude_mark: str | None = None,
prepend_summary: bool = True,
**kwargs: Any,
) -> list[Msg]:
"""Retrieve and manage working memory with automatic summarization.

This method performs the core working-memory management pipeline:
Expand Down
18 changes: 17 additions & 1 deletion src/agentscope/rag/_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""The document data structure used in RAG as the data chunk and
retrieval result."""
from dataclasses import dataclass, field
from typing import Any

import shortuuid
from dashscope.api_entities.dashscope_response import DictMixin
Expand All @@ -14,7 +15,7 @@
from ..types import Embedding


@dataclass
@dataclass(init=False)
class DocMetadata(DictMixin):
"""The metadata of the document."""

Expand All @@ -30,6 +31,21 @@ class DocMetadata(DictMixin):
total_chunks: int
"""The total number of chunks."""

def __init__(
self,
content: TextBlock | ImageBlock | VideoBlock,
doc_id: str,
chunk_id: int,
total_chunks: int,
**kwargs: Any,
) -> None:
self.content = content
self.doc_id = doc_id
self.chunk_id = chunk_id
self.total_chunks = total_chunks
for key, value in kwargs.items():
setattr(self, key, value)


@dataclass
class Document:
Expand Down