cequence-io / openai-scala-client

Scala client for OpenAI API
MIT License
191 stars 20 forks source link

Missing ability to count tokens before sending a query #40

Closed piotrkuczko closed 11 months ago

piotrkuczko commented 1 year ago

Is it possible to add a functionality to this library that counts tokens prior to sending a query to ChatGPT? It would be beneficial to have such a feature, as it could allow the correct model - either gpt-3.5-turbo or gpt-3.5-turbo-16k - to be set before submitting the request. This can be achieved using the JTokkit library. An example of this implementation can be found here.

peterbanda commented 1 year ago

Hey @piotrkuczko , Thanx for the suggestion. The lib looks solid. Will add it to my list.

piotrkuczko commented 1 year ago

PR -> https://github.com/cequence-io/openai-scala-client/pull/43