# Nebius Configuration Guide ## 🚀 Quick Setup Your app is now configured to use **Nebius AI** instead of OpenAI! Here's how to get it running: ### 1. Set Environment Variables Create a `.env` file in the root directory: ```bash # Required: Nebius AI API Key NEBIUS_API_KEY=your_nebius_api_key_here # Optional: Modal for advanced processing MODAL_TOKEN_ID=your_modal_token_id MODAL_TOKEN_SECRET=your_modal_token_secret # Optional: GitHub for repository search GITHUB_TOKEN=your_github_token_here ``` ### 2. Supported Models The app now uses these Nebius models: #### 🧠 **Default Model: DeepSeek-R1-0528** - **Model ID**: `deepseek-ai/DeepSeek-R1-0528` - **Use Cases**: Chat completions, document analysis, query enhancement - **Features**: Advanced reasoning, code understanding, research synthesis #### 🌟 **Alternative Models Available**: - **Qwen**: `Qwen/Qwen3-235B-A22B` - **Llama Nemotron**: `nvidia/Llama-3_1-Nemotron-Ultra-253B-v1` ### 3. Start the Application ```bash npm run dev ``` The app will start at `http://localhost:5000` ## 🔧 What Changed ### ✅ **Removed OpenAI Dependencies** - ❌ `OPENAI_API_KEY` no longer required - ❌ `openai` package dependency removed from routes - ✅ All AI operations now use Nebius ### ✅ **Enhanced AI Capabilities** - **Document Analysis**: Summary, classification, key points, quality scoring - **Query Enhancement**: Smart query improvement with intent analysis - **Research Synthesis**: Multi-document analysis and insights - **Embeddings**: Vector generation for semantic search - **Chat Completions**: Conversational AI for explanations ### ✅ **API Endpoints Updated** - `/api/explain` - Uses DeepSeek for document explanations - `/api/ai-search` - Enhanced AI-powered search - `/api/analyze-document` - Document analysis with DeepSeek - `/api/enhance-query` - Query improvement - `/api/embeddings` - Vector embeddings via Nebius - `/api/health` - Health check includes Nebius status ## 🎯 Features Now Available ### **AI-Enhanced Search Interface** - Smart query enhancement with purple sparkles ✨ - Real-time AI suggestions and improvements - Dual search modes: Traditional + AI-enhanced ### **Document Analysis Tools** - **Summary**: Concise document summaries - **Classification**: Automatic document categorization - **Key Points**: Extract important findings - **Quality Score**: Assess document credibility ### **Advanced AI Features** - **Research Synthesis**: Analyze multiple documents together - **Embedding Generation**: Create vector representations - **Relevance Scoring**: AI-powered result ranking ## 🔍 Model Selection ### **When to Use Each Model**: #### **DeepSeek-R1-0528** (Default) - General-purpose tasks - Code analysis and programming - Research and academic content - Reasoning-heavy tasks #### **Qwen3-235B-A22B** - Multilingual content - Large-scale document processing - Complex reasoning tasks #### **Llama-3_1-Nemotron-Ultra-253B-v1** - Creative writing and content generation - Instruction following - Advanced conversational AI ## 🚨 Troubleshooting ### **API Key Issues** ```bash # Check if your Nebius API key is working curl -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ https://api.studio.nebius.ai/v1/models ``` ### **Health Check** Visit `http://localhost:5000/api/health` to verify all services are working. ### **Common Issues** 1. **Missing API Key**: Ensure `NEBIUS_API_KEY` is set in your `.env` file 2. **Rate Limits**: Nebius may have rate limits - check your usage 3. **Model Names**: Use exact model IDs as shown above ## 📊 Cost Benefits - **Lower Costs**: Nebius often provides better pricing than OpenAI - **Better Performance**: DeepSeek models are optimized for reasoning tasks - **More Control**: Choose specific models for different use cases Your KnowledgeBridge app is now powered by cutting-edge Nebius AI models! 🎉