Skip to content

Where does JsonSchema come from? #40

@jtmuller5

Description

@jtmuller5

The Dartantic AI docs show an example of generating a structured response using JsonSchema.create but it is not exported from dartantic_ai or dartantic_interface:

  // Use typed outputs
  final location = await agent.sendFor<TownAndCountry>(
    'The windy city in the US',
    outputSchema: JsonSchema.create({
      'type': 'object',
      'properties': {
        'town': {'type': 'string'},
        'country': {'type': 'string'},
      },
      'required': ['town', 'country'],
    }),
    outputFromJson: TownAndCountry.fromJson,
  );
  print('${location.output.town}, ${location.output.country}');
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions