Overview
The Update Smart RAG Configuration endpoint allows you to modify the settings of smart RAG nodes within a flow. Smart RAG nodes are comprehensive RAG components that automatically handle document processing and retrieval, with the main configurable parameter being the number of top results to return during query execution.- Method:
PATCH - URL:
https://{flow_name}.flows.graphorlm.com/smart-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 |
Path Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
flow_name | string | Name of the flow containing the smart RAG node | Yes |
node_id | string | Unique identifier of the smart RAG node to update | Yes |
Request Body
The request body must contain a configuration object with smart RAG settings:Configuration Parameters
| Parameter | Type | Description | Default | Required |
|---|---|---|---|---|
topK | integer | Number of top results to retrieve during query processing. Set to null for unlimited results | 5 | No |
Example Request
Response Format
Success Response (200 OK)
Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the update operation was successful |
message | string | Human-readable message describing the result |
node_id | string | The ID of the updated smart RAG node |
Configuration Strategies
Precision-Focused Strategy
- Top K: 3-5 results
- Best for: High-precision applications where quality is critical
- Characteristics: Returns fewer, highly relevant results
- Use cases: Critical decision support, expert systems, factual Q&A
Balanced Strategy
- Top K: 8-12 results
- Best for: General-purpose applications balancing quality and coverage
- Characteristics: Good mix of precision and recall
- Use cases: Customer support, knowledge management, general Q&A
Comprehensive Strategy
- Top K: 15-25 results
- Best for: Research applications requiring thorough coverage
- Characteristics: Maximum coverage with acceptable processing overhead
- Use cases: Research assistance, discovery applications, content exploration
Unlimited Strategy
- Top K:
null(unlimited) - Best for: Complete analysis, no result limits
- Characteristics: Process all retrieved documents
- Trade-offs: Higher resource usage and processing time
- Use cases: Research projects, complete document analysis
Code Examples
JavaScript/Node.js
Advanced JavaScript Example
Python
cURL
PHP
Error Responses
Common Error Codes
| Status Code | Description | Example Response |
|---|---|---|
| 400 | Bad Request - Invalid configuration parameters | {"detail": "topK must be a positive integer or null"} |
| 401 | Unauthorized - Invalid or missing API token | {"detail": "Invalid authentication credentials"} |
| 404 | Not Found - Flow or node not found | {"detail": "Smart rag node with id 'invalid-id' not found in flow 'my-flow'"} |
| 422 | Unprocessable Entity - Validation error | {"detail": "Invalid configuration format"} |
| 500 | Internal Server Error - Server error | {"detail": "Failed to update smart rag node"} |
Error Response Format
Example Error Responses
Invalid Top K Value
Node Not Found
Invalid API Token
Best Practices
Configuration Guidelines
- Start Conservative: Begin with lower Top K values (5-10) and adjust based on quality needs
- Test Systematically: Use A/B testing to compare different Top K values
- Monitor Impact: Track both quality improvements and resource implications
- Document Rationale: Keep records of configuration decisions and their outcomes
Performance Considerations
Resource Optimization
- Lower Top K: Reduces processing resource usage
- Higher Top K: Increases quality but requires more resources
- Unlimited: Maximum resource usage for complete analysis
Processing Time
- Lower Top K: Faster processing, reduced latency
- Higher Top K: Longer processing time, higher latency
- Unlimited: Slowest processing, highest latency
Performance Optimization
- Balance Quality vs Resources: Higher Top K improves quality but increases resource usage
- Consider Use Case: Critical applications need fewer, higher-quality results
- Monitor Processing Time: Higher Top K values increase processing time
- Plan for Scale: Consider resource implications when scaling to high query volumes
Quality Assurance
- Measure Impact: Compare result quality before and after reranking
- User Feedback: Collect feedback on result relevance and usefulness
- Regular Review: Periodically assess if Top K settings remain optimal
- Context Matters: Adjust Top K based on query complexity and domain
Resource Management
- Set Limits: Establish resource usage limits for processing
- Monitor Usage: Track resource consumption across different Top K settings
- Optimize Strategically: Use higher Top K only where quality impact justifies resource usage
- Consider Alternatives: Evaluate if similar quality can be achieved with lower Top K
Troubleshooting
Invalid Configuration Parameters
Invalid Configuration Parameters
Solution: Verify that:
topKis a positive integer or null- Value is reasonable for your use case (typically 1-50)
- Configuration follows the correct JSON structure
Poor Quality After Update
Poor Quality After Update
Solution: If retrieval quality decreased:
- Increase
topKto include more diverse results - Check if input quality is sufficient
- Monitor retrieval scores and positions
- Consider if the change was too aggressive
Slow Processing After Update
Slow Processing After Update
Solution: If processing is too slow:
- Reduce
topKto process fewer documents - Check system performance metrics
- Monitor system resource usage
- Consider if unlimited processing is necessary
Configuration Not Taking Effect
Configuration Not Taking Effect
Solution: After updating configuration:
- Re-run the flow to apply new settings
- Check that the node status shows
updated: false - Verify configuration was saved correctly
- Allow time for reprocessing to complete
High Resource Usage
High Resource Usage
Solution: For resource optimization:
- Review
topKsettings across all smart RAG nodes - Monitor processing resource metrics
- Consider reducing
topKfor less critical applications - Implement resource usage alerts and limits

