toolgarden.xyz
中文

Needle 2 Structured Data

Call Needle 2 to extract natural language into structured data with a JSON Schema and a constrained tool call.

Input text

0 characters

Record schema

JSON Schema object

Development defaults to a same-origin proxy for the local playground; enter a compatible /complete URL for a remote service.

Generated result

The generated result will appear here

Text is sent to the endpoint you provide; review its privacy and CORS configuration.

About this tool

Needle 2 models structured extraction as a tool call: this page wraps the record schema as one tool, sends the source text as the query to a compatible endpoint, and reads the result from function_calls[].arguments. The shape is constrained by the schema instead of being generated as free text and repaired afterward.

This page connects to an external Needle 2 service, defaulting to the local Needle playground. Text does not pass through a ToolGarden server, but it is sent to the endpoint you enter; review its deployment, CORS, access control, and sensitive-data policy before production use.

How to use it

  1. Define the record shape

    Set the root type to object and describe the fields with properties, types, enums, and field descriptions.

  2. Provide source text

    Paste an order, email, form, or log into the input; describe only information that is evidenced by the source.

  3. Generate and review

    Confirm the endpoint is reachable, run the extraction, then review arguments, confidence, and reasoning. Manually verify low-confidence or missing fields.

Input and output example

The schema declares the fields to keep; Needle 2 maps the source text into that record instead of returning a chat answer.

Input text
Order A-1042 belongs to Li Ming, totals CNY 328, and is paid.
Structured result
{
  "order_id": "A-1042",
  "customer": "Li Ming",
  "total": 328,
  "status": "paid"
}

Supported range and limits

Request contract
POST to a compatible /complete endpoint with query and tools.
Tool shape
The page wraps the record schema as one tool named structured_data.
Result field
The structured data comes from function_calls[0].arguments.
Constraint method
Needle 2 uses a schema-compiled byte-level grammar to constrain tool calls.
Offline capability
The model can run on-device, but this page relies on the playground service you start for its default connection.
Security boundary
The connected service owns endpoint, CORS, authentication, and retention; this page does not replace server-side authorization.

When you would use it

  • Orders and receipts

    Extract IDs, totals, currencies, customers, and line items from support emails, receipts, or order descriptions for downstream workflows.

  • Forms and email archives

    Turn semi-structured registration, booking, or notification text into consistent records with less manual entry.

  • Device commands and routing

    Map natural-language device requests to constrained function arguments; add authorization and confirmation before executing actions.

What to know before you start

  • Needle 2 uses a single tool-call contract for extraction, not general chat; unmatched input may return an empty function_calls array.
  • Explicit schemas produce steadier results. Add field descriptions, enums, required fields, ranges, and array items where appropriate.
  • Confidence is a supporting signal, not proof of business correctness; retain the source and manually review money, identity, permission, and other high-risk fields.
  • The local playground defaults to 127.0.0.1:7860; browser requests across ports also need CORS response headers allowing the current origin.

Related concepts

function call
The selected tool and its parameter object; this page reads the structured result from the first call’s arguments.
confidence
A Needle 2 confidence signal that can help decide whether to accept the result or escalate to a stronger workflow.

Frequently asked questions

Why does this page need JSON Schema?
Needle 2 implements structured extraction as a single tool call. The schema defines the fields, types, and constraints, so the model fills arguments inside that shape.
Does the result upload data to ToolGarden?
It does not pass through a ToolGarden server; the browser requests the endpoint you provide directly. The default is local, but a remote endpoint receives the text, so check its privacy policy first.