Skip to content

Conversation

@dkalinowski
Copy link
Collaborator

@dkalinowski dkalinowski commented Oct 30, 2025

🛠 Summary

This change forgives model when [TOOL_CALL] is not generated (but expected), however (valid) generations starting with [{ will be treated as tools, which is incorrect

bfcl simple: 0.89->0.895
bfcl multiple: multiple 0.745->0.895

if (generatedTokens[0] != this->botTokenId && !immediateParsingEnabled) {
SPDLOG_LOGGER_DEBUG(llm_calculator_logger, "Begin of tools token has not been found in the model output. Exiting parser.");
return;
if (parsedOutput.content.size() >= 2 && parsedOutput.content[0] == '[' && parsedOutput.content[1] == '{') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't we rely on generatedTokens? We already base on checking it in condition above, so why not keep it continuous?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think its good idea, [{ is regular text (non special token)
Do you want me to handle all cases where:

  • [ and { are separate tokens? x, y
  • [{ is glued together into 1 token? x

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, in that case I think it's fine.

@dkalinowski dkalinowski merged commit eb84e11 into main Nov 3, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

4 participants