This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
Addition of Simple Memory System Based on ChromaDB #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a simple memory system, MemStore, built on top of ChromaDB. ChromaDB was chosen as the underlying database due to its SQLite-based design, which makes it an excellent choice for development use.
The MemStore class provides a straightforward interface for interacting with the underlying ChromaDB database. It includes methods for adding, querying, retrieving, updating, and deleting documents in the memory store.
Here's a brief overview of the key methods:
add(task_id: str, document: str, metadatas: dict) -> None: This method adds a document to the memory store. The document is associated with a task ID and can include additional metadata.
query(task_id: str, query: str, filters: dict = None, document_search: dict = None) -> dict: This method allows querying the memory store. It supports filtering and document-specific search.
get(task_id: str, doc_ids: list = None, filters: dict = None) -> dict: This method retrieves documents from the memory store based on their IDs or optional filters.
update(task_id: str, doc_ids: list, documents: list, metadatas: list): This method updates documents in the memory store. It requires the IDs of the documents to be updated, the updated documents, and the updated metadata.
delete(task_id: str, doc_id: str): This method deletes a document from the memory store based on its ID.
The MemStore class is designed to be easy to use and flexible, making it a valuable tool for managing in-memory data during development. The use of ChromaDB as the underlying database ensures robustness and reliability.
Please review the changes and provide your feedback.