Skip to content

Fix LongCat tool call parsing for tool_choice='auto'#1

Open
fstandhartinger wants to merge 1 commit intochutesai:chutesfrom
fstandhartinger:fix-tool-index
Open

Fix LongCat tool call parsing for tool_choice='auto'#1
fstandhartinger wants to merge 1 commit intochutesai:chutesfrom
fstandhartinger:fix-tool-index

Conversation

@fstandhartinger
Copy link

Problem

LongCat models were not properly constrained for tool calls when tool_choice='auto' (default), only working with tool_choice='required'. This caused tool calls to be generated but not parsed correctly.

Solution

Modified the constraint logic in function_call_parser.py to ensure LongCat models get EBNF constraints even for tool_choice='auto', eliminating the need to manually set tool_choice='required'.

Changes

  • Added self.tool_call_parser instance variable to track parser type
  • Modified get_structure_constraint() to include LongCat + 'auto' in EBNF eligibility
  • Updated type annotations to accept 'auto' in get_ebnf() method

Testing

The fix ensures LongCat models work correctly with default settings.

LongCat models were not properly constrained for tool calls when
tool_choice='auto' (default), only working with tool_choice='required'.
This caused tool calls to be generated but not parsed correctly.

The fix ensures LongCat models get EBNF constraints even for 'auto' mode,
eliminating the need to manually set tool_choice='required'.
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.

1 participant

Comments