Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.2 instead.

llama-index-selectors-nace

LlamaIndex selectors backed by Drex decision models from Nace. Drex scores your options and returns probabilities instead of writing text for LlamaIndex to parse.

Install

pip install llama-index-selectors-nace

Set NACE_API_KEY. Optional: NACE_BASE_URL, NACE_DEFAULT_DECISION_MODEL. For OpenRouter pass base_url="https://openrouter.ai/api/v1".

The default model is drex-max-v1.1. An explicit model= is sent exactly as given; without one, NACE_DEFAULT_DECISION_MODEL is used when set, else drex-max-v1.1. If that default is a text-only model (drex-v1.5, drex-v2.0) and the request has images, drex-max-v1.1 is used for that request. OpenRouter doesn't list v1.1 yet, so there the default is the original Drex Max, nace-ai/drex-max.

Usage

from llama_index.core.query_engine import RouterQueryEngine
from llama_index.selectors.nace import NaceSingleSelector

router = RouterQueryEngine(
    selector=NaceSingleSelector(min_confidence=0.6, default_index=0),
    query_engine_tools=tools,
    llm=llm,  # RouterQueryEngine resolves an LLM at construction, even if it only routes
)

Drex replaces the routing decision, not answer generation: the chosen engine still needs an LLM to write the answer, and with multi-select RouterQueryEngine uses an LLM to merge answers.

Selectors also work on their own, in a Workflow branch (see examples/workflow_branching.py) and inside a running event loop such as Jupyter: select() is sync, aselect() is async.

NaceSingleSelector

One choice question whose options are the tools, one winner. On the default model (drex-max-v1.1) a choice question takes at most 255 options (Drex's limit), so a single selector takes at most 255 tools. min_confidence rejects an unsure top choice: it returns default_index with fell_back=True if set, otherwise raises NaceLowConfidenceError (carrying the probabilities). With default_index, transient failures (5xx, rate limit, connection) also fall back; authentication and request errors always propagate. Without min_confidence the top option is always returned.

NaceMultiSelector

One yes/no question per option, all in a single request. Options with p >= threshold (default 0.5) are returned best first, cut to max_outputs. The result is never empty: if nothing passes, the top option is returned with fell_back=True. Each option is one question, so the number of options is capped by Drex's per-request question limit. Drex enforces that limit itself and its refusal comes back as NaceUnprocessableEntityError with Drex's message; the package doesn't guess it, because it changes (Drex Max goes from 16 to 512 questions).

Known limitation: the default instruction asks whether each option is "needed". It is conservative on purely definitional questions (one live probe scored a docs tool 0.27 for "What does 429 mean?"), so the selector falls back to the top option. Lower threshold, or pass your own instructions ({label} and {description} are filled in).

Results

Both return NaceSelectorResult with probabilities (by label), labels, confidence, model, request_id, usage and fell_back. Labels are tool names when all are present and unique, otherwise option_1 ... option_n.

Images

If QueryBundle.image_path is set, the image is sent. The default model, drex-max-v1.1, reads images; when NACE_DEFAULT_DECISION_MODEL names a text-only model, image queries still go to drex-max-v1.1. An explicit text-only model= with an image raises NaceImageModelError. A missing file raises NaceImageError before any request.

See examples/ for runnable scripts and notebooks.

Metadata

Release files for llama-index-selectors-nace 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-nace 0.1.1
File Size Uploaded Provenance Actions
llama_index_selectors_nace-0.1.1.tar.gz 14.4 kB With provenance Details for llama_index_selectors_nace-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 32.4 kB

Release files / llama_index_selectors_nace-0.1.1.tar.gz

Download URL llama_index_selectors_nace-0.1.1.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
69b43c4a5d6a17187c2df7fb14f2c8156e879b209406d1c3e7851cea9d5db6d0
BLAKE2b-256 checksum
How to use checksums
fef01b1e8a525753d0ee291ec131f38523920c566e02c3c162367da72a67e07a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

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

Download URL llama_index_selectors_nace-0.1.1-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41a3a7c80d620f3f90ecd8fe345c1449534028c6dcacf754cd6de88a24935524
BLAKE2b-256 checksum
How to use checksums
27e81f758d6cc9cc54de15a359ecb5864f85414174943c7c2b6443938a6f0247
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for llama-index-selectors-nace 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llama_index_selectors_nace-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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