7#include <unordered_map>
38 std::optional<MemoryNode>
get_node(std::uint64_t
id)
const;
46 const std::vector<float>& query_embedding,
47 std::size_t max_results = 5,
48 float min_similarity = 0.7f,
49 const std::string& cache_namespace = {})
const;
54 std::size_t
max_nodes()
const {
return max_nodes_; }
59 mutable std::mutex mu_;
60 std::unordered_map<std::uint64_t, MemoryNode> nodes_;
61 std::uint64_t next_id_ = 1;
62 std::size_t max_nodes_;
Definition memory_graph.hpp:33
std::optional< MemoryNode > get_node(std::uint64_t id) const
std::size_t estimated_bytes() const
Approximate resident bytes: content, embeddings, ids, and per-node overhead.
MemoryGraphStore(std::size_t max_nodes=8192)
std::uint64_t add_node(MemoryNode node)
std::vector< RetrievalResult > retrieve_similar(const std::vector< float > &query_embedding, std::size_t max_results=5, float min_similarity=0.7f, const std::string &cache_namespace={}) const
std::size_t max_nodes() const
Capacity in nodes passed at construction.
Definition memory_graph.hpp:54
Definition checkpoint.hpp:12
MemoryNodeType
Definition memory_graph.hpp:12
Definition memory_graph.hpp:40
MemoryNode node
Definition memory_graph.hpp:41
float similarity
Definition memory_graph.hpp:42
Definition memory_graph.hpp:18
MemoryNodeType type
Definition memory_graph.hpp:20
std::string session_id
Definition memory_graph.hpp:23
std::vector< float > embedding
Definition memory_graph.hpp:22
std::string content
Definition memory_graph.hpp:21
std::int64_t created_ns
Definition memory_graph.hpp:24