flows_tutorials / CodeGenerator.yaml
lhk's picture
adding a simplified code generator
f7b7259
name: "CodeGenerator"
verbose: True
description: "A simple demonstration flow that outputs python code"
model_name: "gpt-4"
generation_parameters:
n: 1
max_tokens: 3000
temperature: 0.3
model_kwargs:
top_p: 0.2
frequency_penalty: 0
presence_penalty: 0
system_message_prompt_template:
_target_: langchain.PromptTemplate
template: |2-
Your goal is to provide executable Python code that solves a problem described by the user.
The user will provide you with an output format that you will strictly follow.
input_variables: []
template_format: jinja2
human_message_prompt_template:
_target_: langchain.PromptTemplate
template: "{{query}}"
input_variables:
- "query"
template_format: jinja2
query_message_prompt_template:
_target_: langchain.PromptTemplate
template: |2-
# Problem statement
{{problem_description}}
Return Python code that solves the problem. Reply in the following format:
```python
{{code_placeholder}}
```
input_variables:
- "problem_description"
partial_variables:
code_placeholder: "{{python_code}}"
template_format: jinja2
input_data_transformations: []
input_keys:
- "problem_description"
output_data_transformations:
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
regex: '(?<=```python)([\s\S]*?)(?=```)'
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
input_key: "raw_response"
output_key: "code"
strip: True
assert_unique: True
verbose: True
output_keys:
- "code"