Base class for all memories.
| 56 | |
| 57 | |
| 58 | class BaseMemory: |
| 59 | """Base class for all memories.""" |
| 60 | |
| 61 | @abc.abstractmethod |
| 62 | def add( |
| 63 | self, |
| 64 | *args: Any, |
| 65 | **kwargs: Any, |
| 66 | ) -> None: |
| 67 | """Add data to memory. |
| 68 | |
| 69 | Args: |
| 70 | **kwargs: Other keyword arguments that subclasses might use. |
| 71 | """ |
| 72 | pass |
| 73 | |
| 74 | @abc.abstractmethod |
| 75 | def similarity_search( |
| 76 | self, |
| 77 | *args: Any, |
| 78 | **kwargs: Any, |
| 79 | ) -> List[Union[str, Image]]: |
| 80 | """Retrieve the keys from the vectorstores. |
| 81 | |
| 82 | Args: |
| 83 | data: the query data. |
| 84 | top_k: the number of results to return. |
| 85 | **kwargs: Other keyword arguments that subclasses might use. |
| 86 | |
| 87 | Returns: |
| 88 | the corresponding values from the memory. |
| 89 | """ |
| 90 | |
| 91 | @abc.abstractmethod |
| 92 | def query( |
| 93 | self, |
| 94 | *args: Any, |
| 95 | **kwargs: Any, |
| 96 | ) -> List[Union[str, Image]]: |
| 97 | """Retrieve the keys from the vectorstores. |
| 98 | |
| 99 | Args: |
| 100 | data: the query data. |
| 101 | top_k: the number of results to return. |
| 102 | **kwargs: Other keyword arguments that subclasses might use. |
| 103 | |
| 104 | Returns: |
| 105 | the corresponding values from the memory. |
| 106 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected