dartantic_ai 0.9.3 copy "dartantic_ai: ^0.9.3" to clipboard
dartantic_ai: ^0.9.3 copied to clipboard

A Dart library for easily interacting with LLMs in a typed manner.

Welcome to Dartantic! #

The dartantic_ai package provides an agent framework inspired by pydantic-ai and designed to make building client and server-side apps in Dart with generative AI easier and more fun!

🎯 Goals #

  • πŸ€– Agentic behavior with multi-step tool calling: Let your AI agents autonomously chain tool calls together to solve complex problems without human intervention.
  • Multi-Provider Support: Work seamlessly with OpenAI, Google Gemini, OpenRouter, and more
  • Type Safety: Leverage Dart's strong typing with automatic JSON schema generation
  • Developer Experience: Simple, intuitive APIs that feel natural in Dart
  • Production Ready: Built-in logging, error handling, and provider capabilities detection
  • Extensible: Easy to add custom providers and tools

πŸš€ Quick Start #

import 'package:dartantic_ai/dartantic_ai.dart';

void main() async {
  // Create an agent with your preferred provider
  final agent = Agent(
    'openai',  // or 'gemini', 'openrouter', etc.
    systemPrompt: 'You are a helpful assistant.',
  );

  // Generate text
  final result = await agent.run('Explain quantum computing in simple terms');
  print(result.output);

  // Use typed outputs
  final location = await agent.runFor<TownAndCountry>(
    'The windy city in the US',
    outputSchema: TownAndCountry.schemaMap.toSchema(),
    outputFromJson: TownAndCountry.fromJson,
  );
  print('${location.output.town}, ${location.output.country}');
}

✨ Key Features #

  • πŸ”„ Streaming Output - Real-time response generation
  • πŸ› οΈ Typed Tool Calling - Type-safe function definitions and execution
  • πŸ“Ž Multi-media Input - Process text, images, and files
  • 🧠 Embeddings - Vector generation and semantic search
  • πŸ”Œ MCP Support - Model Context Protocol server integration
  • πŸŽ›οΈ Provider Switching - Seamlessly switch between AI providers mid-conversation

πŸ“– Documentation #

πŸ‘‰ Read the full documentation

The documentation includes:

  • Getting Started Guide - Installation and basic usage
  • Core Features - JSON output, typed responses, and DotPrompt support
  • Advanced Features - Tool calling, agentic behavior, streaming, and embeddings
  • Integration - Logging, model discovery, MCP servers, and custom providers

πŸ“¦ Installation #

Add to your pubspec.yaml:

dependencies:
  dartantic_ai: ^latest_version

Then run:

dart pub get

🀝 Contributing & Community #

We welcome contributions! Feature requests, bug reports and PRs are welcome on the dartantic_ai github site.

Want to chat about Dartantic? Then drop by the Discussions forum.

πŸ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.


Built with ❀️ for the Dart & Flutter community

34
likes
0
points
628
downloads

Publisher

verified publishersellsbrothers.com

Weekly Downloads

A Dart library for easily interacting with LLMs in a typed manner.

Repository (GitHub)
View/report issues

Topics

#ai #chat #llms

License

unknown (license)

Dependencies

dotprompt_dart, google_generative_ai, http, json_schema, logging, mcp_dart, mime, openai_dart, uuid

More

Packages that depend on dartantic_ai