Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support function calls? #21

Open
seoker opened this issue Jun 29, 2023 · 2 comments
Open

Support function calls? #21

seoker opened this issue Jun 29, 2023 · 2 comments

Comments

@seoker
Copy link

seoker commented Jun 29, 2023

As you may know, function calls are now supported by OpenAI, and the function call tokens will be taken into account.
With some googling, I found the calculation here.

It will be great if the library could also calculate the required tokens when using with function calls. 🙏🏼

@chuanqisun
Copy link

chuanqisun commented Jul 24, 2023

One related issue is the type signature of ChatMessage. Depending on whether there is functional calling, the ChatMessage may have either the content field or the function_call field, but not both. The current typing in gpt-tokenizer/src/GptEncoding.ts will need an update.

@NatoBoram
Copy link

I saw that https://github.com/hmarr/openai-chat-tokens already does it - would it be fine to import that package here to provide that functionality?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants