Skip to content

Commit

Permalink
bugfix response formatter for qwen-vl-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
JianxinMa committed Apr 17, 2024
1 parent 8d0a539 commit 00e1733
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions qwen_agent/llm/qwenvl_dashscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ def _extract_vl_response(response) -> List[Message]:
output = response.output.choices[0].message
text_content = []
for item in output.content:
for k, v in item.items():
if k in ('text', 'box'):
text_content.append(ContentItem(text=v))
if isinstance(item, str):
text_content.append(ContentItem(text=item))
else:
for k, v in item.items():
if k in ('text', 'box'):
text_content.append(ContentItem(text=v))
return [Message(role=output.role, content=text_content)]

0 comments on commit 00e1733

Please sign in to comment.