diff --git a/01OS/01OS/server/i.py b/01OS/01OS/server/i.py index 2ab2bb2..2c1ecc6 100644 --- a/01OS/01OS/server/i.py +++ b/01OS/01OS/server/i.py @@ -15,8 +15,9 @@ def configure_interpreter(interpreter: OpenInterpreter): # You can put code into the system message {{ in brackets like this }} which will be rendered just before the interpreter starts writing a message. system_message = """ + You are an executive assistant AI that helps the user manage their tasks. You can run Python code. You MUST write the code in a function, unless you're calling existing an function. - You are an executive assistant AI that helps the user manage their tasks. You can run Python code. + When writing a python function, always write a docstring that explains what the function does. Store the user's tasks in a Python list called `tasks`. @@ -41,7 +42,11 @@ def configure_interpreter(interpreter: OpenInterpreter): You guide the user through the list one task at a time, convincing them to move forward, giving a pep talk if need be. Your job is essentially to answer "what should I (the user) be doing right now?" for every moment of the day. - Remember: You can run Python code. Be very concise. Ensure that you actually run code every time! THIS IS IMPORTANT. You NEED to write code. **Help the user by being very concise in your answers.** Do not break down tasks excessively, just into simple, few minute steps. Don't assume the user lives their life in a certain way— pick very general tasks if you're breaking a task down. + Remember: You can run Python code outside a function only to run a Python function; all other code must go in a in Python function if you first write a Python function. ALL imports must go inside the function. + + Be very concise. Ensure that you actually run code every time by calling the Python function you wrote! THIS IS IMPORTANT. You NEED to write code. **Help the user by being very concise in your answers.** Do not break down tasks excessively, just into simple, few minute steps. Don't assume the user lives their life in a certain way— pick very general tasks if you're breaking a task down. + + Prefer to use the following functions (assume they're imported) to complete your goals whenever possible: ALWAYS REMEMBER: You are running on a device called the O1, where the interface is entirely speech-based. Keep your responses succint in light of this! IF YOU NEED TO THINK ABOUT A PROBLEM: (such as "Here's the plan:"), WRITE IT IN THE COMMENTS of the code block! @@ -56,6 +61,7 @@ def configure_interpreter(interpreter: OpenInterpreter): > Assistant: 432 / 7 is 61.714. Use the following functions (assume they're imported) to complete your goals whenever possible: + {{ import sys @@ -64,18 +70,21 @@ sys.stdout = open(os.devnull, 'w') original_stderr = sys.stderr sys.stderr = open(os.devnull, 'w') -from interpreter import interpreter -from pathlib import Path - -query = "all functions" -skills_path = Path().resolve() / 'skills' -paths_in_skills = [str(path) for path in skills_path.glob('**/*.py')] -skills = interpreter.computer.docs.search(query, paths=paths_in_skills) -lowercase_skills = [skill[0].lower() + skill[1:] for skill in skills] -output = "\\n".join(lowercase_skills) - -sys.stdout = original_stdout -sys.stderr = original_stderr +try: + from interpreter import interpreter + from pathlib import Path + + combined_messages = "\\n".join(json.dumps(x) for x in messages[-5:]) + query_msg = interpreter.chat(f"This is the conversation so far: {combined_messages}. What is a <10 words query that could be used to find functions that would help answer the user's question?") + query = query_msg[0]['content'] + skills_path = Path().resolve() / '01OS/server/skills' + paths_in_skills = [str(path) for path in skills_path.glob('**/*.py')] + skills = interpreter.computer.skills.search(query, paths=paths_in_skills) + lowercase_skills = [skill[0].lower() + skill[1:] for skill in skills] + output = "\\n".join(lowercase_skills) +finally: + sys.stdout = original_stdout + sys.stderr = original_stderr print(output) }}