-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python SK: Simplify memory_store_base #684
Python SK: Simplify memory_store_base #684
Conversation
Co-authored-by: Lee Miller <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I think just need to remove the unnecessary TODOs
Looks like there are some lint failures to address. |
### Motivation and Context This PR significantly reduces the complexity of implementing a new memory store. Previously, memory stores needed to implement EmbeddingIndexBase, DataStoreBase, and MemoryStoreBase. Now, memory stores only need to implement MemoryStoreBase. This PR also brings MemoryStoreBase to parity with the .NET IMemoryStore interface. ### Description - Removed `data_entry.py`, `data_store_base.py`, `volatile_data_store.py`, and `embedding_index_base.py` - Added `with_embedding` parameter to all get/search methods. Passing the embedding between the application and storage is not optional and defaults to False - `MemoryStoreBase` (Python SK) == `IMemoryStore` (.NET SK) - Updated `volatile_memory_store` to implement `MemoryStoreBase` - Removed `ABC` from `MemoryStoreBase` - Added documentation to memory files Closes #670
@@ -12,6 +14,7 @@ class MemoryQueryResult: | |||
description: Optional[str] | |||
text: Optional[str] | |||
relevance: float | |||
embedding: Optional[ndarray] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
numpy.typing has an NDArray typehint that lets you typehint the dtype too: https://numpy.org/doc/stable/reference/typing.html
it's relatively recent so you may need to verify it works with your numpy version ranges in your dependencies
### Motivation and Context This PR significantly reduces the complexity of implementing a new memory store. Previously, memory stores needed to implement EmbeddingIndexBase, DataStoreBase, and MemoryStoreBase. Now, memory stores only need to implement MemoryStoreBase. This PR also brings MemoryStoreBase to parity with the .NET IMemoryStore interface. ### Description - Removed `data_entry.py`, `data_store_base.py`, `volatile_data_store.py`, and `embedding_index_base.py` - Added `with_embedding` parameter to all get/search methods. Passing the embedding between the application and storage is not optional and defaults to False - `MemoryStoreBase` (Python SK) == `IMemoryStore` (.NET SK) - Updated `volatile_memory_store` to implement `MemoryStoreBase` - Removed `ABC` from `MemoryStoreBase` - Added documentation to memory files Closes microsoft#670
Motivation and Context
This PR significantly reduces the complexity of implementing a new memory store. Previously, memory stores needed to implement EmbeddingIndexBase, DataStoreBase, and MemoryStoreBase. Now, memory stores only need to implement MemoryStoreBase. This PR also brings MemoryStoreBase to parity with the .NET IMemoryStore interface.
Description
data_entry.py
,data_store_base.py
,volatile_data_store.py
, andembedding_index_base.py
with_embedding
parameter to all get/search methods. Passing the embedding between the application and storage is not optional and defaults to FalseMemoryStoreBase
(Python SK) ==IMemoryStore
(.NET SK)volatile_memory_store
to implementMemoryStoreBase
ABC
fromMemoryStoreBase
Closes #670
Contribution Checklist
dotnet format