Neur0 (nyron-ai)
Neur0 is a graph-based AI memory system designed for long-term personalization. It uses Neo4j to build isolated user subgraphs, resolves memory conflicts using semantic analysis, ranks retrieved memories using recall scoring, and keeps short-term context utilizing MongoDB.
Features
- Graph-Based Memory: Build highly structured, isolated memory subgraphs for individual users.
- Semantic Conflict Resolution: Automatically detect when new facts contradict existing memories and mark old facts as conflicted. -Recall Scoring: Rank memories dynamically based on a combination of semantic similarity, recency, and reinforcement (access frequency). -Short-Term Context: Manage short-term context and resolve pronouns/references using MongoDB. -OpenAI Integration: Cleanly extract facts and embeddings using OpenAI models. -Built-in API Server: Instantly run a FastAPI server using the CLI to add, search, and manage memories via HTTP requests.
Prerequisites
- Python:
>=3.9 - Neo4j Database: A running instance (e.g. Neo4j Desktop, AuraDB, or Docker).
- MongoDB (Optional): Required if you want to enable the short-term memory store.
- OpenAI API Key: Required for fact extraction, query resolution, and embeddings.
Installation
You can install Neur0 from PyPI:
pip install nyron-ai
For local development and testing, clone the repository and run:
pip install -e .
Quickstart
1. Configure Environment Variables
Create a .env file in your project root with your database credentials and API keys:
OPENAI_API_KEY=your-openai-key
NEO4J_URI=bolt://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=password
# Optional: MongoDB for short-term memory
MONGO_URI=mongodb://localhost:27017
MONGO_DB=neur0
2. Python Code Usage
Here is how to initialize the memory client, save a memory, and query it:
import asyncio
from neuro import (
MemoryClient,
Neo4jGraphStore,
MongoStore,
OpenAIProvider,
OpenAIEmbeddingProvider,
)
async def main():
# 1. Initialize Stores
graph_store = Neo4jGraphStore(
uri="bolt://localhost:7687",
username="neo4j",
password="password",
)
graph_store.initialize()
# Optional MongoDB short-term store
mongo_store = MongoStore(uri="mongodb://localhost:27017", db_name="neur0")
await mongo_store.initialize()
# 2. Setup AI Providers
llm = OpenAIProvider(api_key="your-api-key", model="gpt-4o-mini")
embedder = OpenAIEmbeddingProvider(api_key="your-api-key", model="text-embedding-3-small")
# 3. Create Memory Client
memory = MemoryClient(
graph_store=graph_store,
llm=llm,
embedder=embedder,
short_term_store=mongo_store,
)
# 4. Save a Memory
user_id = "user_128r"
result = await memory.add(
user_id=user_id,
message="I studied computer science at Cambridge University.",
)
print("Saved facts:", result["saved_count"])
# 5. Search memories
search_results = await memory.search(
user_id=user_id,
query="Where did I go to college?",
)
for res in search_results:
fact = res["fact"]
print(f"Fact: {fact.subject} {fact.predicate} {fact.object}")
print(f"Recall Score: {res['recall_score']}")
# Clean up connections
graph_store.close()
mongo_store.close()
if __name__ == "__main__":
asyncio.run(main())
Running the API Server
Neur0 includes a built-in command line utility to start a FastAPI backend.
Simply run:
neuro-api
The API will start running at http://localhost:8000.
Available Endpoints
POST /add_memory: Add a new user message, extract facts, and handle conflicts.{ "user_id": "user_128r", "message": "I study computer science at Cambridge." }
POST /search_memory: Search and retrieve relevant memories.{ "user_id": "user_128r", "query": "Where do I study?", "limit": 5 }
DELETE /delete_subgraph/{user_id}: Delete all graph nodes and memories for a specific user.
License
MIT License.
Metadata
Release files for nyron-ai 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nyron_ai-0.1.3.tar.gz | 25.6 kB | Without provenance | Details for nyron_ai-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nyron_ai-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for nyron_ai-0.1.3-py3-none-any.whl |
Total release size: 48.7 kB
Release files / nyron_ai-0.1.3.tar.gz
| Download URL | nyron_ai-0.1.3.tar.gz |
|---|---|
| Size | 25.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0dc086234bbfa5eff73056058c60c509ababe2cfb2a5dbc8164561e75c0c4431
|
|
BLAKE2b-256 checksum How to use checksums |
87bf369a24b41ebbf1d6e6726f559a5884fab378b7df0171604ed9ef0cdef6da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / nyron_ai-0.1.3-py3-none-any.whl
| Download URL | nyron_ai-0.1.3-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3bf82f97f467979d9e2b2315838bdbe0adcebe2e074d0df8c507ba72e8589bc3
|
|
BLAKE2b-256 checksum How to use checksums |
b5e55daa38e7ca39bc2b11618ea1931e4e9013f37d91778c47791d5aaea8ca59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for nyron-ai 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.