llama-index-selectors-jev
TypeSafe Jev selector for LlamaIndex.
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.
Running them needs a live TYPESAFE_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
JevSingleSelectorasks oneChoicequestion whose option names are the tool names (when those names are unique). The model sees names and descriptions, not opaqueoption_0labels.JevMultiSelectorasks oneNoulper option in a singlesystem_onecall (the query is the whole state, so batching questions is correct). Options withnoul > thresholdare 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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama_index_selectors_jev-0.1.0.tar.gz | 7.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_index_selectors_jev-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.2 kB
Release files / llama_index_selectors_jev-0.1.0.tar.gz
| Download URL | llama_index_selectors_jev-0.1.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf4e85e186922c2c3f934c7211f1233007300225d3e4133e4413793309924494
|
|
BLAKE2b-256 checksum How to use checksums |
a1da3eeee19421727db269f670d98ef47faf65699d00aae5330cff51a9a73770
|
| 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.0-py3-none-any.whl
| Download URL | llama_index_selectors_jev-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4fe7932bc4d485f7cb85eab716d354ee375cd906344b96592d1f5e7c0ebda1b
|
|
BLAKE2b-256 checksum How to use checksums |
aacd2fc03de8ea803c267993e153f353a69472a59a6eb64a3e5f1ebedfb0e781
|
| 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}
|