Overview
The Update RAPTOR RAG Configuration endpoint allows you to modify the hierarchical tree settings of a RAPTOR RAG node within a flow. This includes configuring the number of results to retrieve from the tree structure and the maximum depth levels for hierarchical abstraction.- Method: 
PATCH - URL: 
https://{flow_name}.flows.graphorlm.com/raptor-rag/{node_id} - Authentication: Required (API Token)
 
Authentication
All requests must include a valid API token in the Authorization header:Learn how to generate API tokens in the API Tokens guide.
Request Format
Headers
| Header | Value | Required | 
|---|---|---|
Authorization | Bearer YOUR_API_TOKEN | Yes | 
Content-Type | application/json | Yes | 
URL Parameters
| Parameter | Type | Description | 
|---|---|---|
flow_name | string | The name of the flow containing the RAPTOR RAG node | 
node_id | string | The unique identifier of the RAPTOR RAG node to update | 
Request Body
Configuration Parameters
| Parameter | Type | Required | Description | 
|---|---|---|---|
topK | integer | null | No | Number of top results to retrieve from the RAPTOR tree hierarchy. Set to null for unlimited retrieval. Range: 1-100 or null | 
max_level | integer | No | Maximum number of levels in the RAPTOR tree hierarchy. Higher values create deeper abstractions. Range: 2-8, Default: 3 | 
Example Requests
Precision-Focused Configuration
Deep Hierarchy Configuration
Unlimited Retrieval Configuration
Response Format
Success Response (200 OK)
Response Fields
| Field | Type | Description | 
|---|---|---|
success | boolean | Whether the configuration update was successful | 
message | string | Descriptive message about the update operation | 
node_id | string | The ID of the updated RAPTOR RAG node | 
Configuration Strategies
1. Precision-Focused Strategy
Best for: High-accuracy requirements with focused hierarchical retrieval- Low Top K (10): Highly selective results from tree traversal
 - Standard Depth (3): Balanced hierarchy without over-abstraction
 - Tree Efficiency: Fast traversal with targeted precision
 - Memory Usage: Minimal resource consumption
 - Use Cases: Legal documents, medical research, technical specifications
 
2. Balanced Hierarchy Strategy
Best for: General-purpose applications with good coverage- Moderate Top K (25): Good balance between precision and coverage
 - Extended Depth (4): Rich hierarchical abstractions
 - Tree Quality: Comprehensive multi-level structure
 - Processing Time: Moderate tree construction and traversal time
 - Use Cases: Knowledge bases, research papers, documentation systems
 
3. Comprehensive Coverage Strategy
Best for: Exploratory analysis and broad topic coverage- High Top K (50): Extensive hierarchical result coverage
 - Deep Hierarchy (5): Maximum abstraction levels
 - Tree Complexity: Rich multi-level clustering and summarization
 - Resource Intensive: Higher memory and processing requirements
 - Use Cases: Literature reviews, comprehensive analysis, discovery research
 
4. Unlimited Exploration Strategy
Best for: Maximum retrieval capability and deep analysis- Unlimited Top K (null): No restrictions on hierarchical retrieval
 - Maximum Depth (6): Deepest possible abstraction hierarchy
 - Tree Performance: Comprehensive but resource-intensive processing
 - Complete Coverage: All relevant hierarchical content retrieved
 - Use Cases: Academic research, exhaustive analysis, comprehensive surveys
 
Code Examples
JavaScript/Node.js
Python
cURL
PHP
Error Responses
Common Error Codes
| Status Code | Description | Example Response | 
|---|---|---|
| 400 | Bad Request - Invalid configuration parameters | {"detail": "topK must be between 1 and 100 or null"} | 
| 401 | Unauthorized - Invalid or missing API token | {"detail": "Invalid authentication credentials"} | 
| 404 | Not Found - RAPTOR RAG node not found | {"detail": "RAPTOR RAG node not found"} | 
| 422 | Validation Error - Configuration validation failed | {"detail": "max_level must be between 2 and 8"} | 
| 500 | Internal Server Error - Server error | {"detail": "Failed to update RAPTOR RAG configuration"} | 
Error Response Format
Example Error Responses
Invalid Top K Value
Invalid Max Level
Node Not Found
Tree Configuration Conflict
Configuration Impact Analysis
Top K Impact on Hierarchical Retrieval
| Top K Range | Retrieval Scope | Tree Traversal | Memory Usage | Use Case | 
|---|---|---|---|---|
| 5-15 | Focused | Fast | Low | High-precision tasks | 
| 16-30 | Balanced | Moderate | Medium | General applications | 
| 31-50 | Comprehensive | Slower | High | Broad analysis | 
| 51-100 | Extensive | Slow | Very High | Exhaustive research | 
| null | Unlimited | Variable | Maximum | Complete coverage | 
Max Level Impact on Tree Structure
| Max Level | Tree Depth | Abstraction Quality | Processing Time | Complexity | 
|---|---|---|---|---|
| 2 | Shallow | Basic | Fast | Simple | 
| 3 | Standard | Good | Moderate | Balanced | 
| 4 | Deep | Rich | Longer | Complex | 
| 5-6 | Very Deep | Excellent | Slow | Advanced | 
| 7-8 | Maximum | Superior | Very Slow | Expert | 
Resource Usage Estimation
Best Practices
Tree Configuration Optimization
- Document-Aware Configuration: Adjust max_level based on document collection size and complexity
 - Performance Balance: Choose Top K values that balance retrieval comprehensiveness with processing speed
 - Memory Planning: Consider memory requirements for deep hierarchical trees in resource-constrained environments
 - Iterative Optimization: Start with moderate settings and adjust based on tree construction performance
 
Hierarchical Strategy Selection
- Precision-Focused: Use for legal documents, medical research, or technical specifications requiring high accuracy
 - Balanced Hierarchy: Optimal for most general-purpose applications with diverse document types
 - Comprehensive Coverage: Best for literature reviews, research surveys, or exploratory analysis
 - Unlimited Exploration: Reserve for exhaustive research requiring complete hierarchical coverage
 
Performance Monitoring
- Tree Construction Time: Monitor clustering and summarization phases for optimization opportunities
 - Memory Usage: Track memory consumption during tree building for large document collections
 - Retrieval Efficiency: Analyze hierarchical traversal performance with different Top K values
 - Quality Assessment: Evaluate abstraction quality across different tree levels
 
Configuration Validation
- Parameter Bounds: Ensure Top K (1-100 or null) and max_level (2-8) are within optimal ranges
 - Resource Constraints: Validate configuration against available system resources
 - Document Compatibility: Verify that tree depth is appropriate for document collection characteristics
 - Performance Testing: Test configurations with representative document samples before production use
 
Troubleshooting
Invalid Configuration Parameters
Invalid Configuration Parameters
Solution: Verify that:
- Top K is between 1-100 or set to 
nullfor unlimited retrieval - max_level is between 2-8 for optimal tree performance
 - Configuration parameters are correctly formatted in the request body
 - JSON payload structure matches the expected schema
 
Tree Construction Performance Issues
Tree Construction Performance Issues
Solution: If tree building is slow or failing:
- Reduce max_level for large document collections (>2000 documents)
 - Monitor system memory during tree construction
 - Check document preprocessing quality and chunk size
 - Consider breaking large collections into smaller batches
 
Memory Usage Problems
Memory Usage Problems
Solution: For high memory consumption:
- Reduce max_level to decrease tree complexity
 - Process documents in smaller batches
 - Monitor clustering algorithm memory usage
 - Consider using lower-complexity document preprocessing
 
Slow Hierarchical Retrieval
Slow Hierarchical Retrieval
Solution: If retrieval is taking too long:
- Reduce Top K to focus on most relevant results
 - Optimize tree traversal by reducing max_level
 - Check for inefficient tree structure from poor clustering
 - Consider parallel processing for multiple queries
 
Poor Tree Structure Quality
Poor Tree Structure Quality
Solution: If hierarchical abstractions are poor:
- Increase max_level for richer abstractions (if resources allow)
 - Verify document diversity is sufficient for meaningful clustering
 - Check summarization quality at each tree level
 - Adjust chunking parameters in upstream processing
 
Node Not Found Error
Node Not Found Error
Solution: If the RAPTOR RAG node cannot be found:
- Verify the node_id is correct using the list endpoint
 - Ensure the flow_name matches exactly
 - Check that the node exists in the specified flow
 - Confirm API token has access to the flow
 
Next Steps
After updating RAPTOR RAG node configuration, you might want to:List RAPTOR RAG Nodes
View updated RAPTOR RAG node configurations and tree metrics
Run Flow
Execute your flow with the updated RAPTOR RAG hierarchical settings
Monitor Tree Performance
Learn about RAPTOR RAG tree optimization and performance monitoring
Flow Overview
Explore other flow management and configuration endpoints

