Closed
Conversation
Integrate frontend to backend
Collaborator
|
Closing, changes already in master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
API Comparison: Unified Server vs Old Servers
Overview
The new
unified_server.pycombines the best of bothmain.pyandrag_server.py, removing duplicates and adding Colinear Query Expansion.🔄 Endpoint Mapping
OLD: main.py → NEW: unified_server.py
GET /files/searchGET /search/keywordGET /files/{file_id}GET /files/{file_id}POST /files/registerPOST /files/registeractionfieldDELETE /files/{file_id}DELETE /files/{file_id}OLD: rag_server.py → NEW: unified_server.py
POST /uploadPOST /files/uploadPOST /searchPOST /search/semanticGET /filesGET /filesGET /files/{id}GET /files/{file_id}GET /statsGET /statsGET /GET /🆕 What's New: Colinear Query Expansion
How It Works
When you search with
POST /search/semantic:{ "query": "machine learning tutorial", "top_k": 5, "use_query_expansion": true, "expansion_count": 3 }Behind the scenes:
Each variant is:
Response Format
[ { "file_id": 42, "filename": "ml_guide.pdf", "path": "/home/user/Documents/ml_guide.pdf", "device": "laptop", "device_ip": "192.168.1.10", "device_user": "john", "size": 1048576, "file_type": ".pdf", "similarity_score": 0.89, // 0-1, higher = better match "last_modified_time": "2024-10-15T10:30:00", "matched_via": "expanded_query_2" // Shows which query variant matched } ]📊 Key Improvements
1. Unified API
2. Query Expansion
3. Better Search Options
GET /search/keyword): Fast filename matchingPOST /search/semantic): Content-aware with query expansion4. Enhanced File Operations
POST /files/registerPOST /files/uploadaction: "created"or"updated"5. Improved Responses
similarity_score(0-1)matched_viafield🚀 Migration Guide
For Existing Clients
Keyword Search (no changes needed):
Semantic Search (with new features):
File Upload (new path):
🎯 Performance Comparison
💡 Usage Examples
Example 1: Register File Metadata (No Upload)
Example 2: Upload File with Embedding
Example 3: Semantic Search with Query Expansion
Example 4: Keyword Search (Fast)
curl -X GET 'http://localhost:8000/search/keyword?query=*.xlsx'🔧 Configuration
All settings in
unified_server.py:✅ Next Steps
Stop old servers (if running):
# Stop main.py or rag_server.pyStart unified server:
cd /data/qyu/projects/dubhacks1/backend python unified_server.pyTest query expansion:
Check stats: