Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
36da321b
Commit
36da321b
authored
Mar 16, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix QwenParser to handle <tool=func_name> format
parent
886b4c2d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
model_parser.py
codai/model_parser.py
+18
-0
No files found.
codai/model_parser.py
View file @
36da321b
...
@@ -113,15 +113,33 @@ class QwenParser(BaseParser):
...
@@ -113,15 +113,33 @@ class QwenParser(BaseParser):
continue
continue
# CODER STYLE: <tool_call><function=name><parameter=key>value</parameter></function></tool_call>
# CODER STYLE: <tool_call><function=name><parameter=key>value</parameter></function></tool_call>
# Also handle: <tool=func_name><parameter=key>value</parameter></tool_call>
if
not
results
:
if
not
results
:
# Try with <tool_call> wrapper first
coder_blocks
=
re
.
findall
(
r'<tool_call>\s*(.*?)\s*</tool_call>'
,
clean_text
,
re
.
DOTALL
)
coder_blocks
=
re
.
findall
(
r'<tool_call>\s*(.*?)\s*</tool_call>'
,
clean_text
,
re
.
DOTALL
)
if
not
coder_blocks
:
if
not
coder_blocks
:
# Try direct <tool=func_name> format
coder_blocks
=
re
.
findall
(
r'(<tool=[^>]+>.*?</tool>)'
,
clean_text
,
re
.
DOTALL
)
if
not
coder_blocks
:
# Try <function=func_name> format without wrapper
coder_blocks
=
re
.
findall
(
r'(<function=.*?</function>)'
,
clean_text
,
re
.
DOTALL
)
coder_blocks
=
re
.
findall
(
r'(<function=.*?</function>)'
,
clean_text
,
re
.
DOTALL
)
for
block
in
coder_blocks
:
for
block
in
coder_blocks
:
# Try to extract function name from different formats
func_name
=
None
# Format 1: <function=name>...</function>
func_name_match
=
re
.
search
(
r'<function=([^>]+)>'
,
block
)
func_name_match
=
re
.
search
(
r'<function=([^>]+)>'
,
block
)
if
func_name_match
:
if
func_name_match
:
func_name
=
func_name_match
.
group
(
1
)
.
strip
()
func_name
=
func_name_match
.
group
(
1
)
.
strip
()
# Format 2: <tool=name>...</tool>
if
not
func_name
:
func_name_match
=
re
.
search
(
r'<tool=([^>]+)>'
,
block
)
if
func_name_match
:
func_name
=
func_name_match
.
group
(
1
)
.
strip
()
if
func_name
:
params
=
re
.
findall
(
r'<parameter=([^>]+)>(.*?)</parameter>'
,
block
,
re
.
DOTALL
)
params
=
re
.
findall
(
r'<parameter=([^>]+)>(.*?)</parameter>'
,
block
,
re
.
DOTALL
)
arguments
=
{}
arguments
=
{}
for
k
,
v
in
params
:
for
k
,
v
in
params
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment