New integration: Nace Drex decision models (nace-haystack)

Open
#4,174 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
ai, backend

Research direction

Start by reading CONTRIBUTING.md#create-a-new-integration and inspect the repository’s integration scaffolding and the existing TypeSafe integration, which the issue identifies as a comparable implementation. The proposal describes four components, async and sync APIs, serialization, image handling, evaluators, and CI; use those requirements to scope the work. Done means the integration and checklist items are complete, including tests, documentation, packaging, and repository inventory updates.

Written by the indexing model from the issue text.

Description

new integration P3

Summary and motivation

Drex is a family of decision models from Nace. Instead of generating text, a Drex model answers typed questions about a text, JSON or images in one request and returns calibrated probabilities:

  • choice: one label from a set
  • score: ordered levels
  • noul: P(yes) for a yes/no statement

That's a good fit for Haystack's routing, metadata enrichment and evaluation, where today you use ConditionalRouter rules, local zero-shot models, or an LLM judge that returns a sampled label.

nace-haystack adds four components:

  • NaceTextRouter: one output per label, an optional low_confidence fallback and an optional probabilities output. It also routes images on Drex Max.
  • NaceDocumentClassifier: answers several typed questions per document in one request and stores the answers in Document.meta.
  • NaceFaithfulnessEvaluator and NaceContextRelevanceEvaluator: the same inputs and outputs as Haystack's built-in FaithfulnessEvaluator and ContextRelevanceEvaluator, with the score being Drex's probability.

The package is already published and maintained by Nace: https://pypi.org/project/nace-haystack/ (Apache-2.0), source at https://github.com/nace-ai/nace-haystack. It follows the core-integrations layout (haystack_integrations namespace, hatch, test:unit / test:integration / test:types, pydoc config), so moving it here is mostly a copy.

Adoption signals

  • GitHub stars of the main repository: nace-ai/nace-haystack has 1. It was made public on 2026-10-30.
  • PyPI downloads in the last 30 days (pypistats.org):
    • nace-sdk, the Python client this integration builds on: 2,074. It was first released on 2026-10-08.
    • nace-haystack: 85 on its first day (0.1.0 was released on 2026-10-29).
  • Release activity: new Drex models ship every one to two weeks (v1.5 on 2026-09-28, v2.0 on 2026-10-06, Max on 2026-10-13, Max v1.1 on 2026-10-28). nace-sdk has had 6 releases since 2026-10-08, the latest (0.6.2) on 2026-10-30. This integration is released with them.
  • Maintenance: maintained by Nace AI. The integration has unit tests on Python 3.11–3.15 on Linux, plus 3.11 and 3.15 on Windows and macOS, and nightly live tests against the production API.
  • Haystack community demand: none to link yet. Drex is four weeks old.
  • Anything else:
    • Model usage: Drex is served on OpenRouter's decisions leaderboard. In the week of 2026-10-28 it handled roughly 39M requests: Drex v2.0 about 16.5M, Drex v1.5 about 16.2M, Drex Max about 6.1M.
    • Open weights on Hugging Face: nace-ai/drex-v1.5 (842 downloads, 53 likes) and nace-ai/drex-v2.0 (325 downloads, 19 likes, plus GGUF builds).
    • Other frameworks: Nace also maintains langchain-nace for LangChain.
    • Comparable integrations: decision models are a new category. TypeSafe's Jev is already here as typesafe-haystack (763 downloads in the last 30 days). Drex is wire-compatible with Jev's System One API, and nace-haystack mirrors TypeSafeTextRouter and TypeSafeDocumentClassifier, so a Jev pipeline switches with three edits.
    • Why not just point typesafe-haystack at Drex? Text routing and classification do work that way. nace-haystack adds what that can't:
      • image input on Drex Max (screenshots, scanned documents), with automatic downscaling to the request limit and uploaded-file references;
      • the two evaluators;
      • an opt-in probabilities output on the router;
      • an OpenRouter backend;
      • Drex-specific error messages.

The numbers are small because Drex is new: the first model shipped on 2026-09-28. We expect them to grow with each model release.

Detailed design

  • Import paths:
    • haystack_integrations.components.routers.nace → NaceTextRouter
    • haystack_integrations.components.classifiers.nace → NaceDocumentClassifier
    • haystack_integrations.components.evaluators.nace → NaceFaithfulnessEvaluator, NaceContextRelevanceEvaluator
  • Built on nace-sdk (NaceClient/AsyncNaceClient). api_key: Secret defaults to NACE_API_KEY, and api_base_url defaults to NACE_BASE_URL.
  • The default NACE_API_KEY is only ever sent to Nace's HTTPS production API. Any other host, OpenRouter included, needs an explicit api_key. A saved pipeline keeps its destination, empty keys are refused, and cross-origin redirects are refused.
  • Every component has run and run_async, warm_up/warm_up_async and close/close_async, and full to_dict/from_dict support, including YAML.
  • model defaults to the newest Drex model (drex-max-v1.1). Any model ID is sent as given: there's no model enum, so new Drex models work without a release.
  • The classifier and evaluators run up to max_workers requests in parallel and honour raise_on_failure. Failed documents go to failed_documents with meta["classification_error"]; failed evaluator items score NaN. Missing answers and invalid probabilities count as failures.
  • Retries on 429/529 honour retry-after-ms. Errors keep nace-sdk's exception classes and carry readable messages.
  • Corner cases covered by tests:
    • images on a text-only model are refused before sending;
    • images over the 4 MiB request limit are shrunk, with EXIF rotation and 16-bit grayscale handled;
    • reserved output names are refused;
    • a new event loop gets a new async client;
    • after a failure, queued batch requests are not sent.
  • Usage examples: README, an example support-email pipeline and a notebook.

Checklist

If the request is accepted, ensure the following checklist is complete before closing this issue.
Follow the instructions in https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md#create-a-new-integration and use our scaffolding script for the implementation.

Tasks
  • The code is documented with docstrings and was merged in the main branch
  • Docs are published at https://docs.haystack.deepset.ai/
  • There is a Github workflow running the tests for the integration nightly and at every PR
  • A new label named like integration:<your integration name> has been added to the list of labels for this repository
  • The labeler.yml file has been updated
  • The package has been released on PyPI
  • An integration tile with a usage example has been added to https://github.com/deepset-ai/haystack-integrations
  • The integration has been listed in the Inventory section of this repo README
  • The feature was announced through social media
Dominant language
Python
Stars
212
Forks
396
Avg merge
2d 9h
Merged PRs (30d)
95

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from deepset-ai/haystack-core-integrations

All issues in deepset-ai/haystack-core-integrations

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.