--- title: AI Research Assistant sdk: gradio sdk_version: 4.38.1 app_file: app.py license: apache-2.0 --- # 🧠 AI Research Assistant An advanced AI-powered research assistant that combines web search capabilities with contextual awareness to provide comprehensive answers to complex questions. ## 🌟 Key Features - **Real-time Streaming Output**: See responses as they're generated for immediate feedback - **Contextual Awareness**: Incorporates current weather and space weather data - **Web Search Integration**: Powered by Tavily API for up-to-date information - **Smart Caching**: Redis-based caching for faster repeated queries - **Intelligent Server Monitoring**: Clear guidance during model warm-up periods - **Accurate Citations**: Real sources extracted from search results - **Asynchronous Processing**: Parallel execution for optimal performance - **Responsive Interface**: Modern Gradio UI with example queries ## 🏗️ Architecture The application follows a modular architecture for maintainability and scalability: myspace134v/ ├── app.py # Main Gradio interface ├── modules/ │ ├── analyzer.py # LLM interaction with streaming │ ├── citation.py # Citation generation and formatting │ ├── context_enhancer.py # Weather and space context (async) │ ├── formatter.py # Response formatting │ ├── input_handler.py # Input validation │ ├── retriever.py # Web search with Tavily │ ├── server_cache.py # Redis caching │ ├── server_monitor.py # Server health monitoring │ ├── status_logger.py # Event logging │ ├── visualizer.py # Output rendering │ └── visualize_uptime.py # System uptime monitoring ├── tests/ # Unit tests ├── requirements.txt # Dependencies └── version.json # Version tracking ## 🤖 AI Model Information This assistant uses the **DavidAU/OpenAi-GPT-oss-20b-abliterated-uncensored-NEO-Imatrix-gguf** model hosted on Hugging Face Endpoints. This is a powerful open-source language model with: - **20 Billion Parameters**: Capable of handling complex reasoning tasks - **Extended Context Window**: Supports up to 8192 tokens per response - **Uncensored Capabilities**: Provides comprehensive answers without artificial limitations - **Specialized Training**: Optimized for research and analytical tasks ## 🔧 API Integrations | Service | Purpose | Usage | |---------|---------|-------| | **Tavily** | Web Search | Real-time information retrieval | | **Hugging Face Inference** | LLM Processing | Natural language understanding | | **Redis** | Caching | Performance optimization | | **NASA** | Space Data | Astronomical context | | **OpenWeatherMap** | Weather Data | Environmental context | ## ⚡ Enhanced Features ### 🔁 Streaming Output Responses stream in real-time, allowing users to start reading before the complete answer is generated. This creates a more natural conversational experience. ### 📚 Dynamic Citations All information is properly sourced with clickable links to original content, ensuring transparency and enabling further exploration. ### ⚡ Asynchronous Operations Weather data, space weather, and web searches run in parallel, significantly reducing response times. ### 🧠 Contextual Intelligence Each query is enhanced with: - Current weather conditions - Recent space events - Accurate timestamps ### 🛡️ Server State Management Intelligent monitoring detects when the model server is initializing and provides clear user guidance with estimated wait times. ## 🚀 Getting Started ### Prerequisites - Python 3.8+ - Hugging Face account and token - API keys for Tavily, NASA, and OpenWeatherMap - Redis instance for caching ### Setup Instructions 1. Clone the repository 2. Set up required environment variables: ```bash export HF_TOKEN="your_hugging_face_token" export TAVILY_API_KEY="your_tavily_api_key" export REDIS_HOST="your_redis_host" export REDIS_PORT="your_redis_port" export REDIS_USERNAME="your_redis_username" export REDIS_PASSWORD="your_redis_password" export NASA_API_KEY="your_nasa_api_key" export OPENWEATHER_API_KEY="your_openweather_api_key" Install dependencies: pip install -r requirements.txt Run the application: python app.py 📊 System Monitoring The assistant includes built-in monitoring capabilities: Server Health Tracking: Detects and reports server state changes Performance Metrics: Logs request processing times Uptime Monitoring: Tracks system availability Failure Recovery: Automatic handling of transient errors 📋 Example Queries Try these sample questions to see the assistant in action: "What are the latest developments in fusion energy research?" "How does climate change impact global food security?" "Explain the significance of recent Mars rover discoveries" "What are the economic implications of AI advancement?" 📄 License This project is licensed under the Apache 2.0 License - see the LICENSE file for details. 🤝 Contributing Contributions are welcome! Please feel free to submit a Pull Request. 📞 Support For issues, questions, or feedback, please open an issue on the repository.