Skip to content

Nabin68/SYNAPSE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  SYNAPSE

A Modular AI Assistant with Tools, Memory, and Real-Time Streaming

Python LangGraph Streamlit License

Built with LangGraph, LangChain, and Cohere

Features โ€ข Architecture โ€ข Installation โ€ข Usage โ€ข Roadmap


๐Ÿ“– Overview

SYNAPSE is a graph-based AI assistant that combines the power of LangGraph orchestration, tool-aware reasoning, and conversational memory into a sleek Streamlit interface. Built for developers who want to create intelligent, context-aware chatbots with minimal friction.

Why SYNAPSE?

  • ๐ŸŽฏ Modular Design โ€” Easy to extend with new tools and capabilities
  • ๐Ÿ”„ Graph-Based Reasoning โ€” Sophisticated agent orchestration using LangGraph
  • ๐Ÿ’พ Conversational Memory โ€” Maintains context across multi-turn conversations
  • โšก Real-Time Streaming โ€” Token-by-token response generation
  • ๐Ÿ› ๏ธ Tool Integration โ€” Web search, stock prices, and custom tools
  • ๐ŸŽจ Clean UI โ€” Professional Streamlit interface with session management

โœจ Features

๐Ÿค– AI Core

  • Graph-based agent orchestration with LangGraph
  • Tool-enabled LLM (ChatCohere)
  • Conditional tool execution & routing
  • In-memory conversational state management

๐ŸŽจ User Experience

  • Streamlit-based chat interface
  • Multi-threaded conversation switching
  • Session state management
  • Token-level streaming responses

๐Ÿ› ๏ธ Tools & Integrations

  • Web search (DuckDuckGo)
  • Stock price lookup
  • Structured data retrieval
  • Extensible tool architecture

๐Ÿ’พ Memory & State

  • LangGraph checkpoint system
  • Cross-session memory persistence
  • Thread-based conversation management
  • Context-aware responses

๐Ÿ—๏ธ Architecture

SYNAPSE follows a clean, modular architecture that separates concerns for maximum flexibility:

graph TB
    A[Streamlit Frontend] -->|User Input| B[LangGraph StateGraph]
    B -->|Process| C[ChatCohere LLM]
    C -->|Decision| D{Tool Needed?}
    D -->|Yes| E[ToolNode]
    D -->|No| F[Direct Response]
    E -->|Execute| G[Tool Functions]
    G -->|Results| C
    C -->|Stream| A
    B ---|Memory| H[(Checkpoint Store)]
    
    style A fill:#ff6b6b
    style B fill:#4ecdc4
    style C fill:#45b7d1
    style E fill:#96ceb4
    style H fill:#ffeaa7
Loading

Component Breakdown

Component File Responsibility
Backend Backend.py LangGraph state management, LLM orchestration, tool routing
Frontend Frontend.py Streamlit UI, conversation management, streaming display
Tools Tools.py Tool definitions, web search, stock prices, custom functions

๐Ÿ“‚ Project Structure

synapse-ai/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ Backend.py          # Core agent logic & graph orchestration
โ”œโ”€โ”€ ๐ŸŽจ Frontend.py         # Streamlit chat interface
โ”œโ”€โ”€ ๐Ÿ› ๏ธ Tools.py            # Tool definitions & implementations
โ”œโ”€โ”€ ๐Ÿ“‹ requirements.txt    # Python dependencies
โ”œโ”€โ”€ ๐Ÿ” .env.example        # Environment variable template
โ””โ”€โ”€ ๐Ÿ“– README.md           # Project documentation

โš™๏ธ Setup

Prerequisites

1๏ธโƒฃ Clone the Repository

git clone https://github.com/Nabin68/SYNAPSE.git
cd SYNAPSE

2๏ธโƒฃ Install Dependencies

pip install -r requirements.txt

Required packages:

langchain
langchain-cohere
langgraph
streamlit
python-dotenv
duckduckgo-search
yfinance

3๏ธโƒฃ Configure Environment

Create a .env file in the project root:

COHERE_API_KEY=your_cohere_api_key_here

๐Ÿ’ก Tip: Copy .env.example to .env and fill in your API key


๐Ÿš€ Usage

Running the Application

streamlit run Frontend.py

The application will open in your default browser at http://localhost:8501

Using the Chat Interface

  1. Start Chatting โ€” Type your message in the input box
  2. Watch Live Responses โ€” See the AI respond in real-time with streaming
  3. Switch Conversations โ€” Use the sidebar to create or switch between threads
  4. Tool Usage โ€” The AI automatically uses tools when needed (search, stock prices, etc.)

Example Interactions

User: What's the current price of Apple stock?
๐Ÿง  SYNAPSE: [Uses stock price tool]
      The current price of AAPL is $195.83...

User: Search for the latest AI news
๐Ÿง  SYNAPSE: [Uses web search tool]
      Here are the latest developments in AI...

๐Ÿ› ๏ธ Extending SYNAPSE

Adding New Tools

Create a new tool in Tools.py:

@tool
def my_custom_tool(query: str) -> str:
    """Description of what your tool does"""
    # Your implementation
    return result

Register it in the tool list:

tools = [web_search, stock_price, my_custom_tool]

Customizing the LLM

Modify Backend.py to use a different model or provider:

from langchain_openai import ChatOpenAI

model = ChatOpenAI(model="gpt-4", temperature=0.7)

๐Ÿ”ฎ Roadmap

Coming Soon

  • ๐Ÿ’พ SQLite-based persistent memory โ€” Long-term conversation storage
  • ๐Ÿ“š RAG integration โ€” Document Q&A and knowledge retrieval
  • ๐Ÿ”Œ MCP server support โ€” Model Context Protocol integration
  • ๐Ÿงฐ Extended tool library โ€” Weather, news, calculations, and more
  • ๐ŸŽจ Theme customization โ€” Dark mode and custom color schemes
  • ๐Ÿ“Š Analytics dashboard โ€” Conversation insights and usage stats
  • ๐ŸŒ Multi-language support โ€” Internationalization
  • ๐Ÿ”’ Authentication โ€” User accounts and access control

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guidelines
  • Add docstrings to new functions
  • Update README for new features
  • Test thoroughly before submitting

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ‘ค Author

Nabin


๐Ÿ™ Acknowledgments

  • LangChain โ€” For the incredible LLM framework
  • LangGraph โ€” For graph-based agent orchestration
  • Cohere โ€” For powerful language models
  • Streamlit โ€” For the beautiful UI framework

๐Ÿ“ž Support

If you encounter any issues or have questions:


โญ Star this repo if you find it helpful!

Made with โค๏ธ by Nabin

About

A modular AI assistant built with LangGraph and LangChain, featuring tools, memory, RAG, MCP integration, and real-time streaming UI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages