Stage Category: APPLY (Transforms documents)Transformation: N documents → M documents (custom logic)
When to Use
When NOT to Use
Parameters
Configuration Examples
Code Structure
Your code must define atransform function:
Available in Scope
Input Document Structure
Output Options
Performance
Common Pipeline Patterns
Custom Scoring Pipeline
Data Normalization Pipeline
Advanced Filtering
Security
Allowed Packages
Built-in packages available:json,re,math,datetime,collectionsitertools,functools,operator
language.
Error Handling
Debugging
Enable debug mode to see execution details:Call code_execution from the API
Add the stage to a retriever’sstages array as {"stage_name": "<your label>", "stage_type": "apply", "config": {"stage_id": "code_execution", "parameters": {...}}}. The parameters are the ones on this page.
- Create Retriever (
POST /v1/retrievers) saves a retriever that runs the stage. - Execute Ad-hoc Retriever (
POST /v1/retrievers/execute) runs stages without saving a retriever. - List Available Retriever Stages (
GET /v1/retrievers/stages) returns every stage’s parameter schema.
Related
- JSON Transform - Template-based transforms
- LLM Enrich - AI-powered enrichment
- Attribute Filter - Standard filtering

