Skip to content
jeff.retrieval.doc-typev1.4.0

Document classification

Classifies a document using your list of document types and descriptions, or returns other when none fits.

Open in playground

Example

Context

sorting_desk
The shared inbox of a home energy installer's office, where suppliers, customers and partners send documents.

Input

QUOTATION Q-2291 To: Fenwick Home Energy, 12 Quay Street For the supply of 40 outdoor mounting brackets (model MB-6) at 32.00 each: 1,280.00 plus VAT. This quotation is valid for 30 days. An invoice will follow on delivery.

Labels (the options)

invoice
A bill for goods or services already supplied, asking for payment
quote
An offer of a price for goods or services, before any order
purchase_order
The buyer's order to a supplier, placing an order at agreed prices
delivery_note
A note listing goods delivered, signed on receipt
other
None of these types
Answer (JSON)
value quote, confidence 0.997
Top options
  1. quote 0.997
  2. other 0.002
  3. purchase_order 0

The document offers a price before any order is placed, so its type is quote.

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.doc-type.doc_type", context={        "sorting_desk": "The shared inbox of a home energy installer's office, where suppliers, customers and partners send documents.",    }, labels={        "invoice": "A bill for goods or services already supplied, asking for payment",        "quote": "An offer of a price for goods or services, before any order",        "purchase_order": "The buyer's order to a supplier, placing an order at agreed prices",        "delivery_note": "A note listing goods delivered, signed on receipt",        "other": "None of these types",    })     decision = decide("QUOTATION Q-2291\nTo: Fenwick Home Energy, 12 Quay Street\nFor the supply of 40 outdoor mounting brackets (model MB-6) at 32.00 each: 1,280.00 plus VAT.\nThis quotation is valid for 30 days. An invoice will follow on delivery.")     print(decision.value, decision.confidence)

More examples

  • Bill for brackets already deliveredanswer invoice · confidence 0.992

    Context

    sorting_desk
    The shared inbox of a home energy installer's office, where suppliers, customers and partners send documents.

    Input

    INVOICE INV-55190 To: Fenwick Home Energy, 12 Quay Street For 40 outdoor mounting brackets (model MB-6) delivered on 28 October 2026: 1,280.00 plus VAT 256.00, total 1,536.00. Payment due within 30 days to account 20-44-91 31877265.

    Labels (the options)

    invoice
    A bill for goods or services already supplied, asking for payment
    quote
    An offer of a price for goods or services, before any order
    purchase_order
    The buyer's order to a supplier, placing an order at agreed prices
    delivery_note
    A note listing goods delivered, signed on receipt
    other
    None of these types
    Answer (JSON)
    value invoice, confidence 0.992
    Top options
    1. invoice 0.992
    2. delivery_note 0.003
    3. quote 0.002

    The document bills for brackets already delivered and asks for payment, so its type is invoice.

    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.doc-type.doc_type", context={        "sorting_desk": "The shared inbox of a home energy installer's office, where suppliers, customers and partners send documents.",    }, labels={        "invoice": "A bill for goods or services already supplied, asking for payment",        "quote": "An offer of a price for goods or services, before any order",        "purchase_order": "The buyer's order to a supplier, placing an order at agreed prices",        "delivery_note": "A note listing goods delivered, signed on receipt",        "other": "None of these types",    })     decision = decide("INVOICE INV-55190\nTo: Fenwick Home Energy, 12 Quay Street\nFor 40 outdoor mounting brackets (model MB-6) delivered on 28 October 2026: 1,280.00 plus VAT 256.00, total 1,536.00.\nPayment due within 30 days to account 20-44-91 31877265.")     print(decision.value, decision.confidence)
  • Order placed with a supplieranswer purchase_order · confidence 0.994

    Context

    sorting_desk
    The shared inbox of a home energy installer's office, where suppliers, customers and partners send documents.

    Input

    PURCHASE ORDER PO-3108 From: Fenwick Home Energy, 12 Quay Street To: Brightwell Fixings Ltd Please supply 40 outdoor mounting brackets (model MB-6) at 32.00 each, as in your quotation Q-2291. Deliver to our Quay Street store by 6 November 2026.

    Labels (the options)

    invoice
    A bill for goods or services already supplied, asking for payment
    quote
    An offer of a price for goods or services, before any order
    purchase_order
    The buyer's order to a supplier, placing an order at agreed prices
    delivery_note
    A note listing goods delivered, signed on receipt
    other
    None of these types
    Answer (JSON)
    value purchase_order, confidence 0.994
    Top options
    1. purchase_order 0.994
    2. quote 0.004
    3. other 0.001

    The installer orders brackets from the supplier at the quoted price, so the type is purchase_order.

    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.doc-type.doc_type", context={        "sorting_desk": "The shared inbox of a home energy installer's office, where suppliers, customers and partners send documents.",    }, labels={        "invoice": "A bill for goods or services already supplied, asking for payment",        "quote": "An offer of a price for goods or services, before any order",        "purchase_order": "The buyer's order to a supplier, placing an order at agreed prices",        "delivery_note": "A note listing goods delivered, signed on receipt",        "other": "None of these types",    })     decision = decide("PURCHASE ORDER PO-3108\nFrom: Fenwick Home Energy, 12 Quay Street\nTo: Brightwell Fixings Ltd\nPlease supply 40 outdoor mounting brackets (model MB-6) at 32.00 each, as in your quotation Q-2291. Deliver to our Quay Street store by 6 November 2026.")     print(decision.value, decision.confidence)
  • Goods signed for at the storeanswer delivery_note · confidence 0.998

    Context

    sorting_desk
    The shared inbox of a home energy installer's office, where suppliers, customers and partners send documents.

    Input

    DELIVERY NOTE DN-77412 Brightwell Fixings Ltd to Fenwick Home Energy, Quay Street store Order PO-3108: 40 x outdoor mounting bracket MB-6. Delivered 28 October 2026, 10:40. Received in good condition: signed K. Doyle (stores)

    Labels (the options)

    invoice
    A bill for goods or services already supplied, asking for payment
    quote
    An offer of a price for goods or services, before any order
    purchase_order
    The buyer's order to a supplier, placing an order at agreed prices
    delivery_note
    A note listing goods delivered, signed on receipt
    other
    None of these types
    Answer (JSON)
    value delivery_note, confidence 0.998
    Top options
    1. delivery_note 0.998
    2. quote 0.001
    3. purchase_order 0.001

    The document lists the goods delivered and is signed on receipt, so the type is delivery_note.

    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.doc-type.doc_type", context={        "sorting_desk": "The shared inbox of a home energy installer's office, where suppliers, customers and partners send documents.",    }, labels={        "invoice": "A bill for goods or services already supplied, asking for payment",        "quote": "An offer of a price for goods or services, before any order",        "purchase_order": "The buyer's order to a supplier, placing an order at agreed prices",        "delivery_note": "A note listing goods delivered, signed on receipt",        "other": "None of these types",    })     decision = decide("DELIVERY NOTE DN-77412\nBrightwell Fixings Ltd to Fenwick Home Energy, Quay Street store\nOrder PO-3108: 40 x outdoor mounting bracket MB-6. Delivered 28 October 2026, 10:40.\nReceived in good condition: signed K. Doyle (stores)")     print(decision.value, decision.confidence)
  • Newsletter about a trade showanswer other · confidence 0.994

    Context

    sorting_desk
    The shared inbox of a home energy installer's office, where suppliers, customers and partners send documents.

    Input

    Brightwell Fixings - November news Come and see our new range of heat pump brackets at the Northern Installers Show, stand 14, on 19 and 20 November. Free coffee and a prize draw for every visitor.

    Labels (the options)

    invoice
    A bill for goods or services already supplied, asking for payment
    quote
    An offer of a price for goods or services, before any order
    purchase_order
    The buyer's order to a supplier, placing an order at agreed prices
    delivery_note
    A note listing goods delivered, signed on receipt
    other
    None of these types
    Answer (JSON)
    value other, confidence 0.994
    Top options
    1. other 0.994
    2. quote 0.004
    3. delivery_note 0.001

    A newsletter inviting visitors to a trade show is none of the listed types, so the answer is other.

    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.doc-type.doc_type", context={        "sorting_desk": "The shared inbox of a home energy installer's office, where suppliers, customers and partners send documents.",    }, labels={        "invoice": "A bill for goods or services already supplied, asking for payment",        "quote": "An offer of a price for goods or services, before any order",        "purchase_order": "The buyer's order to a supplier, placing an order at agreed prices",        "delivery_note": "A note listing goods delivered, signed on receipt",        "other": "None of these types",    })     decision = decide("Brightwell Fixings - November news\nCome and see our new range of heat pump brackets at the Northern Installers Show, stand 14, on 19 and 20 November. Free coffee and a prize draw for every visitor.")     print(decision.value, decision.confidence)

Use when

  • You need to sort incoming documents into categories you define.

Avoid when

  • You need to extract document fields; this adapter only identifies the document type.

Context and input

FieldKindDescription
document
inputThe document's text.
sorting_desk
contextWhere the document arrived: a sentence describing the inbox or team that sorts it.

Functions

KeyInterfaceInstructionsLabels
doc_typeclassifyWhich type of document is this? Choose one type from the list, using the descriptions. Judge by what the document is and does (its purpose, who sends it to whom, what it asks for or records), not by words it mentions in passing: a quote that says an invoice will follow is still a quote. The title may be missing or worded differently from the type names. When two listed types are similar, the descriptions say how to tell them apart. other: the document is none of the listed types, even when a listed type is similar to it.from the caller

How it was measured

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

  • 96.9% on the in-house test (2,000 rows). in-house: same generator as the training data
  • 99.1% 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
doc_type97.8%100.0%0.502,000

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

Base

jeff-base v1.4

Call it

jeff.retrieval.doc-type.doc_type, 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.doc-type.doc_type", context={        "sorting_desk": "<sorting_desk>",    })     decision = decide("<document>")     print(decision.value, decision.confidence)

Download

Weights: mstrasser/jeff-adapter-doc-type (v1.4)

Licence: Apache-2.0