instructor_dart 0.3.0
instructor_dart: ^0.3.0 copied to clipboard
Typed, validated structured outputs from LLMs. Build a JSON Schema in plain Dart, with validation and repair retries. Adapters for OpenAI, Anthropic and Gemini.
0.3.0 #
- Normalize numeric fields to the Dart type their schema promises instead of
coercing every integral double to
int. Anumberfield given a whole value like42now decodes to adouble(42.0), sojson['price'] as doubleinfromJsonno longer throws after validation reported success; anintegerfield still arrives asint. AddsSchema.normalize, called after validation to do this per node type.
0.2.3 #
- Shorten the screenshot description. pub.dev accepts up to 200 characters but scores only those under 160, so the previous release published cleanly and quietly gave up the documentation points it was meant to earn.
0.2.2 #
- Declare the diagram in
pubspec.yamlso pub.dev renders it on the package page. It was already in the repository and the README, but pub.dev shows only what thescreenshots:field points at.
0.2.1 #
- Shorten the pub.dev description back under the 180-character limit. The previous release grew it past that, which costs the "valid pubspec" points and truncates the text search engines show.
0.2.0 #
- Add
GeminiAdapterfor the Gemini API'sgenerateContent, completing the three major providers. The schema is sent as a function declaration and forced withfunctionCallingConfig.mode: "ANY". Two Gemini-specific shapes are handled:contentsonly accepts theuserandmodelroles, so an assistant message is sent asmodel, and system text goes in the top-levelsystemInstructionrather than being a message. The API key is sent in thex-goog-api-keyheader instead of thekeyquery parameter, so it stays out of URLs and logs.
0.1.2 #
- Docs: tightened the README wording and visuals.
0.1.1 #
- Expand the package description to name what the package does in the words people search for. No code changes.
0.1.0 #
Initial release.
- Plain-Dart schema builder rendering to JSON Schema: objects, strings, integers, numbers, booleans, enums, lists, nesting, optional properties, length/range/pattern constraints.
- Local validation with JSONPath-style violation reporting.
Instructor.extract/extractRawwith an automatic repair loop that feeds validation errors back to the model.OpenAIAdapterfor OpenAI and OpenAI-compatible servers (Ollama, LM Studio, vLLM, OpenRouter), using forced tool calls.AnthropicAdapterfor the Anthropic Messages API, using forced tool use.ExtractionExceptionwith full attempt history.
