From 9a2a9f743976ba4b99cfcc451bee645ce347049a Mon Sep 17 00:00:00 2001 From: sagarishere <5121817+sagarishere@users.noreply.github.com> Date: Fri, 7 Jul 2023 08:39:36 +0300 Subject: [PATCH] Add docstring to function `get_memory()` in `autogpt.memory.vector` (#1296) * Document function get_memory in ./scripts/memory/init.py * Update get_memory docstring to current format --------- Co-authored-by: Reinier van der Leer --- autogpt/memory/vector/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/autogpt/memory/vector/__init__.py b/autogpt/memory/vector/__init__.py index 72abbb00..414a2800 100644 --- a/autogpt/memory/vector/__init__.py +++ b/autogpt/memory/vector/__init__.py @@ -40,6 +40,21 @@ supported_memory = ["json_file", "no_memory"] def get_memory(config: Config) -> VectorMemory: + """Returns a memory object corresponding to the memory backend specified in the config. + + The type of memory object returned depends on the value of the `memory_backend` + attribute in the configuration. E.g. if `memory_backend` is set to "pinecone", a + `PineconeMemory` object is returned. If it is set to "redis", a `RedisMemory` + object is returned. + By default, a `JSONFileMemory` object is returned. + + Params: + config: A configuration object that contains information about the memory backend + to be used and other relevant parameters. + + Returns: + VectorMemory: an instance of a memory object based on the configuration provided. + """ memory = None match config.memory_backend: