Skip to main content

llama-index-postprocessor-jev

Drop-in JevRerank for LlamaIndex: score each retrieved passage with TypeSafe Jev, keep the top n. Typed 0–3 scores, not a cross-encoder and not an LLM-as-judge loop.

Full story, selector package, and benchmark numbers: llama-index-jev.

pip install llama-index-postprocessor-jev
export TYPESAFE_API_KEY=...   # or pass api_key= to JevRerank
# OpenRouter (optional): export OPENROUTER_API_KEY=... and
# JevRerank(provider="openrouter")

Usage

from llama_index.core import VectorStoreIndex, Document
from llama_index.postprocessor.jev import JevRerank

index = VectorStoreIndex.from_documents(
    [
        Document(text="The Eiffel Tower is in Paris."),
        Document(text="Python is a programming language."),
        Document(text="The Louvre is a museum in Paris."),
    ]
)

reranker = JevRerank(top_n=2, mode="score")
# reranker = JevRerank(provider="openrouter", top_n=2, mode="score")
query_engine = index.as_query_engine(
    similarity_top_k=5,
    node_postprocessors=[reranker],
)
print(query_engine.query("Where is the Eiffel Tower?"))

A standalone walkthrough is in examples/basic_rerank.py (examples README). The checked-in walkthrough uses provider="openrouter" and needs OPENROUTER_API_KEY.

Design

One call per passage

Each retrieved node becomes its own system_one call:

state = {"query": query_str, "passage": passage_text}
questions = {"relevance": Score(...)}  # or Noul(...)

Jev's question ids are invisible to the model. If you stuff 50 passages into one state and ask 50 questions, the model cannot tell which question goes with which passage, and accuracy falls as the context grows ("context rot"). TypeSafe's own rerank cookbook scores one query–passage pair at a time. Parallelism is bounded with max_concurrency (default 8), not by chunking nodes into groups of 255.

Fail open

If any Jev call in a pass fails (timeout, 429, 5xx), the whole pass is abandoned and the original retrieval order is returned, truncated to top_n. A slightly-worse ranking is better than dropping the user's context. Set raise_on_error=True to surface the error instead. The pass is all-or-nothing: we never mix a partial Jev ranking with original retrieval scores.

confidence_threshold flags, it does not drop

In mode="score", Jev also returns confidence. If you set confidence_threshold, nodes below it get metadata["jev_low_confidence"] = True. They still participate in ranking. Filtering on confidence would silently delete evidence; flagging lets the caller decide.

Noul mode has no confidence field. jev_confidence / jev_low_confidence are not written.

Score scale is 0–3, not cosine similarity

mode="score" (the default) uses a 4-level rubric:

Score Meaning
0 Off-topic
1 Tangential
2 Partial answer
3 Fully answers

The returned .score can land between levels (e.g. 2.4). LlamaIndex only sorts by this number. Do not feed it to SimilarityPostprocessor or any cutoff that expects a 0–1 cosine.

mode="noul" is a yes/no relevance probability in 0–1.

Original retrieval scores are stored on the node as metadata["retrieval_score"].

Release files for llama-index-postprocessor-jev 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-postprocessor-jev 0.1.1
File Size Uploaded
llama_index_postprocessor_jev-0.1.1.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-postprocessor-jev 0.1.1
File Interpreter ABI Platform
llama_index_postprocessor_jev-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.6 kB

Release files / llama_index_postprocessor_jev-0.1.1.tar.gz

Download URL llama_index_postprocessor_jev-0.1.1.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9b92dee9e17d642be3987dc75c6c26c889e1160400a0f26e44919a2e1b4175f5
BLAKE2b-256 checksum
How to use checksums
124e499cb664d1cfe1a0821102834b1593a1344f72bdba3381f51f447101eb55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_postprocessor_jev-0.1.1-py3-none-any.whl

Download URL llama_index_postprocessor_jev-0.1.1-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92adfa4a0bb5ab7fcd1f3e5634c76fb4980599378ea7cfe914c3db64dfa08c60
BLAKE2b-256 checksum
How to use checksums
4ba2326790b032bd42d2ec6ce8b8837c7d3c83a5c1118d2113b0cb0409f35401
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page