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.1.tar.gz (21.0 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.1-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: orbmem-1.1.1.tar.gz
  • Upload date:
  • Size: 21.0 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.1.tar.gz
Algorithm Hash digest
SHA256 28b862aba8372c87a48b88a0846edf310650ca744a3dbdf55e2276d747ffaf49
MD5 a23e13a25307ad0434c03494227614ae
BLAKE2b-256 3a00298c370ef7839c8f02e8a0ac3ede92ee523635c8fe1cae0c46cd7669b00a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: orbmem-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae07f580a8a6ddaa32126ddffd2e863efa036345d1330efc5ccbe57b66eb38b2
MD5 8e9f3d0063c8ab59f1f18ef8ec141947
BLAKE2b-256 2672ff039f8a8b7883540df9b652021dca758027cae1b0795ad0414c56022096

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