File size: 3,935 Bytes
7c012de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# 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! πŸŽ‰