JTokkit wrapper to get encode/decode and get token counts. Plus a price estimator for model produced tokens
JTokkit wrapper to get encode/decode and get token counts. Plus a price estimator for model produced tokens
(encode text model)
Encode text
using model
(:gpt-4, :gpt-3.5-turbo)
Encode `text` using `model` (:gpt-4, :gpt-3.5-turbo)
(encoding model)
Get encoding by model name. Name is provided as keyword matching names specified in
If model name is not found it will throw NoSuchElementException
exception.
Get encoding by model name. Name is provided as keyword matching names specified in - https://platform.openai.com/docs/models/overview If model name is not found it will throw `NoSuchElementException` exception.
(fits-in-context-window? token-count model)
(price-estimate prompt model)
(price-estimate prompt completion model)
Estimate price for the prompt
and completion
using model
.
If prompt
and completion
are strings it will count tokens first.
If prompt
and completion
are numbers it will assume they are token counts
Estimate price for the `prompt` and `completion` using `model`. If `prompt` and `completion` are strings it will count tokens first. If `prompt` and `completion` are numbers it will assume they are token counts
OAI model prices (per 1k tokens) and token limits specified in a map:
input
price for the prompt tokensoutput
price for the completion tokenstokens
max context tokens the model supportsOAI model prices (per 1k tokens) and token limits specified in a map: - `input` price for the prompt tokens - `output` price for the completion tokens - `tokens` max context tokens the model supports
(token-count text model)
Count tokens in the text
using model
for token production.
Count tokens in the `text` using `model` for token production.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close