Skip to content

🌐 Advanced LLM agent system combining Ollama and Gemma2:9B for enhanced reasoning. Features automated web search capabilities and intelligent response processing.

License

Notifications You must be signed in to change notification settings

KazKozDev/net-reflective-reasoning-llm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Description of the image

Net Reflective Reasoning LLM

Python Version License: MIT Ollama

A sophisticated web-enabled Language Model framework built on Ollama, featuring advanced reasoning capabilities and automated web search integration. The system utilizes the Gemma2:9B model as its core engine while incorporating multiple reasoning stages and web search capabilities for enhanced response accuracy.

🎯 Main Capabilities

  • Standalone Operation

    • Functions as a complete autonomous system
    • Independently retrieves and processes information from the web
    • Self-evaluates knowledge gaps and automatically initiates web searches
    • Performs multi-stage analysis and verification of gathered information
  • LLM Agent Integration

    • Can serve as a specialized web search tool for LLM agent systems
    • Perfect for integration into multi-agent architectures
    • Acts as an information retrieval and processing agent
    • Enhances other agents' capabilities with real-time web data

🎬 Demo Preview

Net Reflective Reasoning demo

This demo demonstrates the system processing a user query 'bitcoin exchange rate', automatically transforming it to 'bitcoin price USD' for web search. The system then performs net scraping to gather relevant data and applies reflective reasoning methods to analyze the information before delivering comprehensive results to the user.

🌟 Key Features

  • Enhanced Reasoning Process

    • Multi-stage thought process evaluation
    • Confidence scoring for each reasoning step
    • Detailed analysis and critique phases
    • Comprehensive answer synthesis
  • Integrated Web Search

    • Automatic knowledge evaluation
    • Multi-iteration search strategy
    • Smart query generation
    • Source credibility assessment
    • Content parsing and analysis
  • Conversation Management

    • Dynamic context management
    • Customizable system prompts
    • Conversation history tracking
    • Reasoning chain visualization

πŸš€ Technical Features

  • Asynchronous processing using asyncio and aiohttp
  • Caching system for search results and parsed content
  • Multiple website parsing strategies (static/dynamic)
  • Structured thought process using enum-based stages
  • Comprehensive error handling and recovery
  • Modular architecture for easy extension

πŸ’» Requirements

  • Python 3.7+
  • Ollama with Gemma2:9B model
  • Required Python packages:
    • aiohttp
    • requests
    • beautifulsoup4
    • duckduckgo_search
    • scrapy

πŸ› οΈ Installation

  1. Clone the repository:
git clone https://github.com/kazkozdev/net-reflective-reasoning-llm.git
cd net-reflective-reasoning-llm
  1. Install dependencies:
pip install -r requirements.txt
  1. Ensure Ollama is installed and the Gemma2:9B model is available:
# Install Ollama from https://ollama.ai
ollama pull gemma2:9b

πŸš€ Usage

Standalone Mode

Run the main script:

python src/main.py

Integration Mode

Import and use as a web search agent in your multi-agent system:

from src.net_reflective_llm import advancedgptlike

# Initialize as web search agent
search_agent = advancedgptlike(model_name="gemma2:9b")

# Use in async context
async def example():
    response, reasoning = await search_agent.model.process_query("your query here")
    return response, reasoning

Available Commands:

  • clear - Reset conversation history
  • explain - View detailed reasoning chain for last response
  • system <prompt> - Update system prompt
  • quit or exit - Exit the program

πŸ—οΈ Architecture

The system consists of several key components:

  1. EnhancedLLM: Core class managing LLM interactions and reasoning process
  2. WebSearchManager: Handles web searches and content parsing
  3. Conversation: Manages conversation history and context
  4. ReasoningChain: Tracks and structures the reasoning process

Reasoning Process Stages:

  • Initial Thoughts
  • Search Required
  • Analysis
  • Critique
  • Refinement
  • Final Answer

🀝 Contributing

Contributions are welcome! Please read our Contributing Guidelines for details on how to submit pull requests, report issues, and contribute to the project.

πŸ’¬ Questions & Support

πŸ“ License

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

✨ Acknowledgments

  • Built on the Ollama framework
  • Uses the Gemma2:9B model
  • Inspired by advanced reasoning techniques in AI systems

About

🌐 Advanced LLM agent system combining Ollama and Gemma2:9B for enhanced reasoning. Features automated web search capabilities and intelligent response processing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages