FLUTTER ECOSYSTEM

tiktoken

Tiktoken is a BPE tokeniser for use with OpenAI's models. It exposes APIs used for processing text using tokens.

Latest version
1.0.3
30-day downloads
591
Likes
22
Pub points
160

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Overview

Tiktoken is a BPE (Byte Pair Encoding) tokenizer designed for OpenAI's language models, enabling efficient text processing by converting raw text into tokens. It provides APIs to calculate token counts and manage text segmentation, crucial for optimizing input length in LLM interactions. The package supports multiple platforms including Android, iOS, Web, macOS, Windows, and Linux, making it suitable for cross-platform applications that integrate with OpenAI models. Built with Dart, it ensures consistent tokenization across environments.

Use cases
  • Text length estimation for LLM prompts
  • Token-aware text truncation
  • Integration with OpenAI API clients
  • Cross-platform AI applications
  • Prompt engineering and optimization
Key features
  • BPE-based tokenization
  • Platform-agnostic implementation
  • Support for OpenAI model tokenizers
  • Accurate token counting
  • Lightweight and fast
Suitable for
  • Developers building AI-powered apps
  • Applications requiring prompt management
  • Projects using OpenAI models on multiple platforms
  • Users needing precise token control
Considerations
  • Requires understanding of tokenization concepts
  • Depends on OpenAI model-specific vocabularies
  • Not suitable for non-OpenAI models
  • Limited to text preprocessing tasks
  • May require updates when new models are released
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add tiktoken

Categories

Source repository

Related projects