Skip to content
jeff.retrieval.query-routev1.4.0

Search source selection

Selects which document collection, database or tool should handle a query from a menu of sources. Can also indicate that several sources or no source are needed.

Open in playground

Example

Context

menu
- product_manuals: installation and user manuals for every heat pump and boiler the company sells - warranty_terms: the warranty terms for each product, by model and installation date - customer_orders: each customer's orders, installations and visits (a database) - pricing: current prices and offers

Input

How long is the warranty on an Aster 2 heat pump installed after March 2026?

Labels (the options)

product_manuals
Installation and user manuals for every heat pump and boiler the company sells
warranty_terms
The warranty terms for each product, by model and installation date
customer_orders
Each customer's orders, installations and visits (a database)
pricing
Current prices and offers
none
No source on the menu holds what the query needs, or no lookup is needed
several
The answer needs facts from two or more of these sources
Answer (JSON)
value warranty_terms, confidence 0.981
Top options
  1. warranty_terms 0.981
  2. product_manuals 0.009
  3. customer_orders 0.005

A question about a product's warranty goes to the warranty_terms source.

Open in playground

import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client:     decide = client.function("jeff.retrieval.query-route.source", context={        "menu": "- product_manuals: installation and user manuals for every heat pump and boiler the company sells\n- warranty_terms: the warranty terms for each product, by model and installation date\n- customer_orders: each customer's orders, installations and visits (a database)\n- pricing: current prices and offers",    }, labels={        "product_manuals": "Installation and user manuals for every heat pump and boiler the company sells",        "warranty_terms": "The warranty terms for each product, by model and installation date",        "customer_orders": "Each customer's orders, installations and visits (a database)",        "pricing": "Current prices and offers",        "none": "No source on the menu holds what the query needs, or no lookup is needed",        "several": "The answer needs facts from two or more of these sources",    })     decision = decide("How long is the warranty on an Aster 2 heat pump installed after March 2026?")     print(decision.value, decision.confidence)

More examples

  • When is my engineer coming?answer customer_orders · confidence 0.793

    Context

    menu
    - product_manuals: installation and user manuals for every heat pump and boiler the company sells - warranty_terms: the warranty terms for each product, by model and installation date - customer_orders: each customer's orders, installations and visits (a database) - pricing: current prices and offers

    Input

    When is the engineer booked to come to my house, order FH-20871?

    Labels (the options)

    product_manuals
    Installation and user manuals for every heat pump and boiler the company sells
    warranty_terms
    The warranty terms for each product, by model and installation date
    customer_orders
    Each customer's orders, installations and visits (a database)
    pricing
    Current prices and offers
    none
    No source on the menu holds what the query needs, or no lookup is needed
    several
    The answer needs facts from two or more of these sources
    Answer (JSON)
    value customer_orders, confidence 0.793
    Top options
    1. customer_orders 0.793
    2. none 0.198
    3. several 0.004

    A question about when the engineer is booked for one customer's order goes to customer_orders.

    Open in playground

    import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client:     decide = client.function("jeff.retrieval.query-route.source", context={        "menu": "- product_manuals: installation and user manuals for every heat pump and boiler the company sells\n- warranty_terms: the warranty terms for each product, by model and installation date\n- customer_orders: each customer's orders, installations and visits (a database)\n- pricing: current prices and offers",    }, labels={        "product_manuals": "Installation and user manuals for every heat pump and boiler the company sells",        "warranty_terms": "The warranty terms for each product, by model and installation date",        "customer_orders": "Each customer's orders, installations and visits (a database)",        "pricing": "Current prices and offers",        "none": "No source on the menu holds what the query needs, or no lookup is needed",        "several": "The answer needs facts from two or more of these sources",    })     decision = decide("When is the engineer booked to come to my house, order FH-20871?")     print(decision.value, decision.confidence)
  • Error code in the installation manualanswer product_manuals · confidence 0.88

    Context

    menu
    - product_manuals: installation and user manuals for every heat pump and boiler the company sells - warranty_terms: the warranty terms for each product, by model and installation date - customer_orders: each customer's orders, installations and visits (a database) - pricing: current prices and offers

    Input

    What does error code E4 on the Aster 2 heat pump mean, and what does the installation manual say to do about it?

    Labels (the options)

    product_manuals
    Installation and user manuals for every heat pump and boiler the company sells
    warranty_terms
    The warranty terms for each product, by model and installation date
    customer_orders
    Each customer's orders, installations and visits (a database)
    pricing
    Current prices and offers
    none
    No source on the menu holds what the query needs, or no lookup is needed
    several
    The answer needs facts from two or more of these sources
    Answer (JSON)
    value product_manuals, confidence 0.88
    Top options
    1. product_manuals 0.88
    2. several 0.08
    3. none 0.032

    A question about an error code and what the installation manual says goes to product_manuals.

    Open in playground

    import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client:     decide = client.function("jeff.retrieval.query-route.source", context={        "menu": "- product_manuals: installation and user manuals for every heat pump and boiler the company sells\n- warranty_terms: the warranty terms for each product, by model and installation date\n- customer_orders: each customer's orders, installations and visits (a database)\n- pricing: current prices and offers",    }, labels={        "product_manuals": "Installation and user manuals for every heat pump and boiler the company sells",        "warranty_terms": "The warranty terms for each product, by model and installation date",        "customer_orders": "Each customer's orders, installations and visits (a database)",        "pricing": "Current prices and offers",        "none": "No source on the menu holds what the query needs, or no lookup is needed",        "several": "The answer needs facts from two or more of these sources",    })     decision = decide("What does error code E4 on the Aster 2 heat pump mean, and what does the installation manual say to do about it?")     print(decision.value, decision.confidence)
  • Price of a new boileranswer pricing · confidence 0.995

    Context

    menu
    - product_manuals: installation and user manuals for every heat pump and boiler the company sells - warranty_terms: the warranty terms for each product, by model and installation date - customer_orders: each customer's orders, installations and visits (a database) - pricing: current prices and offers

    Input

    How much is the Corrin 30 combi boiler at the moment, and is there an offer on?

    Labels (the options)

    product_manuals
    Installation and user manuals for every heat pump and boiler the company sells
    warranty_terms
    The warranty terms for each product, by model and installation date
    customer_orders
    Each customer's orders, installations and visits (a database)
    pricing
    Current prices and offers
    none
    No source on the menu holds what the query needs, or no lookup is needed
    several
    The answer needs facts from two or more of these sources
    Answer (JSON)
    value pricing, confidence 0.995
    Top options
    1. pricing 0.995
    2. customer_orders 0.002
    3. several 0.001

    A question about a boiler's current price and offers goes to pricing.

    Open in playground

    import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client:     decide = client.function("jeff.retrieval.query-route.source", context={        "menu": "- product_manuals: installation and user manuals for every heat pump and boiler the company sells\n- warranty_terms: the warranty terms for each product, by model and installation date\n- customer_orders: each customer's orders, installations and visits (a database)\n- pricing: current prices and offers",    }, labels={        "product_manuals": "Installation and user manuals for every heat pump and boiler the company sells",        "warranty_terms": "The warranty terms for each product, by model and installation date",        "customer_orders": "Each customer's orders, installations and visits (a database)",        "pricing": "Current prices and offers",        "none": "No source on the menu holds what the query needs, or no lookup is needed",        "several": "The answer needs facts from two or more of these sources",    })     decision = decide("How much is the Corrin 30 combi boiler at the moment, and is there an offer on?")     print(decision.value, decision.confidence)
  • Weather forecast for the weekendanswer none · confidence 0.928

    Context

    menu
    - product_manuals: installation and user manuals for every heat pump and boiler the company sells - warranty_terms: the warranty terms for each product, by model and installation date - customer_orders: each customer's orders, installations and visits (a database) - pricing: current prices and offers

    Input

    Will it rain in Manchester on Saturday?

    Labels (the options)

    product_manuals
    Installation and user manuals for every heat pump and boiler the company sells
    warranty_terms
    The warranty terms for each product, by model and installation date
    customer_orders
    Each customer's orders, installations and visits (a database)
    pricing
    Current prices and offers
    none
    No source on the menu holds what the query needs, or no lookup is needed
    several
    The answer needs facts from two or more of these sources
    Answer (JSON)
    value none, confidence 0.928
    Top options
    1. none 0.928
    2. pricing 0.062
    3. customer_orders 0.005

    A weather question is not something any source on the menu holds, so the answer is none.

    Open in playground

    import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client:     decide = client.function("jeff.retrieval.query-route.source", context={        "menu": "- product_manuals: installation and user manuals for every heat pump and boiler the company sells\n- warranty_terms: the warranty terms for each product, by model and installation date\n- customer_orders: each customer's orders, installations and visits (a database)\n- pricing: current prices and offers",    }, labels={        "product_manuals": "Installation and user manuals for every heat pump and boiler the company sells",        "warranty_terms": "The warranty terms for each product, by model and installation date",        "customer_orders": "Each customer's orders, installations and visits (a database)",        "pricing": "Current prices and offers",        "none": "No source on the menu holds what the query needs, or no lookup is needed",        "several": "The answer needs facts from two or more of these sources",    })     decision = decide("Will it rain in Manchester on Saturday?")     print(decision.value, decision.confidence)

Use when

  • Your assistant can search several sources and needs to choose where to look.

Avoid when

  • You need to rewrite the query for a source; this adapter only selects the source.

Context and input

FieldKindDescription
query
inputThe user's query.
menu
contextThe sources a query can be sent to (document collections, indexes, databases, tools), written as tool definitions with names and descriptions.

Functions

KeyInterfaceInstructionsLabels
sourcerouteWhich of the sources on the menu should this query be sent to? Each source (a document collection, index, database or tool) is described on the menu. Choose the one source whose contents answer the query; judge by what each source holds, not by words the query shares with a source's name. none: no source on the menu holds what the query needs (it belongs to a source that is not listed), or the message needs no lookup at all (a greeting, thanks, or a request to reword text). several: answering needs facts from two or more different sources on the menu, because no single source holds all of them.from the caller

How it was measured

Test accuracy: the share of test rows whose top answer was right.

  • 99.3% on the in-house test (2,000 rows). in-house: same generator as the training data
  • 98.9% on a second in-house test of unseen cases (2,000 rows). in-house: same generator as the training data

When confident

From the calibration set: at or above the threshold confidence, how often the answer is right, and how often the adapter is that confident. Below it, escalate.

FunctionRight when confidentConfident onThresholdCalibration rows
source98.7%100.0%0.342,000

Base: Jeff v1.4. Adapter trained: 25 October 2026.

Base

jeff-base v1.4

Call it

jeff.retrieval.query-route.source, with placeholders for its input and context.

import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client:     decide = client.function("jeff.retrieval.query-route.source", context={        "menu": "<menu>",    })     decision = decide("<query>")     print(decision.value, decision.confidence)

Download

Weights: mstrasser/jeff-adapter-query-route (v1.4)

Licence: Apache-2.0