Liking cljdoc? Tell your friends :D

bosquet.llm.openai-tokens

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
raw docstring

decodeclj

(decode tokens model)

Encode tokens using model

Encode `tokens` using `model`
raw docstring

encodeclj

(encode text model)

Encode text using model (:gpt-4, :gpt-3.5-turbo)

Encode `text` using `model` (:gpt-4, :gpt-3.5-turbo)
raw docstring

encodingclj

(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. 
raw docstring

fits-in-context-window?clj

(fits-in-context-window? token-count model)

price-estimateclj

(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
raw docstring

pricingclj

OAI 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
OAI 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
raw docstring

registryclj


token-countclj

(token-count text model)

Count tokens in the text using model for token production.

Count tokens in the `text` using `model` for token production. 
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close