genai_primitives 0.2.2 copy "genai_primitives: ^0.2.2" to clipboard
genai_primitives: ^0.2.2 copied to clipboard

A set of primitives for working with generative AI.

genai_primitives #

This package provides a set of technology-agnostic primitive types and data structures for building Generative AI applications in Dart.

It includes core definitions such as ChatMessage, Parts, ToolDefinition and other foundational classes that are used across the genai ecosystem to ensure consistency and interoperability between different AI providers.

Core Types #

  • Part: Base type for message parts. Extend this to define custom part types.

  • Parts: A collection of Part instances with utility methods.

  • StandardPart: Sealed class extending Part with a fixed set of implementations. Used by ChatMessage for cross-provider compatibility.

  • ChatMessage: Represents a chat message compatible with most GenAI providers.

  • ToolDefinition: Defines a tool that can be invoked by an LLM.

Aliasing #

If you need to resolve name conflicts with other packages, alias the package as genai:

import 'package:genai_primitives/genai_primitives.dart' as genai;
1
likes
160
points
897
downloads

Publisher

verified publisherlabs.flutter.dev

Weekly Downloads

A set of primitives for working with generative AI.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

collection, cross_file, json_schema_builder, meta, mime, path

More

Packages that depend on genai_primitives