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}"
'''