jgravelle / AutoGroq

AutoGroq is a groundbreaking tool that revolutionizes the way users interact with Autogen™ and other AI assistants. By dynamically generating tailored teams of AI agents based on your project requirements, AutoGroq eliminates the need for manual configuration and allows you to tackle any question, problem, or project with ease and efficiency.

Home Page:https://autogroq.streamlit.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrongly escaped underscore in skills generation + better prompt for skills

scruffynerf opened this issue · comments

Seeing a lot of \_ in generated skills...
this breaks both name recognition code and most of the python code, requiring hand edits.
I added a quick .replace("\\_","_") to fix it, but unsure of the best answer (unsure why it's escaping those)

Also here's my current improved prompt for better skills, based on best practices from Autogen Studio examples:

def get_generate_skill_prompt(rephrased_skill_request):
    return f'''
                Based on the rephrased skill request below, please do the following:

                1. Do step-by-step reasoning and think to understand the request better.
                2. Code the best Autogen Studio Python skill as per the request as a [skill_name].py file.
                3. Return only the skill file, no commentary, intro, or other extra text. If there ARE any non-code lines, please pre-pend them with a '#' symbol to comment them out.
                4. A proper skill will have these parts:
                   a. Imports (import libraries needed for the skill)
                   b. Function definition AND docstrings (this helps the LLM understand what the function does and how to use it)
                   c. Function body (the actual code that implements the function)
                   d. (optional) Example usage - ALWAYS commented out
                   Here is an example of a well formatted skill:

                   # skill filename: save_file_to_disk.py
                   # Import necessary module(s)
                   import os

                   def save_file_to_disk(contents, file_name):
                   # docstrings
                   """
                   Saves the given contents to a file with the given file name.

                   Parameters:
                   contents (str): The string contents to save to the file.
                   file_name (str): The name of the file, including its extension.

                   Returns:
                   str: A message indicating the success of the operation.
                   """

                   # Body of skill

                   # Ensure the directory exists; create it if it doesn't
                   directory = os.path.dirname(file_name)
                   if directory and not os.path.exists(directory):
                      os.makedirs(directory)

                   # Write the contents to the file
                   with open(file_name, 'w') as file:
                      file.write(contents)
    
                   return f"File file_name has been saved successfully."

                   # Example usage:
                   # contents_to_save = "Hello, world!"
                   # file_name = "example.txt"
                   # print(save_file_to_disk(contents_to_save, file_name))

                Rephrased skill request: "{rephrased_skill_request}"
                '''

Outstanding! Pushed! Thanks so much... -jjg