there is some errors. when use chat_history with image_url (AgentExecutor with tools) #22193
Replies: 2 comments
-
Hey there, @chanyong-owl! I'm here to help you out with any bugs, questions, or contributions you have in mind. Let's dig into this issue together and figure out a solution. The error you're encountering is due to the presence of unsupported roles in the To resolve this issue, ensure that your chat_historys = [
SystemMessage(content='You are a helpful assistant.'),
HumanMessage(content=[{'type': 'image_url', 'image_url': {'url': '*****'}}, {'type': 'text', 'text': 'who is he'}]),
HumanMessage(content='what is phone number')
]
agent = create_openai_functions_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
response = agent_executor.invoke({
"input": params.input,
"chat_history": chat_historys
}) Make sure that all messages in
|
Beta Was this translation helpful? Give feedback.
-
This is still an issue. Any time a function message is in history and an image is included in the user message, this error pops up. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
my chat history is like [chat_historys]. it's comibined common text, and image_url. If there is only common text without image_url, it's always ok.
when there is message historys with image_url, and common msg, and then if i ask about some question that dosen't use tools like qustion "who are you", there is no error.
when there is message historys with image_url, and common msg, and then if i ask about some question that use tools like qustion "how is the weather", there is error.
the error is like below.
Error code: 400 - {'error': {'code': 'BadRequest', 'message': "'function' is not an allowed role. The allowed roles are ['system', 'user', 'assistant'].", 'param': None, 'type': None}}
is there anyone who has experience like that?
Help me T.T
System Info
nothing
Beta Was this translation helpful? Give feedback.
All reactions