Core Conversational AI Engine for the Nexus Ecosystem
Project description
NEXUS-AIDOS-BRAIN ๐ง
The Core Conversational AI Engine for the Nexus Ecosystem
NEXUS-AIDOS-BRAIN is a production-ready Python library that provides the foundational AI capabilities for building intelligent conversational systems. Built on LangChain and LangGraph, it offers a modular, extensible architecture for implementing RAG (Retrieval-Augmented Generation), memory management, semantic caching, and multi-agent workflows.
๐ Features
Core Capabilities
- ๐ Conversational RAG Pipeline: Context-aware document retrieval with conversation memory
- ๐ง Multi-tier Memory Management: Redis-backed conversation history with buffer and summary modes
- โก Semantic Caching: Intelligent response caching with embedding-based similarity matching
- ๐ฏ Custom Retrievers: Flexible retrieval architecture supporting multiple vector stores (Qdrant)
- ๐ค Agent Orchestration: LangGraph-based multi-agent workflows with state management
- ๐ Workspace Isolation: Multi-tenant support with workspace-based data segregation
Advanced Features
- Query Enhancement: Prompt-style context injection without additional LLM calls
- Source Tracking: Complete provenance tracking for retrieved documents
- Configurable Chunking: Token-based text chunking with overlap for optimal retrieval
- OpenRouter Integration: Support for 200+ LLM models via OpenRouter
- Production Ready: Comprehensive logging, error handling, and monitoring
๐๏ธ Architecture
nexus_aidos/
โโโ core/ # Core conversational engine
โ โโโ engine.py # Main conversational engine
โ โโโ pipeline.py # RAG pipeline orchestration
โโโ memory/ # Memory management
โ โโโ redis_memory.py # Redis-backed conversation memory
โ โโโ buffer_memory.py # Buffer and summary memory
โโโ retrieval/ # Document retrieval
โ โโโ retrievers.py # Custom retriever implementations
โ โโโ embeddings.py # Embedding generation
โโโ cache/ # Caching services
โ โโโ semantic_cache.py # Semantic similarity caching
โ โโโ exact_cache.py # Exact match caching
โโโ chains/ # LangChain components
โ โโโ rag_chain.py # Conversational RAG chain
โ โโโ query_transform.py # Query transformation
โโโ config/ # Configuration management
โ โโโ settings.py # Configuration classes
โโโ utils/ # Utilities
โโโ logging.py # Logging utilities
โโโ workspace.py # Workspace utilities
๐ Quick Start
Installation
pip install -e ./NEXUS-AIDOS-BRAIN
Basic Usage
from nexus_aidos import NexusEngine
from nexus_aidos.config import EngineConfig
# Initialize the engine
config = EngineConfig(
redis_url="redis://localhost:6379",
qdrant_url="https://your-qdrant-instance.com",
qdrant_api_key="your-api-key",
openrouter_api_key="your-openrouter-key"
)
engine = NexusEngine(config)
# Simple conversation
response = engine.chat(
message="What is the revenue growth?",
workspace_id="workspace_123"
)
print(response["answer"])
RAG-Enhanced Conversation
from nexus_aidos import RAGPipeline
# Initialize RAG pipeline
rag = RAGPipeline(
workspace_id="workspace_123",
model="gpt-4o",
top_k=5,
threshold=0.5
)
# Ask questions with context
response = rag.ask(
"What were the key findings?",
return_metadata=True
)
print(f"Answer: {response['answer']}")
print(f"Sources: {len(response['source_documents'])} documents")
๐ Documentation
๐ข Integration with NEXUSBRAIN
This library is designed to integrate seamlessly with the NEXUSBRAIN project:
# In your Flask app (server/app.py)
from nexus_aidos import NexusEngine
from nexus_aidos.config import EngineConfig
# Initialize engine
config = EngineConfig.from_env()
nexus_engine = NexusEngine(config)
@app.route('/api/chat', methods=['POST'])
def chat():
workspace_id = request.user.get('workspace_id')
message = request.json.get('message')
response = nexus_engine.chat(
message=message,
workspace_id=workspace_id,
use_rag=True,
use_cache=True
)
return jsonify(response)
Made with โค๏ธ by the Nexus AI Hub Team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nexus_aidos_brain-0.1.0.tar.gz.
File metadata
- Download URL: nexus_aidos_brain-0.1.0.tar.gz
- Upload date:
- Size: 22.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39def7e74a07b9d3ef139bf62f956104cfb28a741c5c5949af31a511c53ee99a
|
|
| MD5 |
9e9e7169b17b4ce243e7903b8bd56ec9
|
|
| BLAKE2b-256 |
35dd5865a3a0d7cd353a8a1a6a60e49d58884e26c70e4c1afac0e793610e3201
|
File details
Details for the file nexus_aidos_brain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nexus_aidos_brain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab4217322366141a08708d87213d95eb1eaf0b16e7d2504317073196996674fd
|
|
| MD5 |
5b09c60db3d459f5d6a86f59f3a7e14a
|
|
| BLAKE2b-256 |
7e00849a68bd0bcd847a7d4d62953b35df136ab8bdca59f4812bdbe07ade44ae
|