Download autogpt/memory/base.py from MathysL/AutoGPT4: direct link, hf CLI and curl.
- Browser
- Download file 935 Bytes
-
https://huggingface.co/spaces/MathysL/AutoGPT4/resolve/main/autogpt/memory/base.py
- Command line
-
hf download hf://spaces/MathysL/AutoGPT4/autogpt/memory/base.py
-
curl -L -o base.py https://huggingface.co/spaces/MathysL/AutoGPT4/resolve/main/autogpt/memory/base.py
935 Bytes
| """Base class for memory providers.""" | |
| import abc | |
| import openai | |
| from autogpt.config import AbstractSingleton, Config | |
| cfg = Config() | |
| def get_ada_embedding(text): | |
| text = text.replace("\n", " ") | |
| if cfg.use_azure: | |
| return openai.Embedding.create( | |
| input=[text], | |
| engine=cfg.get_azure_deployment_id_for_model("text-embedding-ada-002"), | |
| )["data"][0]["embedding"] | |
| else: | |
| return openai.Embedding.create(input=[text], model="text-embedding-ada-002")[ | |
| "data" | |
| ][0]["embedding"] | |
| class MemoryProviderSingleton(AbstractSingleton): | |
| def add(self, data): | |
| pass | |
| def get(self, data): | |
| pass | |
| def clear(self): | |
| pass | |
| def get_relevant(self, data, num_relevant=5): | |
| pass | |
| def get_stats(self): | |
| pass | |