yorinasub17 / tiktoken-grpc

tiktoken-grpc is a gRPC service that wraps the tiktoken Python library offered by OpenAI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tiktoken-grpc

LICENSE main branch CI main branch CircleCI latest release

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.

Quickstart

Local

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

docker run --rm -p 50051:50051 yorinasub17/tiktoken-grpc:main

(Alternatively, you can use the image from ghcr - ghcr.io/yorinasub17/tiktoken-grpc:main)

Client Libraries

Acknowledgements

Thanks to the OpenAI team for providing the tiktoken encoding files and the tiktoken library.

About

tiktoken-grpc is a gRPC service that wraps the tiktoken Python library offered by OpenAI.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 89.4%Language:Dockerfile 10.6%