agentscope icon indicating copy to clipboard operation
agentscope copied to clipboard

OpenAIChatModel use sequential_pipeline occurs “Error in block input ['response']”. But the DashScopeChatModel didn't have this question

Open Ironychen opened this issue 2 months ago • 7 comments

AgentScope is an open-source project. To involve a broader community, we recommend asking your questions in English.

Ironychen avatar Nov 10 '25 12:11 Ironychen

@qbc2016 Please check this issue

DavdGao avatar Nov 11 '25 07:11 DavdGao

Could you please provide more detailed information, such as the running code and detailed error messages? And this may potentially be an issue with the generate_response function. In our latest commit (#910), we refactored this function. Could you please pull the latest code and test again to see if the issue persists?

qbc2016 avatar Nov 11 '25 07:11 qbc2016

import os, asyncio

from agentscope.formatter import DashScopeMultiAgentFormatter, OpenAIMultiAgentFormatter, OpenAIChatFormatter from agentscope.message import Msg from agentscope.model import DashScopeChatModel, OpenAIChatModel from agentscope.agent import ReActAgent from agentscope.pipeline import MsgHub from agentscope.pipeline import sequential_pipeline,fanout_pipeline

def create_agent(name: str, age: int, career: str) -> ReActAgent: return ReActAgent( name=name, sys_prompt=f"you are {name},a {age} {career}", model=OpenAIChatModel( model_name="gpt-4o", api_key=os.environ["OPENAI_API_KEY"], ), formatter=OpenAIMultiAgentFormatter(), )

alice = create_agent("Alice", 30, "docotor") bob = create_agent("Bob", 35, "lawyer") charlie = create_agent("Charlie", 28, "software engineer") david = create_agent("David", 40, "teacher")

async def sequential_chat(): msg = Msg( "user", "talk about the importance of artificial intelligence in your profession.", "user" ) seqmsg = await sequential_pipeline( agents=[alice, bob, charlie, david], msg=msg )

asyncio.run(sequential_chat())

python pipeline1.py Charlie: Error in block input ['response'] Charlie: That's fascinating, Bob. It's clear that AI is significantly streamlining tasks across both healthcare and legal industries. For a software engineer like me, witnessing these technological integrations is gratifying, as it showcases the ... David: Error in block input ['response'] Your observations about AI streamlining tasks and enabling deeper insights in both healthcare and legal fields are spot on. In the legal field, ethical considerations are indeed significant when it comes to AI integration. ...

there have Charlie: Error in block input ['response']. I don't know what it means? But if I use DashScope there is no such question.

Ironychen avatar Nov 11 '25 08:11 Ironychen

Error: "Error in block input ['response']" comes from finish_function_pre_print_hook in _react_agent.py. This function, when processing finish_function (generate_response), assumes block["input"] is a dictionary and calls block["input"].get("response", ""). An exception is thrown when block["input"] is not a dictionary (such as a string or list).

Possible causes: Inconsistent JSON parsing results Both OpenAI and DashScope use _json_loads_with_repair() when parsing tool call arguments, but the JSON string returned by OpenAI may differ from the JSON returned by DashScope.

Solution: As I mentioned before, in our commit (#910), we refactored this function. Please pull the latest code and also update the json_repair version by running 'pip install --upgrade json_repair'. We previously found bugs in json_repair as well, reported them to the official team, and they have been fixed.

If the issue persists, please provide the AgentScope commit ID and json_repair version number so we can investigate further.

qbc2016 avatar Nov 12 '25 02:11 qbc2016

My agentscope is 1.0.6, json_repair is 0.53.0, also have this problem "Error in block input ['response']"

Ironychen avatar Nov 12 '25 03:11 Ironychen

The current main branch (including the aforementioned #910) has not yet been released as a new PyPI version. You can either install AgentScope through GitHub source code, or wait for our release of version 1.0.8 on PyPI (which should be released in the next few days).

qbc2016 avatar Nov 12 '25 03:11 qbc2016

Thanks, I solved problem.

Ironychen avatar Nov 12 '25 04:11 Ironychen

This issue is marked as stale because there has been no activity for 21 days. Remove stale label or add new comments or this issue will be closed in 3 day.

github-actions[bot] avatar Dec 03 '25 09:12 github-actions[bot]

Close this stale issue.

github-actions[bot] avatar Dec 07 '25 09:12 github-actions[bot]