Skip to main content

llama-index-selectors-jev

Drop-in JevSingleSelector / JevMultiSelector for LlamaIndex routers: typed tool / query-engine choice with TypeSafe Jev, without an LLM-as-judge.

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

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

Usage

from llama_index.core.tools import ToolMetadata
from llama_index.selectors.jev import JevSingleSelector

selector = JevSingleSelector()
result = selector.select(
    [
        ToolMetadata(name="weather", description="Forecasts and current conditions"),
        ToolMetadata(name="docs", description="Product documentation lookup"),
    ],
    "Will it rain in Paris tomorrow?",
)
print(result.ind, result.reason)

JevSingleSelector plugs into RouterQueryEngine:

from llama_index.core.query_engine import RouterQueryEngine
from llama_index.selectors.jev import JevSingleSelector

engine = RouterQueryEngine(
    selector=JevSingleSelector(),
    query_engine_tools=[weather_tool, docs_tool],
)

See examples/basic_selector.py and examples/router_query_engine.py (examples README). The checked-in walkthroughs use provider="openrouter" and need OPENROUTER_API_KEY.

Design

Fail closed

Wrong routing is worse than slightly-worse ranking. If the API errors, if Jev returns a choice that is not in the option set, or if confidence is below confidence_threshold, JevSingleSelector raises — unless you set default_index, in which case that one selection is returned with a reason that names both the fallback and the error.

This is TypeSafe's "don't act when uncertain." A low-confidence but in-schema choice is treated as failure, not as success.

Single vs multi

  • JevSingleSelector asks one Choice question whose option names are the tool names (when those names are unique). The model sees names and descriptions, not opaque option_0 labels.
  • JevMultiSelector asks one Noul per option in a single system_one call (the query is the whole state, so batching questions is correct). Options with noul > threshold are kept, in original order.

If there are more than 255 options, the multi-selector splits the question map across calls of at most 255 keys. That is the only 255-chunking in this repo; it is a safety cap on question-map size, not a rerank batch size.

Multi-select never returns an empty list

If zero Nouls clear threshold, JevMultiSelector returns exactly the highest-noul choice. An empty selection would leave a router with nothing to call. default_index is not used for this case — it is API-error fallback only.

Release files for llama-index-selectors-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-selectors-jev 0.1.1
File Size Uploaded
llama_index_selectors_jev-0.1.1.tar.gz 8.2 kB Details

Built distribution (wheel)

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

Total release size: 18.2 kB

Release files / llama_index_selectors_jev-0.1.1.tar.gz

Download URL llama_index_selectors_jev-0.1.1.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
39b0dcfca795736e504fdada13e933da9bd8043ff0cbf924571f0935a5798f1c
BLAKE2b-256 checksum
How to use checksums
c450cb44f8a1318277cc517dc0f77a06f3e37bb379e2f762cc94381ddbdcfaec
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_selectors_jev-0.1.1-py3-none-any.whl

Download URL llama_index_selectors_jev-0.1.1-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30169185040059c1bb2e085736cc9e866374b3dc7bedaad3bb87bf24ecb60f64
BLAKE2b-256 checksum
How to use checksums
bbad21d77e56cb2d6b7c0f8fe1d50bf5f5764f7f305ddc5aa52df2f799a596c2
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