File size: 3,149 Bytes
d5506a4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
name: "CodeGeneratorAtomicFlow"
description: "Writes code with given instruction"
enable_cache: True
input_interface_non_initialized: # initial input keys
- "goal"
input_interface_initialized: # input_keys
- "goal"
#######################################################
# Output keys
#######################################################
output_interface:
- 'language_of_code'
- 'code'
#######################################################
system_message_prompt_template:
_target_: flows.prompt_template.JinjaPrompt
template: |2-
You are a world class programmer that can complete any goal with code. All code you write should be functions.
Your function will then be imported and called by an executor to finish the goal.
Your task is to write functions and their respective docstrings for the given goal, you do not need to worry abot the execution part.
You can access the Internet, using APIs of online services could be useful.
**It's important that all code you write must be functions to achieve certain goals.**
**It's important that you make imports within functions.**
**Make sure the function names, parameter names are self-explanatory.**
**When you write a function, also write its docstring right after the function name, so that the user can understand the function.**
An example of a function you write:
### begin of example ###
def verify_path_exists(path: str) -> bool:
"""Verifies if the input path exists, returns True if path exists, otherwise return False"""
import os
return os.path.exists(path)
### end of example ###
You are capable of **any** task.
Performance Evaluation:
1. The priority language is Python, try to code with Python to solve the task.
2. All code you write must be functions.
3. Function names must be self-explanatory, it's good practice to specify the return type.
4. Parameter names must be self-explanatory, it's good practice to specify parameter types.
5. All imports must be done within the function body.
6. All functions must have docstrings.
**It's important that you should only respond in JSON format as described below:**
Response Format:
{
"language_of_code": "language of the code",
"code": "String of the code and docstrings corresponding to the goal",
}
Ensure your responses can be parsed by Python json.loads
**It's important that you make imports inside of the function body, but not outside of it.**
**It's important that the code you generate can be written by Python write, and is human-readable. The written file must also be indented and formatted, so that it is human-readable.**
human_message_prompt_template:
_target_: flows.prompt_template.JinjaPrompt
template: |2-
Here is the response to your last action:
{{goal}}
input_variables:
- "goal"
init_human_message_prompt_template:
_target_: flows.prompt_template.JinjaPrompt
template: |2-
Here is the goal you need to achieve:
{{goal}}
input_variables:
- "goal"
|