The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
feat: add count to get document count in vector db (#164)
cachho41a1dbab0ec8
diff --git a/README.md b/README.mdindex 4636f841a..d9d7c7da3 100644--- a/README.md+++ b/README.md@@ -332,6 +332,14 @@ Resets the database and deletes all embeddings. Irreversible. Requires reinitialapp.reset()```+### Count+Counts the number of embeddings (chunks) in the database.++```+print(app.count())+# returns: 481+```+# How does it work?Creating a chat bot over any dataset needs the following steps to happendiff --git a/embedchain/embedchain.py b/embedchain/embedchain.pyindex 2835171e0..d3cf0ae4d 100644--- a/embedchain/embedchain.py+++ b/embedchain/embedchain.py@@ -298,6 +298,14 @@ class EmbedChain:prompt = self.generate_prompt(input_query, context)return prompt+ def count(self):+ """+ Count the number of embeddings.++ :return: The number of embeddings.+ """+ return self.collection.count()+def reset(self):"""