microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
33.25k stars 4.82k forks source link

[Bug]: Unable to create new agent - Error occurred while creating agent: table agents has no column named description #1976

Closed enact-on closed 8 months ago

enact-on commented 8 months ago

Describe the bug

Error occurred while creating agent: table agents has no column named description

I receive this error when i create new agent.

Steps to reproduce

Step 1: Install autogen studio

Step 2 : Create an agent

Model Used

N/A

Expected Behavior

Agent should be created

Screenshots and logs

VPMK16cISG

API Endpoint - http://127.0.0.1:8088/api/agents

Payload -

{"user_id":"guestuser@gmail.com","agent":{"type":"assistant","config":{"name":"primary_assistant_copy_copy","llm_config":{"config_list":[{"model":"gpt-4-1106-preview"}],"temperature":0.1,"cache_seed":null,"timeout":600},"human_input_mode":"NEVER","max_consecutive_auto_reply":8,"system_message":"You are a helpful AI assistant. Solve tasks using your coding and language skills. In the following cases, suggest python code (in a python coding block) or shell script (in a sh coding block) for the user to execute. 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. 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. Solve 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. When 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. If 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. If 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. When you find an answer, verify the answer carefully. Include verifiable evidence in your response if possible. Reply 'TERMINATE' in the end when everything is done.","is_termination_msg":null,"code_execution_config":null,"default_auto_reply":"","description":"A primary assistant agent that writes plans and code to solve tasks."},"timestamp":"2024-03-12T18:39:09.609Z","user_id":"guestuser@gmail.com","skills":[{"title":"find_papers_arxiv","content":"import 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","file_name":"find_papers_arxiv","id":"8aac5b22-a69d-4799-be37-87fa95ce0b3a","description":"This skill finds relevant papers on arXiv given a query.","timestamp":"2024-03-12T22:54:22.972910","user_id":"default"},{"title":"generate_images","content":"from typing import List\nimport uuid\nimport requests # to perform HTTP requests\nfrom pathlib import Path\n\nfrom openai import OpenAI\n\n\ndef generate_and_save_images(query: str, image_size: str = \"1024x1024\") -> List[str]:\n \"\"\"\n Function to paint, draw or illustrate images based on the users query or request. Generates images from a given query using OpenAI's DALL-E model and saves them to disk. Use the code below anytime there is a request to create an image.\n\n :param query: A natural language description of the image to be generated.\n :param image_size: The size of the image to be generated. (default is \"1024x1024\")\n :return: A list of filenames for the saved images.\n \"\"\"\n\n client = OpenAI() # Initialize the OpenAI client\n response = client.images.generate(model=\"dall-e-3\", prompt=query, n=1, size=image_size) # Generate images\n\n # List to store the file names of saved images\n saved_files = []\n\n # Check if the response is successful\n if response.data:\n for image_data in response.data:\n # Generate a random UUID as the file name\n file_name = str(uuid.uuid4()) + \".png\" # Assuming the image is a PNG\n file_path = Path(file_name)\n\n img_url = image_data.url\n img_response = requests.get(img_url)\n if img_response.status_code == 200:\n # Write the binary content to a file\n with open(file_path, \"wb\") as img_file:\n img_file.write(img_response.content)\n print(f\"Image saved to {file_path}\")\n saved_files.append(str(file_path))\n else:\n print(f\"Failed to download the image from {img_url}\")\n else:\n print(\"No image data found in the response!\")\n\n # Return the list of saved files\n return saved_files\n\n\n# Example usage of the function:\n# generate_and_save_images(\"A cute baby sea otter\")\n","file_name":null,"id":"8f503d78-4aa5-41f8-8049-0fd8aef46f08","description":"This skill generates images from a given query using OpenAI's DALL-E model and saves them to disk.","timestamp":"2024-03-12T22:54:22.972910","user_id":"default"}]}}

Response - { "status": false, "message": "Error occurred while creating agent: table agents has no column named description" }

Additional Information

I just pip installed a fresh version on a new conda env

AutoGen Studio - v0.0.49 Python - 3.11

JonMike12341234 commented 8 months ago

Just installed this morning, fresh install and same problem. Even if I click the copy agent button and click save/ok I get this same message. Please help!

JonMike12341234 commented 8 months ago

Also found out I can edit the existing two agent examples, which save without the bug, but as I mentioned you can't copy existing agents and edit them as it produces the same bug. Of course I don't have the original two agents, whatever they were but was able to overwrite them with my new agents. Is there a way to download/upload the two original agents or a website that has autogen studio2 agents available for downloading/uploading?

victordibia commented 8 months ago

Hi @JonMike12341234 , @enact-on ,

Thanks for opening this. I confirm it indeed is a bug (recently the description field was moved to the agent configuration), logic for creating a new agent was not updated correctly.

Working on it now.

victordibia commented 8 months ago

Update - fixed in the new release v v0.0.53 Please upgrade to fix.

pip install -U autogenstudio
enact-on commented 8 months ago

@victordibia Thanks for the quick fix. I have run the upgrade. I can confirm that I am now able to create agents.

Cheers!!