Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Tiktoken Demo

This is a simple project that demostrates how to use tiktoken library in action for encoding and decoding text using OpenAI's tokenizer (e.g, gpt-3.5, gpt-4o, etc.)

This repo uses uv as package manager.

πŸ”§ Features

  • Uses model-specific tokenizer
  • Encode any string into OpenAI's tokens
  • Decode tokens back in readable text format

πŸ’» Requirements

  • Git
  • Python
  • UV Package manager

πŸš€ Setup with UV

  1. Clone the repository
git clone https://github.com/aayushgupta-dev/tokenizer.git
cd tokenizer
  1. Install dependencies
uv add --script .\tokenizer.py "tiktoken"
  1. Run the code using UV
uv run .\tokenizer.py

πŸ§ͺ Sample output

Text:  Hello, how are you today??
Encoded text:  [13225, 11, 1495, 553, 481, 4044, 6961]
Decoded text:  Hello, how are you today??

About

Demostrate the working of tiktoken library

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages