genai_primitives 0.2.2
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 ofPartinstances with utility methods. -
StandardPart: Sealed class extendingPartwith a fixed set of implementations. Used byChatMessagefor 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;