Vector Embeddings
Generate and compare vector embeddings for semantic similarity:The cosine similarity operators live in the
similarity: namespace alongside the other similarity operators. Embedding generation (embeddings:vectorize) remains in the embeddings: namespace.LLM Generation
Generate dynamic content using large language models. Prometheux provides two approaches:llm:generate- approach for simple use cases#LLM- approach for large-scale processing
Approach 1: llm:generate
Traditional UDF for straightforward use cases with automatic LLM pool support:
"output_type=string"- Specify output type (default:string)"selected_models=gpt-4o"- Filter to single model type"selected_models=gpt-4o;gpt-4o-mini;gpt-4.1"- Filter to multiple model types (semicolon-separated)"output_type=int,selected_models=gpt-4o;gpt-4o-mini"- Combine output type with multiple models
- Omitted →
llm:generate(prompt, dataArg1, ...)- Defaults to string output, all models - Options string →
llm:generate(prompt, "output_type=int,selected_models=...")- Parse as configuration - Data argument →
llm:generate(prompt, dataArg1, dataArg2)- If not an options string, treated as first data arg
string, int, double, boolean, list<string>, list<int>, list<double>, list<boolean>
Prompt Templating: Use ${Variable} for direct variable interpolation or ${arg_1}, ${arg_2}, etc. for positional arguments.
Model Selection: Use semicolon-separated list in selected_models to filter which models to use:
- Single model:
"selected_models=gpt-4o" - Multiple models:
"selected_models=gpt-4o;gpt-4o-mini;gpt-4.1;gpt-4.1-nano" - If not specified, all configured pools are used automatically for load balancing.
selected_models with llm:generate:
- Quality control: Route critical queries to premium models (
gpt-5-nano) - Performance optimization: Use faster models (
gpt-4o-mini,gpt-4o,gpt-4.1,gpt-4.1-nano,gpt-4.1-mini) for simple tasks - Cost optimization: Balance cost and quality across model tiers
- Load balancing: Distribute work across specific model types
- Model testing: Test specific models without changing system configuration
selected_models is not specified, all configured LLM pools are used automatically for optimal load distribution.
Approach 2: #LLM
For large-scale processing across LLM endpoints:
#LLM function processes all rows from the input relation in parallel, distributing work across multiple LLM endpoints for optimal performance.
Parameters
All parameters are specified as a comma-separated string:
Supported Output Types:
string, int, integer, long, double, float, number, boolean, bool, list<string>, list<int>, list<double>, set<string>
Prompt Templating: Use {arg_1}, {arg_2}, etc. to reference input columns (1-based indexing).
Model Selection with selected_models
By default, #LLM uses all configured LLM endpoints. Use selected_models to filter which model types to use:
gpt-4o, gpt-4o-mini, gpt-5-nano, gpt-5-mini, gpt-4.1-nano, gpt-4.1-mini, and others configured in your environment.
Use cases:
- Performance optimization: Route simple queries to faster models (
gpt-4o-mini) - Quality control: Use only high-quality models (
gpt-4o) for critical analysis - Cost optimization: Balance speed and cost across model tiers
- Model testing: Test specific models without changing configuration
selected_models is not specified, all configured endpoints are used for maximum parallelization.
Why num_partitions is Optional
Prometheux automatically handles optimal partitioning based on your data source, especially if it is already partitioned.
Only specify num_partitions if you need to override the automatic behavior for specific performance requirements.
#LLM Function Examples
Example 1: Single Prompt with Default Output
Process customer feedback with automatic output type (defaults tostring):
- Input columns:
feedback_0(FeedbackID),feedback_1(Text) - Output columns:
feedback_0,feedback_1,feedback_2(Sentiment result)
Example 2: Multiple Prompts with Different Output Types
Generate multiple insights with type-specific outputs:reviews_0: ProductID (101)reviews_1: Review textreviews_2: Sentiment (string) fromprompt_1reviews_3: Rating (integer) fromprompt_2reviews_4: Keywords (string) fromprompt_3
Example 3: Custom Column Ordering with projected_columns
Reorder output columns to match your head predicate:
enriched_0: Summary (llm_1)enriched_1: Original text (arg_1)enriched_2: Word count (llm_2)
Example 4: Compact Format with Single Output Type
Use compactprompts format when all outputs share the same type:
- All three LLM results are strings
output_type=stringapplies to all prompts (prompt_1,prompt_2,prompt_3)
Example 5: Model Selection for Optimal Performance
Choose specific models based on your quality, speed, and cost requirements:selected_models:
- Filter out slower or experimental models (e.g., exclude
gpt-5-nanopreview models) - Route high-priority queries to premium models (
gpt-4o) - Route high-volume queries to cost-effective models (
gpt-4o-mini) - Test specific models without changing system configuration
Example 6: Processing Large Datasets (Advanced)
For specific performance tuning on very large datasets, you can override automatic partitioning:num_partitions:
- Very large datasets where you need explicit control over parallelism
- Performance tuning and optimization scenarios
- Default automatic partitioning is optimal for most use cases
Prometheux automatically handles optimal partitioning based on your data source. Only specify
num_partitions if you need to override automatic behavior for specific performance requirements.Use Cases
Semantic Search
Combine embeddings with LLM for intelligent document retrieval:Content Classification
Classify large volumes of text in parallel with optimized model selection:Data Enrichment
Generate missing information for entire datasets with quality-focused model selection:Healthcare Decision Support
Multi-faceted analysis of clinical data using high-quality models for critical healthcare decisions:selected_models=gpt-4o to ensure the highest quality and reliability.
