-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2024-02-02 20:12:37.871] [ERROR] [Server Error] {"title":"'messages' array must only contain objects with a 'content' field that is not empty"}[Bug]: #1521
Comments
For some reason on the second post, it's passing a second blank user content object: { I'm having the same issue trying to use AutoGen studio with a local LLM. |
Any solution found for the above problem? Thanks in advance. |
Bump^ but mine is slightly different. I am using a different model. openai.BadRequestError: Error code: 400 - {'error': "'messages' array must only contain objects with a 'content' field that is not empty."} |
Hi @dipteshbosedxc @shashank-indukuri , @SDShooter It looks like the error is due to the fact that What Causes Empty Messages in AutoGen studioIn the default workflow for autogen, where a userproxy and an assisstant solve a task, the userproxy typically only plays the role of executing any code generated by the assistant and is not configured with an llm. When no code is generated, its response empty. What Can Be DoneFrom the autogenstudio point of view there are two things we can do.
Currently, this field is not surfaced in the AutoGen studio UI and is something I can implement and provide an update here. Let me know what you find from trying the first method. |
Thanks, that is exactly what is going on. From a time perspective, being able to set a default response would be ideal, as making extra calls can take a while. Meanwhile, I've isolated the problem down to the llm not including the word TERMINATE at the end of the generated content, which triggers the full retry count and the empty content element that lmstudio fails on. Depending on the local model being used, I found that limiting the number of available skills to one allowed the 7b mistral instruct quantize level 6 model to properly follow this instruction from the default system message. |
I have the same issue thank you for the response |
See my comment below for a possible workaround. Basically limiting the agent to one skill can help smaller, less capable models follow the system prompt to end with TERMINATE. |
@victordibia : The first recommendation did not work. I get the same error even after assigning a model to userproxy. Note: This exact setup was working fine in the previous version of Autogen Studio. After I upgraded to the newer version of Autogen Studio. |
@victordibia thanks for the fix! Should help all of us using lmstudio when it's merged. |
…indows Testing ] (#1475) * support groupchat, other QOL fixes * remove gallery success toast * Fix #1328. Add CSVLoader component and related support for rendering CSV files. Add download link in the modal for appropriate file types including CSV, Code, and PDF. * add name and description field to session datamodel * Update website/blog/2023-12-01-AutoGenStudio/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * sanitize llmconfig, remove additional fields * improve models UX, only modify models from model tab. * readme updates * improve db defaults * improve ui hover behavior and add note on models * general qol updats * add support for returning summary_method * use ant design tables * icon and layout updates * css and layout updates * readme updates and QOL updates * fix bug where empty string is used as apikey #1415 * add speaker selection to UI #1373 * Fixed a bug that localAgent updates were not synchronized between GroupChatFlowSpecView and AgentFlowSpecView. * Fixed a bug in Agent Specification Modal that caused localAgent updates to remain in state when closing a modal other than onOk. * Fixed a bug that the updated Agent Specification Modal was not saved when the content of FlowConfigViewer Modal was changed after the Agent Specification Modal was updated when an updatedFlowConfig was created using localFlowConfig. * add version to package * remove sample key * early support for versions table and testing models * Add support for testing model when created #1404 * remove unused imports, qol updates * fix bug on workflowmanager * make file_name optional in skills datamodel * update instructions on models * fix errors from merge conflict with main * santize workflow before download * add support for editing skills in full fledged editor (monaco) #1442 * fix merge artifacts * Fix build command for windows Replaced && to & to continue execution when the 'ui' folder doesn't exist and also suppressed error "The system cannot find the file specified." * Fix setup instructions The config file starts with a dot (according to gatsby-config.ts). * Throw error if env file doesn't exist Otherwise the app will not work (issue very hard to trace) * version bump * formattin gupdates * formatting updates * Show warning instead of error if env config file doesn't exist Fix: #1475 (comment) * add rel noopener to a tags * formating updates * remove double section in readme. * update dev readme * format update * add default autoreply to agent config datamodel * add check for empty messages list * improve groupchat behavior, add sender to list of agents * update system_message defaults to fit autogen default system message #1474 * simplify response from test_model to only return content, fix serialization issue in #1404 * readme and other formatting updates * add support for showing temp and default auto reply #1521 * formatting updates * formating and other updates --------- Co-authored-by: Paul Retherford <paul@scanpower.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: junkei_okinawa <ceazy.x2.okinawan@gmail.com> Co-authored-by: Christopher Pereira <kripper@imatronix.com>
Continue to get the same error with LM Studio v0.2.14 (latest version). Is there a newer Autogen Studio that I need to install? |
i got the same error. Did anyone solve the issue? |
user = autogen.UserProxyAgent( |
Still it's not working. |
user = autogen.UserProxyAgent(
name="User",
human_input_mode="NEVER",
is_termination_msg=lambda x: x.get("content", "") and x.get("content", "").rstrip().endswith("TERMINATE"),
default_auto_reply="Reply 'TERMINATE' in the end when everything is done. ",
max_consecutive_auto_reply=5,
code_execution_config={
"work_dir": "tasks",
"use_docker": False,
}, # Please set use_docker=True if docker is available to run the generated code. Using docker is safer than running the generated code directly.
) In the example above, the default_auto_reply should be TERMINATE, not "Reply 'TERMINATE' in the end when everything is done. ". Next you should set the assistant is_termination_msg funtion to be
|
This is my code. In my case, when the assistant provides reply but then user proxy cannot initiate the chat. create an AssistantAgent named "assistant"assistant = autogen.AssistantAgent( create a UserProxyAgent instance named "user_proxy"user_proxy = autogen.UserProxyAgent( the assistant receives a message from the user_proxy, which contains the task descriptionuser_proxy.initiate_chat(
Please help me solve this query. |
Seeing this with current autogen and LMstudio 0.2.16. Setting default_auto_reply doesn't seem to help anything, it always gets an empty content field from the user role. Does anybody have a working solution?
|
I too tried with latest lm studio 0.2.16 and get this error consistently. Tried with both LLama and Gemma model so looks to be model independant. |
My LLM chat from autogen studio seems words by words
|
I have resolved my previous error (above) by reverting to an older version of Autogen Studio. As for the issue bug, I tried the solution as below:
With this update, we first check if system_message is not an empty string. If it's not, we assign system_message to content. If it is an empty string, we assign the string "empty" to content instead. This guarantees that the content field in self._oai_system_message will always have a non-empty value. Let me know if there are any questions or further issues. |
I just tested this for both Autogen Studio and Autogen (code) for version 0.2.20, and the response given by @victordibia is the correct response and the solution. There's really no change that's needed to the conversable_agent.py (this is optional). The reason is that you have to understand why the agent is sending the empty content. Using the "default_auto_reply" with a message like "am I still needed?" solves the issues and keeps the conversation flowing as expected. If you add "TERMINATE" in the auto reply it causes the agent to terminate the group chat and this could be done prematurely before the context of the PROBLEM is resolved or acknowledge by the roles. I hope this helps. There needs to be better clarity on the usage of the parameters. I would recommend closing it as both this and @victordibia response below as the answer. |
Hi, where should I insert this? |
…indows Testing ] (microsoft#1475) * support groupchat, other QOL fixes * remove gallery success toast * Fix microsoft#1328. Add CSVLoader component and related support for rendering CSV files. Add download link in the modal for appropriate file types including CSV, Code, and PDF. * add name and description field to session datamodel * Update website/blog/2023-12-01-AutoGenStudio/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * sanitize llmconfig, remove additional fields * improve models UX, only modify models from model tab. * readme updates * improve db defaults * improve ui hover behavior and add note on models * general qol updats * add support for returning summary_method * use ant design tables * icon and layout updates * css and layout updates * readme updates and QOL updates * fix bug where empty string is used as apikey microsoft#1415 * add speaker selection to UI microsoft#1373 * Fixed a bug that localAgent updates were not synchronized between GroupChatFlowSpecView and AgentFlowSpecView. * Fixed a bug in Agent Specification Modal that caused localAgent updates to remain in state when closing a modal other than onOk. * Fixed a bug that the updated Agent Specification Modal was not saved when the content of FlowConfigViewer Modal was changed after the Agent Specification Modal was updated when an updatedFlowConfig was created using localFlowConfig. * add version to package * remove sample key * early support for versions table and testing models * Add support for testing model when created microsoft#1404 * remove unused imports, qol updates * fix bug on workflowmanager * make file_name optional in skills datamodel * update instructions on models * fix errors from merge conflict with main * santize workflow before download * add support for editing skills in full fledged editor (monaco) microsoft#1442 * fix merge artifacts * Fix build command for windows Replaced && to & to continue execution when the 'ui' folder doesn't exist and also suppressed error "The system cannot find the file specified." * Fix setup instructions The config file starts with a dot (according to gatsby-config.ts). * Throw error if env file doesn't exist Otherwise the app will not work (issue very hard to trace) * version bump * formattin gupdates * formatting updates * Show warning instead of error if env config file doesn't exist Fix: microsoft#1475 (comment) * add rel noopener to a tags * formating updates * remove double section in readme. * update dev readme * format update * add default autoreply to agent config datamodel * add check for empty messages list * improve groupchat behavior, add sender to list of agents * update system_message defaults to fit autogen default system message microsoft#1474 * simplify response from test_model to only return content, fix serialization issue in microsoft#1404 * readme and other formatting updates * add support for showing temp and default auto reply microsoft#1521 * formatting updates * formating and other updates --------- Co-authored-by: Paul Retherford <paul@scanpower.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: junkei_okinawa <ceazy.x2.okinawan@gmail.com> Co-authored-by: Christopher Pereira <kripper@imatronix.com>
I am also observing this running autogen + local LMStudio server (model does not matter). autogen: 0.2.35
None of the listed workarounds work for me.
That does not solve the issue at all. |
Describe the bug
Autogen studio when using LM Studio Local LLM throws this error when trying to respond through the AutoGen UI
[2024-02-02 20:12:37.871] [ERROR] [Server Error] {"title":"'messages' array must only contain objects with a 'content' field that is not empty"}
Steps to reproduce
Expected Behavior
The JSON output should be displayed in the Autogen playground window.
Screenshots and logs
Additional Information
Autogen Studio Version: 0.0.42a
OS: Windows 11
Python: 3.11
Related Issues: None
JSON Response from LM Studio (Error Message is at the end of the text):
[2024-02-02 20:12:37.858] [INFO] [LM STUDIO SERVER] Processing queued request...
[2024-02-02 20:12:37.865] [INFO] Received POST request to /v1/chat/completions with body: {
"messages": [
{
"content": "You are a helpful AI assistant.\nSolve tasks using your coding and language skills.\nIn the following cases, suggest python code (in a python coding block) or shell script (in a sh coding block) for the user to execute.\n 1. When you need to collect info, use the code to output the info you need, for example, browse or search the web, download/read a file, print the content of a webpage or a file, get the current date/time, check the operating system. After sufficient info is printed and the task is ready to be solved based on your language skill, you can solve the task by yourself.\n 2. When you need to perform some task with code, use the code to perform the task and output the result. Finish the task smartly.\nSolve the task step by step if you need to. If a plan is not provided, explain your plan first. Be clear which step uses code, and which step uses your language skill.\nWhen using code, you must indicate the script type in the code block. The user cannot provide any other feedback or perform any other action beyond executing the code you suggest. The user can't modify your code. So do not suggest incomplete code which requires users to modify. Don't use a code block if it's not intended to be executed by the user.\nIf you want the user to save the code in a file before executing it, put # filename: inside the code block as the first line. Don't include multiple code blocks in one response. Do not ask users to copy and paste the result. Instead, use 'print' function for the output when relevant. Check the execution result returned by the user.\nIf the result indicates there is an error, fix the error and output the code again. Suggest the full code instead of partial code or code changes. If the error can't be fixed or if the task is not solved even after the code is executed successfully, analyze the problem, revisit your assumption, collect additional info you need, and think of a different approach to try.\nWhen you find an answer, verify the answer carefully. Include verifiable evidence in your response if possible.\nReply "TERMINATE" in the end when everything is done.\n \n\nYou are a helpful assistant that can use available functions when needed to solve problems. At each point, do your best to determine if the user's request has been addressed. IF THE REQUEST HAS NOT BEEN ADDRESSED, RESPOND WITH CODE TO ADDRESS IT. IF A FAILURE OCCURRED (e.g., due to a missing library) AND SOME ADDITIONAL CODE WAS WRITTEN (e.g. code to install the library), ENSURE THAT THE ORIGINAL CODE TO ADDRESS THE TASK STILL GETS EXECUTED. If the request HAS been addressed, respond with a summary of the result. The summary must be written as a coherent helpful response to the user request e.g. 'Sure, here is result to your request ' or 'The tallest mountain in Africa is ..' etc. The summary MUST end with the word TERMINATE. If the user request is pleasantry or greeting, you should respond with a pleasantry or greeting and TERMINATE.\n\n\n\nWhile solving the task you may use functions below which will be available in a file called skills.py .\nTo use a function skill.py in code, IMPORT THE FUNCTION FROM skills.py and then use the function.\nIf you need to install python packages, write shell code to\ninstall via pip and use --quiet option.\n\n \n\n##### Begin of find_papers_arxiv #####\n\nimport os\nimport re\nimport json\nimport hashlib\n\n\ndef search_arxiv(query, max_results=10):\n """\n Searches arXiv for the given query using the arXiv API, then returns the search results. This is a helper function. In most cases, callers will want to use 'find_relevant_papers( query, max_results )' instead.\n\n Args:\n query (str): The search query.\n max_results (int, optional): The maximum number of search results to return. Defaults to 10.\n\n Returns:\n jresults (list): A list of dictionaries. Each dictionary contains fields such as 'title', 'authors', 'summary', and 'pdf_url'\n\n Example:\n >>> results = search_arxiv("attention is all you need")\n >>> print(results)\n """\n\n import arxiv\n\n key = hashlib.md5(("search_arxiv(" + str(max_results) + ")" + query).encode("utf-8")).hexdigest()\n # Create the cache if it doesn't exist\n cache_dir = ".cache"\n if not os.path.isdir(cache_dir):\n os.mkdir(cache_dir)\n\n fname = os.path.join(cache_dir, key + ".cache")\n\n # Cache hit\n if os.path.isfile(fname):\n fh = open(fname, "r", encoding="utf-8")\n data = json.loads(fh.read())\n fh.close()\n return data\n\n # Normalize the query, removing operator keywords\n query = re.sub(r"[^\\s\\w]", " ", query.lower())\n query = re.sub(r"\s(and|or|not)\s", " ", " " + query + " ")\n query = re.sub(r"[^\\s\\w]", " ", query.lower())\n query = re.sub(r"\s+", " ", query).strip()\n\n search = arxiv.Search(query=query, max_results=max_results, sort_by=arxiv.SortCriterion.Relevance)\n\n jresults = list()\n for result in search.results():\n r = dict()\n r["entry_id"] = result.entry_id\n r["updated"] = str(result.updated)\n r["published"] = str(result.published)\n r["title"] = result.title\n r["authors"] = [str(a) for a in result.authors]\n r["summary"] = result.summary\n r["comment"] = result.comment\n r["journal_ref"] = result.journal_ref\n r["doi"] = result.doi\n r["primary_category"] = result.primary_category\n r["categories"] = result.categories\n r["links"] = [str(link) for link in result.links]\n r["pdf_url"] = result.pdf_url\n jresults.append(r)\n\n if len(jresults) > max_results:\n jresults = jresults[0:max_results]\n\n # Save to cache\n fh = open(fname, "w")\n fh.write(json.dumps(jresults))\n fh.close()\n return jresults\n\n\n#### End of find_papers_arxiv ####\n\n ",
"role": "system"
},
{
"content": "Provide 2 research paper on Quantum vibrations. Just the link will suffice",
"role": "user"
},
{
"content": "\n1. "Quantum Vibrations in Nanostructures: A Review" by J.A.R. Braga, et al. - This review article provides an overview of quantum vibrations in nanostructures, including their properties, applications, and future directions. It covers topics such as plasmonics, photonics, and acoustics, and discusses the role of quantum vibrations in controlling and manipulating light and sound at the nanoscale.\n\n2. "Quantum Vibrations in Nanostructures: A Theoretical Perspective" by S.K. Singh, et al. - This article provides a theoretical perspective on quantum vibrations in nanostructures, including their properties, dynamics, and applications. It covers topics such as the quantum nature of vibrations, the role of confinement in controlling vibrational modes, and the use of quantum vibrations for sensing and communication.\n\nBoth papers provide valuable insights into the field of quantum vibrations in nanostructures and can be a good starting point for further research on this topic. \n\n",
"role": "assistant"
},
{
"content": "",
"role": "user"
}
],
"model": "llama-2-7b-32k-instruct",
"stream": false,
"temperature": 0
}
[2024-02-02 20:12:37.871] [ERROR] [Server Error] {"title":"'messages' array must only contain objects with a 'content' field that is not empty"}
The text was updated successfully, but these errors were encountered: