Skip to content

Gigachat 3 tool parser and tests#17924

Closed
Mishusha wants to merge 7 commits intoggml-org:masterfrom
Mishusha:feature/gigachat_v3_tool_parser
Closed

Gigachat 3 tool parser and tests#17924
Mishusha wants to merge 7 commits intoggml-org:masterfrom
Mishusha:feature/gigachat_v3_tool_parser

Conversation

@Mishusha
Copy link
Contributor

This PR adds a tool parser for parsing the function calls made by the Gigachat 3 models.
Models can generate only one function call using format:

{text}<|message_sep|>\n\nfunction call<|role_sep|>\n{json}
Where <|message_sep|>\n\n and <|role_sep|>\n are special tokens.

@aldehir
Copy link
Collaborator

aldehir commented Dec 12, 2025

We should start transitioning to the PEG parser approach. This one looks very similar to the new mistral-3 series, there is already a parser out there to reference. The difference is you'll need to match the name within the JSON instead of outside of it, but it should be easy with the schema(), json() and json_member() helpers.

Copy link
Contributor

@pwilkin pwilkin left a comment

Choose a reason for hiding this comment

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

Like @aldehir mentioned, please use the PEG parser for the implementation, we are phasing out the old parser. If you need an example, check out the Ministral 3 template.

@Mishusha
Copy link
Contributor Author

Got it, thanks, I took it to work)

@Mishusha Mishusha force-pushed the feature/gigachat_v3_tool_parser branch from 3a451fc to 37fa336 Compare December 27, 2025 15:20
@Mishusha
Copy link
Contributor Author

Rebased onto latest master
Reimplemented the parser in PEG format

@vanbukin
Copy link

vanbukin commented Feb 2, 2026

Any updates?

Copy link
Contributor

@pwilkin pwilkin left a comment

Choose a reason for hiding this comment

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

Okay, think this should be fine.

@pwilkin
Copy link
Contributor

pwilkin commented Feb 2, 2026

Running CI after rebasing on master and will merge if it's OK.

@Mishusha
Copy link
Contributor Author

Mishusha commented Feb 2, 2026

Okay, think this should be fine.

Sorry, but model has "<|role_sep|>\n" and "<|message_sep|>\n\n" as tokens -> so newlines are the part of these special tokens

Is there still need to remove \n here?

@pwilkin
Copy link
Contributor

pwilkin commented Feb 2, 2026

Oh wow. Okay, nevermind, you're right. Those are some crazy tokens :)

Yeah, that has to be reverted. Can you please fix the merge as well? I think I might've messed up something, can't really check now.

@Mishusha Mishusha force-pushed the feature/gigachat_v3_tool_parser branch from 4dac5ba to 6659614 Compare February 20, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants