Skip to main content

OrbMem – A lightweight Cognitive Memory & Vector framework (Memory, Vectors, Graph, Safety).

Project description

OCDB — Cognitive Database Framework

Python License Status

OCDB (Orbynt Cognitive Database) is a lightweight, modular framework that combines 🧠 Memory, 🔍 Vector Search, 🕸 Graph Reasoning, and 🛡 Safety Scanning into a single Python package.

Designed for:

  • AI agents
  • Chatbots
  • Automation systems
  • Reasoning pipelines
  • Personal assistants
  • Any system that needs context, memory, search, and safety

This is the local developer version for PyPI. A fully hosted OCDB Cloud Platform will launch separately.


✨ Features

🧠 1. Memory Engine

Store and retrieve structured memory using a simple API.

from orbmem.core.ocdb import OCDB

ocdb = OCDB()
ocdb.memory_set("name", {"value": "Abhishek"})
print(ocdb.memory_get("name"))

🔍 2. Vector Search (FAISS local engine)

Semantic search powered by FAISS.

ocdb.vector_engine.add_text("hello world", {"id": "1"})
results = ocdb.vector_search("hello", k=3)

🕸 3. Graph Engine (NetworkX)

Build reasoning trees or node-based logic.

ocdb.graph_add("root", "Start")
ocdb.graph_add("child", "Next", parent="root")

🛡 4. Safety Engine

Simple text-safety scanning with MongoDB + time-series tracking.

events = ocdb.safety_scan("This is a sample text")

📦 Installation

pip install orbmem

📁 Project Structure

ocdb/
 ├── core/        # Config, auth, high-level OCDB interface
 ├── engines/     # Memory, vector, graph, safety engines
 ├── models/      # Memory & safety models
 ├── utils/       # Helpers, exceptions, logging
 └── db/          # Database connectors (Mongo, Neo4j, Postgres, Redis)

🚀 Quickstart Example

from orbmem.core.ocdb import OCDB

ocdb = OCDB()

# Memory
ocdb.memory_set("demo", {"text": "Hello OCDB"})
print(ocdb.memory_get("demo"))

# Vector
print(ocdb.vector_search("Abhishek"))

# Graph
ocdb.graph_add("n1", "Start")
ocdb.graph_add("n2", "Next", parent="n1")

# Safety
print(ocdb.safety_scan("Harmless text"))

Install dependencies:

pip install -r requirements.txt

From source:

git clone https://github.com/abhis-byte/orbynt-database-OrbMem.git
cd orbmem
pip install .
pip install -r requirements.txt

🚀 Basic Usage

from orbmem.core.ocdb import OCDB 
db = OCDB()

This initializes:

  • SQLite memory backend
  • NetworkX graph backend
  • SQLite safety backend (unless MONGO_URL is set)
  • FAISS fallback vector backend
  • Time-series safety tracking

🧠 Memory Engine (SQLite)

Store memory:

db.memory_set("user", {"name": "Abhishek"})

Retrieve memory:

print(db.memory_get("user"))

List keys:

print(db.memory_keys())

The memory engine is SQLite-based and works everywhere without configuration.


🔗 Graph Engine (NetworkX fallback)

Add graph nodes:

db.graph_add("root", "This is the root node") 
db.graph_add("child", "This is a child node", parent="root")

Get relationship path:

print(db.graph_path("root", "child"))

Dump full graph:

print(db.graph_dump())

The graph engine automatically uses NetworkX unless Neo4j configuration is provided.


🔍 Vector Engine (FAISS Fallback)

Version 1 uses a lightweight FAISS fallback for simple vector search examples.

Future versions (v2) will include:

  • Real embeddings (SentenceTransformers)
  • Qdrant/FAISS hybrid vector search
  • Cloud embedding cache
  • High-performance ANN indexing

Current example:

results = db.vector_search("hello world", k=3)
print(results)

🛡 Safety Engine (SQLite / Mongo)

The safety engine detects unsafe text patterns and records violations.

Scan text:

db.safety_scan("This text contains harmful intent.")
print(events)

Safety results contain:

  • text
  • tag
  • severity
  • correction
  • details
  • timestamp

Example output:

[
  {
    "text": "This text contains harmful intent.",
    "tag": "violence",
    "severity": 0.6,
    "correction": "Avoid harmful or violent expressions.",
    "details": {"pattern": ""},
    "timestamp": "2025-01-01T12:00:00Z"
  }
]

Backend selection:

  • If MONGO_URL is set → MongoSafetyBackend
  • Else → SQLiteSafetyBackend (portable)

📘 Example Code (Quick Demo)

from orbmem.core.ocdb import OCDB

db = OCDB()

# Memory
db.memory_set("user", {"name": "Abhishek"})
print(db.memory_get("user"))

# Vector search
print(db.vector_search("hello", k=3))

# Graph
db.graph_add("root", "Root node")
db.graph_add("child", "Child node", parent="root")
print(db.graph_path("root", "child"))
print(db.graph_dump())

# Safety engine
db.safety_scan("This may be violent content")

📌 Notes

  • Designed for local usage (v1)
  • Cloud support coming in v2
  • SQLite-only mode works in all environments:
    • Kaggle
    • Jupyter
    • Colab
    • VSCode
  • Windows/macOS/Linux
  • No environment variables required for v1

💙 ORBMEM Cloud (Coming in v2)

  • Real SentenceTransformer embeddings
  • Qdrant / FAISS hybrid vector engine
  • Neo4j cloud graph reasoning
  • MongoDB safety event storage
  • Postgres memory engine
  • API keys
  • Developer dashboard
  • Remote sync

Stay tuned.


📝 License

This project is released under the MIT License.
See the LICENSE file for full terms.


👨‍💻 Author

Tetala Lakshmi Abhishek Reddy
Creator of OCDB
📧Email: abhishek.orbynt@gmail.com


⭐ Support OCDB

If you like this project, please star the repository and share it!
The OCDB Cloud Dashboard + Hosted API is coming soon… 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orbmem-1.1.2.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orbmem-1.1.2-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file orbmem-1.1.2.tar.gz.

File metadata

  • Download URL: orbmem-1.1.2.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for orbmem-1.1.2.tar.gz
Algorithm Hash digest
SHA256 29cd70584b796aafef3308da740741b407e471e880b7f19649453af69e39947c
MD5 c39004e5c3e13602d03927e48124805a
BLAKE2b-256 67b46636258198506d783de32c614733843c91786f4ace340ffd777b5ecc919c

See more details on using hashes here.

File details

Details for the file orbmem-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: orbmem-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for orbmem-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2381886c761d7e9e354b8ce89433e020d0ae23ff3f588e034e923958a295c8e0
MD5 9e18a066ebb1b2e09e29ade6ad24e862
BLAKE2b-256 1445f405b41e69004386d97ab9f3568ce25e85c446ffc60ee444e63e7c6e75f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page