akashi_gen 0.3.0 copy "akashi_gen: ^0.3.0" to clipboard
akashi_gen: ^0.3.0 copied to clipboard

Optional build_runner codegen for Akashi tool input schemas: emits the same Schema<T> as the runtime builder from annotated classes, so the two are drop-in interchangeable.

akashi_gen #

Optional build_runner codegen for Akashi tool input schemas. Annotate a class with @toolInput and it emits a Schema<T> identical to the one the runtime builder produces — so generated and hand-written schemas are drop-in interchangeable. The akashi core never depends on this package.

import 'package:akashi/akashi.dart';
import 'package:akashi_gen/akashi_gen.dart';

part 'weather_query.g.dart';

@toolInput
class WeatherQuery {
  WeatherQuery({required this.city, required this.units});

  final String city;

  @SchemaField(
    description: 'metric or imperial',
    enumValues: ['metric', 'imperial'],
  )
  final String units;
}

// `dart run build_runner build` generates `$weatherQuerySchema`, a plain
// `Schema<WeatherQuery>` — pass it to a tool's `inputSchema` or `generateObject`.

Supports String / int / double / bool / List fields, string enums, and @SchemaField descriptions; required is inferred from non-nullable fields.

See example/weather_query.dart (and the committed .g.dart) for the full round-trip.

Status #

v0.3.

License #

MIT.

0
likes
140
points
29
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Optional build_runner codegen for Akashi tool input schemas: emits the same Schema<T> as the runtime builder from annotated classes, so the two are drop-in interchangeable.

Repository (GitHub)
View/report issues

Topics

#ai #agents #codegen #build-runner

License

MIT (license)

Dependencies

akashi, analyzer, build, source_gen

More

Packages that depend on akashi_gen