openai-cookbook
openai-cookbook copied to clipboard
[FEATURE] Update token counting example to include function calling feature
The new function calling API is neat, but there's no docs anywhere I can find which tell you how many tokens your functions will cost. Can you update the sample notebook to account for provided functions?
Agree it would be a nice feature. Not sure if I'll have time soon, unfortunately.
If you can give a rough description of how it works I can try to put together a PR following that description, if that would be useful.
After some testing it looks close to the token count of json-encoded function definition, but would be great to know the official answer, to make it possible to adjust the input text so that it fits within the context.
@lopuhin is that json-encoded without any indentation? I.e. json.dumps(value)
as opposed to e.g. json.dumps(value, indent=2)
@adri1wald yes I meant just json.dumps(value)
FYI @CGamesPlay did great job reverse engeneering it here
+1. Also waiting for an official implementation.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.
This issue was closed because it has been stalled for 10 days with no activity.