Skip to content

Introduce GenAI parser adapter#4054

Draft
mzegla wants to merge 1 commit into
mainfrom
genai_parser_adapter
Draft

Introduce GenAI parser adapter#4054
mzegla wants to merge 1 commit into
mainfrom
genai_parser_adapter

Conversation

@mzegla
Copy link
Copy Markdown
Collaborator

@mzegla mzegla commented Mar 11, 2026

Added an adapter class to bridge OVMS output parsing machinery and GenAI parsers interface + Llama3 parser implementation via this adapter.

class Llama3OutputParserTest : public ::testing::Test {
// Parametrized fixture — runs every test with both "llama3" (native) and "llama3_genai" (adapter) parsers.
//
// Known behavioral differences between "llama3" and "llama3_genai":
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So we drop support for a case where model generates text and tools separated by <|python_tag|>?

abcd abcd <|python_tag|> tools...

Isnt it big issue?

incrementalParser(std::move(incrementalParser)) {}

// static
void GenAIParserAdapter::extractToolCalls(const ov::genai::JsonContainer& message, ToolCalls_t& toolCalls) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
void GenAIParserAdapter::extractToolCalls(const ov::genai::JsonContainer& message, ToolCalls_t& toolCalls) {
ToolCalls_t GenAIParserAdapter::extractToolCalls(const ov::genai::JsonContainer& message) {

Why not just work with return value?

if (fn.contains("name") && fn["name"].is_string()) {
toolCall.name = fn["name"].get_string();
}
if (fn.contains("arguments") && fn["arguments"].is_string()) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

plenty of checks do not return an error, but silently continue. is it good idea?

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.

2 participants