Repository navigation
Add REST API endpoints for Rotary Position Embeddings (RoPE) - #934
Merged
Merged
Conversation
7 tasks
Co-authored-by: makr-code <[email protected]>
Co-authored-by: makr-code <[email protected]>
Co-authored-by: makr-code <[email protected]>
Co-authored-by: makr-code <[email protected]>
Co-authored-by: makr-code <[email protected]>
Co-authored-by: makr-code <[email protected]>
Copilot
AI
changed the title
[WIP] Add REST API endpoints for RoPE configuration and operations
Add REST API endpoints for Rotary Position Embeddings (RoPE)
Jan 27, 2026
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.
Description
Exposes RoPE functionality via 8 RESTful HTTP endpoints at
/api/v1/vector-index/{index_name}/rope/*, enabling remote configuration and operations on position-aware vector embeddings.Type of Change
Related Issues
Issue linking handled automatically by system.
Changes Made
Core Implementation
/config/add,/add-relational,/batch-add,/search/statshttp_server.cpp: 8 enum entries, route mappings, dispatch casesCMakeLists.txtAPI Surface
Testing
Documentation
Implementation Notes
/configvalidates RoPE enabled state (no disable method in VectorIndexManager)Testing
Test Environment
Test Results
Test Commands
Checklist
Code Quality
Documentation
Branch Strategy Compliance
developfor features,mainfor releases/hotfixes)feature/,bugfix/,hotfix/,release/)mainordevelopPerformance Impact
Performance Notes:
Breaking Changes
None. Pure additive feature.
Security Considerations
Authentication integrates with existing middleware. Fine-grained RBAC deferred (matches VectorApiHandler pattern).
Additional Notes
Known Limitations:
/config: Documents behavior (config persists until restart) - VectorIndexManager lacks disable methodAll limitations documented in code comments, OpenAPI spec, and user docs.
Files Changed:
rope_api_handler.{h,cpp},test_http_rope.cpp,rope_api.yaml, docs (4 files)http_server.{h,cpp},CMakeLists.txtScreenshots/Logs
N/A - REST API implementation
For Maintainers:
Review Checklist
Merge Strategy
Original prompt
This section details on the original issue you should resolve
<issue_title>[RoPE] REST API Endpoints for Configuration and Operations</issue_title>
<issue_description>## Feature Description
Expose Rotary Position Embeddings (RoPE) functionality through RESTful HTTP endpoints. This enables remote configuration, management, and usage of RoPE features via standard HTTP requests.
Problem Statement
Current RoPE integration is C++-only and requires direct library usage. Users cannot:
Proposed Solution
API Endpoints
1. Configuration Management
POST /api/v1/vector-index/{index_name}/rope/config
{ "hidden_dim": 768, "num_rotation_pairs": 384, "base_theta": 10000.0, "normalize_after": false }Response:
{ "status": "success", "message": "RoPE configuration enabled for index 'documents'", "config": { "hidden_dim": 768, "num_rotation_pairs": 384, "base_theta": 10000.0, "normalize_after": false, "theta_cache_size": 384 } }GET /api/v1/vector-index/{index_name}/rope/config
Returns current RoPE configuration or 404 if not enabled.
DELETE /api/v1/vector-index/{index_name}/rope/config
Disables RoPE for the specified index.
2. Entity Operations
POST /api/v1/vector-index/{index_name}/rope/add
{ "entity": { "id": "doc123", "embedding": [0.1, 0.2, ..., 0.768], "content": "Document text", "metadata": {} }, "vector_field": "embedding", "position": 42 }POST /api/v1/vector-index/{index_name}/rope/add-relational
{ "entity": { "id": "entity_A", "embedding": [0.1, 0.2, ..., 0.768], "name": "Entity A" }, "vector_field": "embedding", "relation_type": "parent_of" }3. Search Operations
POST /api/v1/vector-index/{index_name}/rope/search
{ "query": [0.1, 0.2, ..., 0.768], "k": 10, "position": 100, "filters": { "field": "category", "value": "medical" } }Response:
{ "status": "success", "results": [ { "id": "doc123", "distance": 0.123, "position": 42, "metadata": {} } ], "query_time_ms": 5.2, "rotation_enabled": true }4. Batch Operations
POST /api/v1/vector-index/{index_name}/rope/batch-add
{ "entities": [ { "entity": { "id": "doc1", "embedding": [...] }, "position": 0 }, { "entity": { "id": "doc2", "embedding": [...] }, "position": 1 } ], "vector_field": "embedding" }5. Statistics & Monitoring
GET /api/v1/vector-index/{index_name}/rope/stats
{ "enabled": true, "config": { "hidden_dim": 768, ... }, "statistics": { "total_rotated_entities": 10000, "avg_rotation_time_us": 1.5, "relational_rotations": 500, "adapters_loaded": ["medical", "legal"] } }Technical Implementation
REST Handler (
src/rest/rope_handler.cpp)OpenAPI Specification