Skip to content

Add function calling token counting#83

Merged
niieani merged 4 commits into
mainfrom
codex/implement-token-counting-with-api
Nov 7, 2025
Merged

Add function calling token counting#83
niieani merged 4 commits into
mainfrom
codex/implement-token-counting-with-api

Conversation

@niieani

@niieani niieani commented Nov 7, 2025

Copy link
Copy Markdown
Owner

fixes #21

Summary

  • add a function-calling aware token counting API to GptEncoding
  • introduce shared fixtures and a regression test suite that covers OpenAI function request shapes
  • expose encodeChatCompletionTokens only on function-calling model entrypoints via the code generator
  • extract the function calling token counting helpers and fixtures into dedicated modules with named token constants

Testing

  • yarn test:code --run

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/codegen/generateByModel.ts
@niieani niieani merged commit 7f880f4 into main Nov 7, 2025
5 checks passed
@github-actions

github-actions Bot commented Nov 7, 2025

Copy link
Copy Markdown

🎉 This PR is included in version 3.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support function calls?

1 participant