You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the error is:
agents.models.openai_chatcompletions.py:463
It raise error: UserError: Unexpected role in easy_input_message: assistant
how to input the history messages?
this is my test code.
fromagentsimportAgent, Runner, OpenAIChatCompletionsModel,ModelSettingsimportasynciofromopenaiimportAsyncOpenAIfromagentsimportset_default_openai_clientexternal_client=AsyncOpenAI(
api_key="",
base_url="openai.com",
)
set_default_openai_client(external_client)
spanish_agent=Agent(
name="Spanish agent",
instructions="You only speak English.",
model=OpenAIChatCompletionsModel(
model="gpt-4o-mini",
openai_client=external_client,
),
model_settings=ModelSettings(temperature=0.5),
)
english_agent=Agent(
name="English agent",
instructions="You only speak Chinese",
model=OpenAIChatCompletionsModel(
model="gpt-4o-mini",
openai_client=external_client,
),
model_settings=ModelSettings(temperature=0.15),
)
triage_agent=Agent(
name="Triage agent",
instructions="Handoff to the appropriate agent based on the language of the request.",
handoffs=[spanish_agent, english_agent],
model=OpenAIChatCompletionsModel(
model="gpt-4o-mini",
openai_client=external_client,
),
)
asyncdefmain():
result=awaitRunner.run(triage_agent, input=[{"role":"user","content":"what is your name?"},
{"role":"assistant","content":"I'm Moses,how about you?"},
{"role":"user","content":"What questions did I just ask? "}])
print(result.final_output)
awaitmain()
The text was updated successfully, but these errors were encountered:
Was hoping you could use the previous_response_id provided by the Responses API to handle the chat history, but the only reference to it anywhere in this repo is issue #51.
Question
the error is:
agents.models.openai_chatcompletions.py:463
It raise error: UserError: Unexpected role in easy_input_message: assistant
how to input the history messages?
this is my test code.
The text was updated successfully, but these errors were encountered: