Skip to main content

llama-index-postprocessor-jev

TypeSafe Jev reranker for LlamaIndex.

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. Running it needs a live TYPESAFE_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.0

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.0
File Size Uploaded
llama_index_postprocessor_jev-0.1.0.tar.gz 7.8 kB Details

Built distribution (wheel)

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

Total release size: 17.7 kB

Release files / llama_index_postprocessor_jev-0.1.0.tar.gz

Download URL llama_index_postprocessor_jev-0.1.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
789e1af1e3ad5fec8efa56d3cdc05cf6656bd13add5335b2c17c2a258b1dddd3
BLAKE2b-256 checksum
How to use checksums
58a2f072573e75c84e59f6a48e22ca8a5db484aa98c8fdab80ec62e6d8f8589d
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.0-py3-none-any.whl

Download URL llama_index_postprocessor_jev-0.1.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc0bcd50c58c509443562cc34d727be8809ebdecb2b7c259f3fe28235af6cfd4
BLAKE2b-256 checksum
How to use checksums
5d67a5a6b10a9a335d3f419bb7969cf264ab4238327d3e137ef91324b6112cd8
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

0.1.1

2 release files

This release

0.1.0 This release

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