dart_json_schema_prompt 1.0.0
dart_json_schema_prompt: ^1.0.0 copied to clipboard
A powerful Dart package for creating structured prompts with JSON schema specifications and parsing AI responses into strongly-typed objects. Supports both single objects and arrays with validation.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.0 - 2024-10-15 #
Added #
- Initial release of dart_json_schema_prompt package
JsonSchemaPrompt
class for creating structured prompts with JSON schema specificationsJsonSchemaParser
class for parsing and validating JSON responsesPropertyBuilder
utility class for creating property definitions- Support for object, array, and primitive data types
- Schema validation with detailed error reporting
- JSON extraction from mixed text responses (handles AI responses with extra text)
- Comprehensive error handling with custom exception types
- Support for complex nested objects and arrays
- Built-in property constraints (min/max values, enum values, etc.)
- Zero external dependencies - pure Dart implementation
Features #
- Create prompts for single objects, arrays, or arrays of objects
- Automatic JSON schema generation from property definitions
- Validate JSON responses against defined schemas
- Extract clean JSON from AI responses that may contain additional text
- Support for required fields and optional properties
- Rich property types: string, number, integer, boolean, array, object
- Property constraints: minimum/maximum values, enum validation, format specification
- Comprehensive test coverage
- Detailed documentation and examples
Developer Experience #
- Simple, intuitive API design
- Extensive documentation with real-world examples
- Complete test coverage
- Ready for pub.flutter-io.cn publication
- Example integration with AI APIs (Google Gemini, OpenAI, etc.)