Overview
The Update Retrieval Configuration endpoint allows you to modify the configuration of retrieval nodes within your flows. Retrieval nodes are critical components that perform similarity search and document retrieval operations, and updating them is essential for optimizing search quality, performance, and relevance in your RAG pipelines.- Method:
PATCH
- URL:
https://{flow_name}.flows.graphorlm.com/retrieval/{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 | Required | Description |
---|---|---|---|
flow_name | string | Yes | The name of the flow containing the retrieval node |
node_id | string | Yes | The unique identifier of the retrieval node to update |
Request Body
The request body should be a JSON object with the following structure:Field | Type | Required | Description |
---|---|---|---|
config | object | Yes | The new configuration for the retrieval node |
Config Object Structure
Field | Type | Required | Description |
---|---|---|---|
searchType | string | Yes | Type of search: “similarity”, “hybrid”, “keyword”, or “semantic” |
topK | integer | No | Maximum number of documents to retrieve (default: 10) |
scoreThreshold | float | No | Minimum similarity score threshold (0.0-1.0, default: 0.0) |
retrievalQuery | string | No | Custom query template for specialized retrieval patterns |
Example Request
Response Format
Success Response (200 OK)
Response Structure
Field | Type | Description |
---|---|---|
success | boolean | Whether the update was successful |
message | string | Descriptive message about the update result |
node_id | string | The ID of the updated retrieval node |
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": "Invalid scoreThreshold value. Must be between 0.0 and 1.0"} |
401 | Unauthorized - Invalid or missing API token | {"detail": "Invalid authentication credentials"} |
404 | Not Found - Flow or node not found | {"detail": "Retrieval node not found"} |
422 | Unprocessable Entity - Validation error | {"detail": "searchType is required"} |
500 | Internal Server Error - Server error | {"detail": "Failed to update retrieval node"} |
Error Response Format
Example Error Responses
Invalid Configuration
Missing Required Field
Node Not Found
Invalid Search Type
Configuration Guidelines
Search Type Selection
Similarity Search
- Best for: General purpose document retrieval
- Characteristics: Vector-based similarity matching
- Recommended threshold: 0.7-0.9
- Typical Top K: 10-20
Hybrid Search
- Best for: Combining semantic and keyword matching
- Characteristics: Balanced precision and recall
- Recommended threshold: 0.6-0.8
- Typical Top K: 15-25
Keyword Search
- Best for: Fast exact term matching
- Characteristics: Traditional keyword-based search
- Recommended threshold: 0.5-0.7
- Typical Top K: 10-15
Semantic Search
- Best for: Conceptual and contextual matching
- Characteristics: Deep understanding of query intent
- Recommended threshold: 0.7-0.9
- Typical Top K: 8-15
Parameter Optimization
Top K Guidelines
- Low volume (1-5): High precision, narrow results
- Medium volume (10-20): Balanced approach for most use cases
- High volume (25+): High recall, comprehensive results
Score Threshold Guidelines
- Low threshold (0.5-0.6): More results, lower precision
- Medium threshold (0.7-0.8): Balanced quality and quantity
- High threshold (0.9+): Fewer but highly relevant results
Custom Query Templates
UseretrievalQuery
for domain-specific optimization:
"Search for {query} in user manuals"
"Find FAQ entries related to: {query}"
"Locate product information about {query}"
"Technical support content for: {query}"
Update Behavior
Immediate Effects
- Configuration changes are applied instantly
- Node status changes to
updated: false
indicating reprocessing needed - Previous results remain available until reprocessing
Reprocessing Requirements
After configuration updates, you should:- Re-run the flow to apply new retrieval settings
- Monitor performance to validate configuration changes
- Adjust parameters based on result quality
Best Practices for Updates
- Test changes incrementally rather than making large adjustments
- Monitor metrics before and after configuration changes
- Document configuration rationale for future reference
- Use A/B testing to compare retrieval strategies
Integration Examples
Automated Performance Tuning
Configuration Validation Service
Best Practices
Configuration Management
- Start Conservative: Begin with moderate settings and adjust based on performance
- Test Incrementally: Make small changes and measure impact
- Document Changes: Keep track of configuration rationale and performance impact
- Use Validation: Always validate configurations before applying
Performance Optimization
- Monitor Quality: Track retrieval relevance and adjust thresholds accordingly
- Balance Speed vs Accuracy: Choose search types based on response time requirements
- Consider Content Volume: Adjust Top K based on available content and user needs
- Regular Tuning: Periodically review and optimize configurations
Search Strategy Selection
- Similarity: General purpose, good balance of speed and accuracy
- Hybrid: Best overall performance for most applications
- Keyword: Fast responses for exact term matching
- Semantic: Best understanding of user intent and context
Threshold Management
- Quality vs Quantity: Higher thresholds for quality, lower for comprehensiveness
- Content Dependent: Adjust based on content quality and embedding model performance
- User Feedback: Use retrieval feedback to optimize threshold settings
Troubleshooting
Invalid Configuration Parameters
Invalid Configuration Parameters
Solution: Verify that:
searchType
is one of: similarity, hybrid, keyword, semantictopK
is a positive integer (recommended 5-50)scoreThreshold
is between 0.0 and 1.0retrievalQuery
contains proper query template syntax
Poor Retrieval Quality
Poor Retrieval Quality
Solution: If results are not relevant:
- Increase
scoreThreshold
to filter low-quality results - Experiment with different
searchType
values - Adjust
topK
to get more diverse results - Check chunking configuration for optimal chunk sizes
Slow Retrieval Performance
Slow Retrieval Performance
Solution: If retrieval is too slow:
- Reduce
topK
to retrieve fewer results - Use “keyword” searchType for faster responses
- Optimize
scoreThreshold
to reduce candidate set - Consider system scaling for large document volumes
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
Custom Query Not Working
Custom Query Not Working
Solution: For
retrievalQuery
issues:- Ensure query template includes
{query}
placeholder - Test query template with sample queries
- Verify template syntax is valid
- Check that custom queries are supported for the search type