tiktoken-grpc
is a gRPC service that wraps the tiktoken
Python library offered by OpenAI.
This is most useful as a side car to integrate tiktoken
into non-Python based projects.
Prerequisite
You must have python 3.8+ setup, and poetry.
To run the grpc service locally, first clone this repository:
git clone https://github.com/yorinasub17/tiktoken-grpc.git
Then, install dependencies using poetry and start the serve with the serve
run task:
# Omit the --only flag if you also want to contribute code
poetry install --only main
# See --help for all the options
poetry run poe serve --no-tls
You should now be able to connect to the server using one of the supported clients below, on
localhost:50051
.
docker run --rm -p 50051:50051 yorinasub17/tiktoken-grpc:main
(Alternatively, you can use the image from ghcr - ghcr.io/yorinasub17/tiktoken-grpc:main
)
Thanks to the OpenAI team for providing the tiktoken encoding files and the tiktoken library.