Skip to content

Commit b756c3a

Browse files
zhangyingerjellytuhahaha
authored andcommitted
bugfix: set the thought_in_content parameter
1 parent 5b08a33 commit b756c3a

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

‎examples/assistant_qwq.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ def init_agent_service():
1414
'model': 'qwq-32b',
1515
'model_type': 'qwen_dashscope',
1616
'generate_cfg': {
17-
'fncall_prompt_type': 'nous'
17+
'fncall_prompt_type': 'nous',
18+
19+
# This parameter needs to be passed in when the deployed model is an reasoning model (e.g. qwq-32b) and *does not* support the reasoning_content field (e.g. deploying qwq-32b directly with an old version of vLLM)
20+
# Add: When the content is `<think>this is the thought</think>this is the answer`
21+
# Do not add: When the response has been separated by reasoning_content and content
22+
# This parameter will affect the parsing strategy of tool call
23+
# 'thought_in_content': True,
1824
},
1925
}
2026
tools = [

‎qwen_agent/llm/fncall_prompts/nous_fncall_prompt.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def postprocess_fncall_messages(
9191
) -> List[Message]:
9292
if function_choice != 'auto':
9393
raise NotImplementedError
94-
9594
# Convert plaintext responses to function_call responses:
9695
new_messages = []
9796
for msg in messages:

‎qwen_agent/llm/function_calling.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def _postprocess_messages(
6060
messages=messages,
6161
parallel_function_calls=generate_cfg.get('parallel_function_calls', False),
6262
function_choice=generate_cfg.get('function_choice', 'auto'),
63+
thought_in_content=generate_cfg.get('thought_in_content', False),
6364
)
6465
return messages
6566

0 commit comments

Comments
 (0)