← AI GitHub

AI GitHub

Jsonformer for schema-shaped local extraction

Generate the variable parts of a JSON document while code supplies the fixed syntax.

Language ModelsPublished 2 min read

Key Takeaways

  • Jsonformer fills in structural characters itself and asks a compatible Transformers model to generate field values.
  • Use a compatible local model and confirm your schema fits the library's supported subset.
  • Try a small schema with a string and a number.
  • The project implements a subset of JSON Schema.

How it works

Jsonformer fills in structural characters itself and asks a compatible Transformers model to generate field values. Its schema support defines the kinds of JSON it can assemble.

What you need

Use a compatible local model and confirm your schema fits the library's supported subset. Its structural generation approach is easiest to inspect with only a few fields.

What to try first

Try a small schema with a string and a number. Compare results against a prompt that asks the same model to produce the entire JSON document, including examples where a field has no evidence.

Try a field for which the input contains no evidence and a field with two plausible values. Decide how the schema should represent uncertainty before adjusting sampling.

Where to look for failures

The project implements a subset of JSON Schema. Check support for your field types and constraints before using it with a large schema, and validate semantics separately.

Related Franklin pages

These approaches control generation at different points. Run the same nested schema and check compatibility with the model backend before comparing speed or accepted outputs.

For the distinction between requesting structured output and enforcing its format, see Franklin’s glossary. Structured output

Project documentation

Try it for your workflow

Explore the project’s documentation for setup and usage, or save this page to a collection for later.

Read the project documentation ↗