AI-powered text processing using embeddings and large language models.

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.
Example:

LLM Generation

Generate dynamic content using large language models. Prometheux provides two approaches:
  1. llm:generate - approach for simple use cases
  2. #LLM - approach for large-scale processing

Approach 1: llm:generate

Traditional UDF for straightforward use cases with automatic LLM pool support:
Options Format (second argument, optional, comma-separated):
  • "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
Flexible Second Argument: Can be omitted or used as:
  1. Omittedllm:generate(prompt, dataArg1, ...) - Defaults to string output, all models
  2. Options stringllm:generate(prompt, "output_type=int,selected_models=...") - Parse as configuration
  3. Data argumentllm:generate(prompt, dataArg1, dataArg2) - If not an options string, treated as first data arg
Supported Output Types: 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.
Examples: Simplest usage (defaults to string output):
Using options:
Using positional arguments with options format:
Multiple output types:
Model selection for load balancing and quality control:
When to use 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
If 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:
The #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:
Supported models: 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
If 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 to string):
Output:
  • 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:
Output:
  • reviews_0: ProductID (101)
  • reviews_1: Review text
  • reviews_2: Sentiment (string) from prompt_1
  • reviews_3: Rating (integer) from prompt_2
  • reviews_4: Keywords (string) from prompt_3

Example 3: Custom Column Ordering with projected_columns

Reorder output columns to match your head predicate:
Output column order:
  • 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 compact prompts format when all outputs share the same type:
Output:
  • All three LLM results are strings
  • output_type=string applies 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:
Why use selected_models:
  • Filter out slower or experimental models (e.g., exclude gpt-5-nano preview 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:
When to use 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

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:
Note: For healthcare and other critical applications, use selected_models=gpt-4o to ensure the highest quality and reliability.