mirror of
https://github.com/Paillat-dev/FABLE.git
synced 2026-01-02 01:06:20 +00:00
docs(tokens.py): add docstring explaining the purpose of the file and its reference
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
'''
|
||||||
|
This file's purpose is to count the number of tokens used by a list of messages.
|
||||||
|
It is used to check if the token limit of the model is reached.
|
||||||
|
|
||||||
|
Reference: https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb
|
||||||
|
'''
|
||||||
|
|
||||||
import tiktoken
|
import tiktoken
|
||||||
|
|
||||||
async def num_tokens_from_messages(messages, model="gpt-3.5-turbo"):
|
async def num_tokens_from_messages(messages, model="gpt-3.5-turbo"):
|
||||||
|
|||||||
Reference in New Issue
Block a user