本文介绍: GPT3.5GPT4系列计算完整prompt token数的官方方法ChatGPT如何计算token数?
前言:
ChatGPT如何计算token数?https://wtl4it.blog.csdn.net/article/details/135116493?spm=1001.2014.3001.5502
https://wtl4it.blog.csdn.net/article/details/135116493?spm=1001.2014.3001.5502
GPT3.5GPT4系列计算完整prompt token数的官方方法:
How to count tokens with tiktoken | OpenAI CookbookOpen-source examples and guides for building with the OpenAI API. Browse a collection of snippets, advanced techniques and walkthroughs. Share your own examples and guides.https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktokenhttps://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb
https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb
计算的代码如下:
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。