Skip to main content
LLM Filter stage showing content-based filtering with language models
The LLM Filter stage uses language models to evaluate document content against specified criteria, filtering based on semantic understanding rather than metadata fields.
Stage Category: FILTER (Reduces document set)Transformation: N documents → M documents (where M ≤ N, based on LLM evaluation)

When to Use

When NOT to Use

Parameters

Documents are batched automatically based on how many reach the stage.

Available Models

jev-latest is Jev, an evaluation model from TypeSafe AI. It answers “does this document meet the criteria” as a probability instead of generating text. A document is kept when the probability is at least 0.5, and reason reports the probability. Jev reads text only, so media documents are judged on their text fields: descriptions, transcripts and metadata.

Configuration Examples

Writing Effective Criteria

Good Criteria Examples

Poor Criteria Examples

Be specific about what to include AND exclude. The LLM makes a binary keep/discard decision for each document.

Output Schema

Filter Output

Documents that pass the filter are returned unchanged:

With Reasoning

Documents are still returned unchanged. When include_reasoning is true, the stage metadata records each decision with the LLM’s reason:

Filtered Out (not in results)

Documents that don’t match criteria are removed from the result set.

Performance

LLM filtering is expensive and slow. Always apply attribute_filter or use search top_k limits to reduce the document set before LLM filtering.

Common Pipeline Patterns

Search + Metadata Filter + LLM Filter

Quality + Relevance Pipeline

Cost Optimization

Bring Your Own Key (BYOK)

Use your own LLM API keys instead of Mixpeek’s default keys. This gives you control over costs, rate limits, and API usage.

Why Use BYOK?

Setup

1

Store your API key as a secret

Store your LLM provider API key in the organization secrets vault:
2

Reference the secret in your stage

Use the api_key parameter with template syntax:

BYOK Configuration Example

Supported Providers

When api_key is not specified, the stage uses Mixpeek’s default API keys and usage is charged to your Mixpeek account.

Custom Filter Model (BYO Plugin)

Use your own filter model deployed as a custom extractor instead of a hosted LLM provider. Set feature_uri to route filtering through your extractor’s inference endpoint.

Parameters

Your plugin must accept {prompt: str, document: dict} and return {keep: bool, reason: str}.

Configuration Example

Set inference_type: "generate" in your plugin’s manifest to declare compatibility with LLM stages.

Error Handling