Commit
•
ca366eb
1
Parent(s):
badc5db
partially propagate changes (#7)
Browse files- propagate changes (b697fc8b0f017ee7dc25121288ce9f9346cf8a86)
- propagate changes (0eae436a18d318ae17b1939a76d83b5b24ada13d)
- propagate change from https://github.com/epfl-dlab/flows/pull/91 (d9ef54ce605115d9672cc394a934115ec8d6ba2c)
- partially update CC_flows to be consistent with yeeef_dev (28b05f541f4fb9fc87c0f4307bd02ce51a28b602)
Co-authored-by: Yeeef <yeeef@users.noreply.huggingface.co>
This view is limited to 50 files because it contains too many changes.
See raw diff
- CF_Code.py +3 -5
- CF_Code.yaml +4 -3
- CF_CodeCollab.yaml +23 -34
- CF_CodeCritic.py +1 -4
- CF_CodeCritic.yaml +3 -3
- CF_CodeCriticWrongAttempt.py +1 -2
- CF_CodeCriticWrongAttempt.yaml +3 -4
- CF_CodeCriticWrongAttemptWithPlan.py +1 -2
- CF_CodeCriticWrongAttemptWithPlan.yaml +3 -3
- CF_CodeDebug.yaml +20 -30
- CF_CodeDebugCollab.yaml +20 -26
- CF_CodeDebugCollabWithPlan.yaml +9 -5
- CF_CodeDebugCritic.yaml +9 -11
- CF_CodeDebugCriticWithPlan.yaml +3 -3
- CF_CodeReflect.yaml +19 -30
- CF_CodeTesting.yaml +2 -1
- CF_CodeWithPlan.py +1 -3
- CF_CodeWithPlan.yaml +3 -2
- CF_Plan.py +1 -1
- CF_Plan.yaml +3 -2
- CF_PlanCollab.yaml +9 -5
- CF_PlanCollab_Code.yaml +1 -1
- CF_PlanCritic.py +1 -1
- CF_PlanCritic.yaml +2 -2
- CF_PlanReflect.yaml +7 -3
- CF_PlanReflect_Code.yaml +1 -1
- CF_Plan_Code.yaml +8 -9
- CodeTesting.py +3 -5
- FixedReply_CodeReflect.yaml +1 -1
- FixedReply_PlanReflect.yaml +1 -1
- LC_Code.py +1 -2
- LC_Code.yaml +3 -3
- LC_CodeCollab.yaml +9 -6
- LC_CodeCritic.py +1 -3
- LC_CodeCritic.yaml +2 -2
- LC_CodeCriticWrongAttempt.py +1 -2
- LC_CodeCriticWrongAttempt.yaml +3 -3
- LC_CodeCriticWrongAttemptWithPlan.py +1 -2
- LC_CodeCriticWrongAttemptWithPlan.yaml +3 -3
- LC_CodeDebug.yaml +8 -5
- LC_CodeDebugCollab.yaml +8 -5
- LC_CodeDebugCollabWithPlan.yaml +9 -5
- LC_CodeDebugCritic.yaml +3 -3
- LC_CodeDebugCriticWithPlan.yaml +3 -3
- LC_CodeReflect.yaml +7 -3
- LC_CodeTesting.yaml +1 -1
- LC_CodeWithPlan.py +1 -2
- LC_CodeWithPlan.yaml +3 -2
- LC_Plan.py +1 -2
- LC_Plan.yaml +3 -2
CF_Code.py
CHANGED
@@ -1,12 +1,10 @@
|
|
1 |
import importlib
|
2 |
import os
|
3 |
|
4 |
-
from
|
5 |
-
|
6 |
-
# flow_module = importlib.import_module(os.getenv("OpenAIChatAtomicFlow_module"))
|
7 |
-
# OpenAIChatAtomicFlow = getattr(flow_module, "OpenAIChatAtomicFlow")
|
8 |
-
|
9 |
|
10 |
class CF_Code(OpenAIChatAtomicFlow):
|
11 |
def __init__(self, **kwargs):
|
12 |
super().__init__(**kwargs)
|
|
|
|
|
|
1 |
import importlib
|
2 |
import os
|
3 |
|
4 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
|
|
|
|
|
|
|
|
5 |
|
6 |
class CF_Code(OpenAIChatAtomicFlow):
|
7 |
def __init__(self, **kwargs):
|
8 |
super().__init__(**kwargs)
|
9 |
+
|
10 |
+
|
CF_Code.yaml
CHANGED
@@ -35,7 +35,7 @@ human_message_prompt_template:
|
|
35 |
- "query"
|
36 |
template_format: jinja2
|
37 |
|
38 |
-
|
39 |
_target_: langchain.PromptTemplate
|
40 |
template: |2-
|
41 |
# Problem statement
|
@@ -65,7 +65,7 @@ query_message_prompt_template:
|
|
65 |
template_format: jinja2
|
66 |
|
67 |
input_data_transformations: []
|
68 |
-
|
69 |
- "problem_description"
|
70 |
- "input_description"
|
71 |
- "output_description"
|
@@ -75,10 +75,11 @@ output_data_transformations:
|
|
75 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
76 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
77 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
78 |
-
input_key: "
|
79 |
output_key: "code"
|
80 |
strip: True
|
81 |
assert_unique: True
|
82 |
|
83 |
output_keys:
|
|
|
84 |
- "code"
|
|
|
35 |
- "query"
|
36 |
template_format: jinja2
|
37 |
|
38 |
+
init_human_message_prompt_template:
|
39 |
_target_: langchain.PromptTemplate
|
40 |
template: |2-
|
41 |
# Problem statement
|
|
|
65 |
template_format: jinja2
|
66 |
|
67 |
input_data_transformations: []
|
68 |
+
init_input_keys:
|
69 |
- "problem_description"
|
70 |
- "input_description"
|
71 |
- "output_description"
|
|
|
75 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
76 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
77 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
78 |
+
input_key: "api_output"
|
79 |
output_key: "code"
|
80 |
strip: True
|
81 |
assert_unique: True
|
82 |
|
83 |
output_keys:
|
84 |
+
- "api_output"
|
85 |
- "code"
|
CF_CodeCollab.yaml
CHANGED
@@ -1,30 +1,21 @@
|
|
1 |
name: "CodeCollab_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
reset_generator_every_round: False
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDO: To increase to 4
|
7 |
-
early_exit_key: "end_of_interaction"
|
8 |
|
9 |
-
input_data_transformations: []
|
10 |
input_keys:
|
11 |
- "problem_description"
|
12 |
- "input_description"
|
13 |
- "output_description"
|
14 |
- "io_examples_and_explanation"
|
15 |
|
16 |
-
output_data_transformations:
|
17 |
-
- _target_: flows.data_transformations.KeyRename
|
18 |
-
old_key2new_key:
|
19 |
-
raw_response.code: "code"
|
20 |
output_keys:
|
21 |
- "code"
|
22 |
|
23 |
subflows_config:
|
24 |
-
|
|
|
25 |
overrides:
|
26 |
-
name: "CodeGenerator"
|
27 |
-
model_name: "gpt-4"
|
28 |
human_message_prompt_template:
|
29 |
_target_: langchain.PromptTemplate
|
30 |
template: |2-
|
@@ -43,28 +34,26 @@ subflows_config:
|
|
43 |
partial_variables:
|
44 |
code_placeholder: "{{python_code}}"
|
45 |
template_format: jinja2
|
46 |
-
|
|
|
47 |
- "code_feedback"
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
-
|
62 |
-
- "code"
|
63 |
-
- "end_of_interaction"
|
64 |
-
- _target_: martinjosifoski.CC_flows.CF_CodeCritic.instantiate_from_default_config
|
65 |
-
overrides:
|
66 |
-
name: CodeCritic
|
67 |
-
output_data_transformations:
|
68 |
-
- _target_: flows.data_transformations.KeyRename
|
69 |
-
old_key2new_key:
|
70 |
-
raw_response: "code_feedback"
|
|
|
1 |
name: "CodeCollab_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
4 |
max_rounds: 2 # ToDO: To increase to 4
|
|
|
5 |
|
|
|
6 |
input_keys:
|
7 |
- "problem_description"
|
8 |
- "input_description"
|
9 |
- "output_description"
|
10 |
- "io_examples_and_explanation"
|
11 |
|
|
|
|
|
|
|
|
|
12 |
output_keys:
|
13 |
- "code"
|
14 |
|
15 |
subflows_config:
|
16 |
+
CodeGenerator:
|
17 |
+
_target_: .CF_Code.instantiate_from_default_config
|
18 |
overrides:
|
|
|
|
|
19 |
human_message_prompt_template:
|
20 |
_target_: langchain.PromptTemplate
|
21 |
template: |2-
|
|
|
34 |
partial_variables:
|
35 |
code_placeholder: "{{python_code}}"
|
36 |
template_format: jinja2
|
37 |
+
|
38 |
+
input_keys:
|
39 |
- "code_feedback"
|
40 |
+
CodeCritic:
|
41 |
+
_target_: .CF_CodeCritic.instantiate_from_default_config
|
42 |
+
|
43 |
+
topology:
|
44 |
+
- flow: CodeGenerator
|
45 |
+
reset_every_round: false
|
46 |
+
output_transformations:
|
47 |
+
- _target_: flows.data_transformations.EndOfInteraction
|
48 |
+
end_of_interaction_string: "Final answer"
|
49 |
+
input_key: "api_output"
|
50 |
+
output_key: "end_of_interaction"
|
51 |
+
|
52 |
+
- flow: CodeCritic
|
53 |
+
reset_every_round: true
|
54 |
+
output_transformations:
|
55 |
+
- _target_: flows.data_transformations.KeyRename
|
56 |
+
old_key2new_key:
|
57 |
+
api_output: "code_feedback"
|
58 |
|
59 |
+
early_exit_key: "end_of_interaction"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CF_CodeCritic.py
CHANGED
@@ -1,7 +1,4 @@
|
|
1 |
-
import
|
2 |
-
import importlib
|
3 |
-
|
4 |
-
from martinjosifoski.OpenAIChatAtomicFlow import OpenAIChatAtomicFlow
|
5 |
|
6 |
|
7 |
class CF_CodeCritic(OpenAIChatAtomicFlow):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
|
|
|
|
|
|
2 |
|
3 |
|
4 |
class CF_CodeCritic(OpenAIChatAtomicFlow):
|
CF_CodeCritic.yaml
CHANGED
@@ -37,7 +37,7 @@ human_message_prompt_template:
|
|
37 |
- "query"
|
38 |
template_format: jinja2
|
39 |
|
40 |
-
|
41 |
_target_: langchain.PromptTemplate
|
42 |
template: |2-
|
43 |
# Problem statement
|
@@ -66,10 +66,10 @@ query_message_prompt_template:
|
|
66 |
- "code"
|
67 |
template_format: jinja2
|
68 |
|
69 |
-
|
70 |
- "problem_description"
|
71 |
- "input_description"
|
72 |
- "output_description"
|
73 |
- "io_examples_and_explanation"
|
74 |
- "code"
|
75 |
-
output_keys: []
|
|
|
37 |
- "query"
|
38 |
template_format: jinja2
|
39 |
|
40 |
+
init_human_message_prompt_template:
|
41 |
_target_: langchain.PromptTemplate
|
42 |
template: |2-
|
43 |
# Problem statement
|
|
|
66 |
- "code"
|
67 |
template_format: jinja2
|
68 |
|
69 |
+
init_input_keys:
|
70 |
- "problem_description"
|
71 |
- "input_description"
|
72 |
- "output_description"
|
73 |
- "io_examples_and_explanation"
|
74 |
- "code"
|
75 |
+
output_keys: ["api_output"]
|
CF_CodeCriticWrongAttempt.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
from
|
2 |
-
|
3 |
|
4 |
class CF_CodeCriticWrongAttempt(OpenAIChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
|
|
2 |
|
3 |
class CF_CodeCriticWrongAttempt(OpenAIChatAtomicFlow):
|
4 |
def __init__(self, **kwargs):
|
CF_CodeCriticWrongAttempt.yaml
CHANGED
@@ -38,7 +38,7 @@ human_message_prompt_template:
|
|
38 |
- "query"
|
39 |
template_format: jinja2
|
40 |
|
41 |
-
|
42 |
_target_: langchain.PromptTemplate
|
43 |
template: |2-
|
44 |
# Problem statement
|
@@ -70,8 +70,7 @@ query_message_prompt_template:
|
|
70 |
- "testing_results_summary"
|
71 |
template_format: jinja2
|
72 |
|
73 |
-
|
74 |
-
input_keys:
|
75 |
- "problem_description"
|
76 |
- "input_description"
|
77 |
- "output_description"
|
@@ -82,6 +81,6 @@ input_keys:
|
|
82 |
output_data_transformations:
|
83 |
- _target_: flows.data_transformations.KeyRename
|
84 |
old_key2new_key:
|
85 |
-
|
86 |
output_keys:
|
87 |
- "code_feedback"
|
|
|
38 |
- "query"
|
39 |
template_format: jinja2
|
40 |
|
41 |
+
init_human_message_prompt_template:
|
42 |
_target_: langchain.PromptTemplate
|
43 |
template: |2-
|
44 |
# Problem statement
|
|
|
70 |
- "testing_results_summary"
|
71 |
template_format: jinja2
|
72 |
|
73 |
+
init_input_keys:
|
|
|
74 |
- "problem_description"
|
75 |
- "input_description"
|
76 |
- "output_description"
|
|
|
81 |
output_data_transformations:
|
82 |
- _target_: flows.data_transformations.KeyRename
|
83 |
old_key2new_key:
|
84 |
+
api_output: "code_feedback"
|
85 |
output_keys:
|
86 |
- "code_feedback"
|
CF_CodeCriticWrongAttemptWithPlan.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
from
|
2 |
-
|
3 |
|
4 |
|
5 |
class CF_CodeCriticWrongAttemptWithPlan(OpenAIChatAtomicFlow):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
|
|
2 |
|
3 |
|
4 |
class CF_CodeCriticWrongAttemptWithPlan(OpenAIChatAtomicFlow):
|
CF_CodeCriticWrongAttemptWithPlan.yaml
CHANGED
@@ -40,7 +40,7 @@ human_message_prompt_template:
|
|
40 |
- "query"
|
41 |
template_format: jinja2
|
42 |
|
43 |
-
|
44 |
_target_: langchain.PromptTemplate
|
45 |
template: |2-
|
46 |
# Problem statement
|
@@ -77,7 +77,7 @@ query_message_prompt_template:
|
|
77 |
template_format: jinja2
|
78 |
|
79 |
input_data_transformations: []
|
80 |
-
|
81 |
- "problem_description"
|
82 |
- "input_description"
|
83 |
- "output_description"
|
@@ -89,6 +89,6 @@ input_keys:
|
|
89 |
output_data_transformations:
|
90 |
- _target_: flows.data_transformations.KeyRename
|
91 |
old_key2new_key:
|
92 |
-
|
93 |
output_keys:
|
94 |
- "code_feedback"
|
|
|
40 |
- "query"
|
41 |
template_format: jinja2
|
42 |
|
43 |
+
init_human_message_prompt_template:
|
44 |
_target_: langchain.PromptTemplate
|
45 |
template: |2-
|
46 |
# Problem statement
|
|
|
77 |
template_format: jinja2
|
78 |
|
79 |
input_data_transformations: []
|
80 |
+
init_input_keys:
|
81 |
- "problem_description"
|
82 |
- "input_description"
|
83 |
- "output_description"
|
|
|
89 |
output_data_transformations:
|
90 |
- _target_: flows.data_transformations.KeyRename
|
91 |
old_key2new_key:
|
92 |
+
api_output: "code_feedback"
|
93 |
output_keys:
|
94 |
- "code_feedback"
|
CF_CodeDebug.yaml
CHANGED
@@ -1,12 +1,8 @@
|
|
1 |
name: "CodeDebug_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
reset_generator_every_round: False
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDo: To increase to 4
|
7 |
-
early_exit_key: "end_of_interaction"
|
8 |
|
9 |
-
input_data_transformations: []
|
10 |
input_keys:
|
11 |
- "problem_description"
|
12 |
- "input_description"
|
@@ -14,15 +10,12 @@ input_keys:
|
|
14 |
- "io_examples_and_explanation"
|
15 |
- "public_tests_individual_io"
|
16 |
|
17 |
-
output_data_transformations:
|
18 |
-
- _target_: flows.data_transformations.KeyRename
|
19 |
-
old_key2new_key:
|
20 |
-
raw_response.code: "code"
|
21 |
output_keys:
|
22 |
- "code"
|
23 |
|
24 |
subflows_config:
|
25 |
-
|
|
|
26 |
overrides:
|
27 |
name: "CodeGenerator"
|
28 |
model_name: "gpt-4"
|
@@ -39,25 +32,22 @@ subflows_config:
|
|
39 |
- testing_results_summary
|
40 |
partial_variables:
|
41 |
code_placeholder: "{{python_code}}"
|
42 |
-
|
43 |
- "testing_results_summary"
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
- _target_: martinjosifoski.CC_flows.CF_CodeTesting.instantiate_from_default_config
|
62 |
-
overrides:
|
63 |
-
name: "CodeTestingCritic"
|
|
|
1 |
name: "CodeDebug_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
4 |
max_rounds: 2 # ToDo: To increase to 4
|
|
|
5 |
|
|
|
6 |
input_keys:
|
7 |
- "problem_description"
|
8 |
- "input_description"
|
|
|
10 |
- "io_examples_and_explanation"
|
11 |
- "public_tests_individual_io"
|
12 |
|
|
|
|
|
|
|
|
|
13 |
output_keys:
|
14 |
- "code"
|
15 |
|
16 |
subflows_config:
|
17 |
+
CodeGenerator:
|
18 |
+
_target_: .CF_Code.instantiate_from_default_config
|
19 |
overrides:
|
20 |
name: "CodeGenerator"
|
21 |
model_name: "gpt-4"
|
|
|
32 |
- testing_results_summary
|
33 |
partial_variables:
|
34 |
code_placeholder: "{{python_code}}"
|
35 |
+
input_keys:
|
36 |
- "testing_results_summary"
|
37 |
+
|
38 |
+
CodeTestingCritic:
|
39 |
+
_target_: .CF_CodeTesting.instantiate_from_default_config
|
40 |
+
|
41 |
+
topology:
|
42 |
+
- flow: CodeGenerator
|
43 |
+
reset_every_round: false
|
44 |
+
output_transformations:
|
45 |
+
- _target_: flows.data_transformations.EndOfInteraction
|
46 |
+
end_of_interaction_string: "Final answer"
|
47 |
+
input_key: "api_output"
|
48 |
+
output_key: "end_of_interaction"
|
49 |
+
|
50 |
+
- flow: CodeTestingCritic
|
51 |
+
reset_every_round: true
|
52 |
+
|
53 |
+
early_exit_key: "end_of_interaction"
|
|
|
|
|
|
CF_CodeDebugCollab.yaml
CHANGED
@@ -1,12 +1,8 @@
|
|
1 |
name: "CodeDebugCollab_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
reset_generator_every_round: False
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDo: To increase to 4
|
7 |
-
early_exit_key: "end_of_interaction"
|
8 |
|
9 |
-
input_data_transformations: []
|
10 |
input_keys:
|
11 |
- "problem_description"
|
12 |
- "input_description"
|
@@ -14,15 +10,12 @@ input_keys:
|
|
14 |
- "io_examples_and_explanation"
|
15 |
- "public_tests_individual_io"
|
16 |
|
17 |
-
output_data_transformations:
|
18 |
-
- _target_: flows.data_transformations.KeyRename
|
19 |
-
old_key2new_key:
|
20 |
-
raw_response.code: "code"
|
21 |
output_keys:
|
22 |
- "code"
|
23 |
|
24 |
subflows_config:
|
25 |
-
|
|
|
26 |
overrides:
|
27 |
name: "CodeGenerator"
|
28 |
model_name: "gpt-4"
|
@@ -44,23 +37,24 @@ subflows_config:
|
|
44 |
partial_variables:
|
45 |
code_placeholder: "{{python_code}}"
|
46 |
template_format: jinja2
|
47 |
-
|
|
|
48 |
- "code_feedback"
|
49 |
- "testing_results_summary"
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
-
|
60 |
-
end_of_interaction_string: "Final answer"
|
61 |
-
output_key: "end_of_interaction"
|
62 |
-
|
63 |
-
output_keys:
|
64 |
-
- "code"
|
65 |
-
- "end_of_interaction"
|
66 |
-
- _target_: martinjosifoski.CC_flows.CF_CodeDebugCritic.instantiate_from_default_config
|
|
|
1 |
name: "CodeDebugCollab_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
4 |
max_rounds: 2 # ToDo: To increase to 4
|
|
|
5 |
|
|
|
6 |
input_keys:
|
7 |
- "problem_description"
|
8 |
- "input_description"
|
|
|
10 |
- "io_examples_and_explanation"
|
11 |
- "public_tests_individual_io"
|
12 |
|
|
|
|
|
|
|
|
|
13 |
output_keys:
|
14 |
- "code"
|
15 |
|
16 |
subflows_config:
|
17 |
+
CodeGenerator:
|
18 |
+
_target_: .CF_Code.instantiate_from_default_config
|
19 |
overrides:
|
20 |
name: "CodeGenerator"
|
21 |
model_name: "gpt-4"
|
|
|
37 |
partial_variables:
|
38 |
code_placeholder: "{{python_code}}"
|
39 |
template_format: jinja2
|
40 |
+
|
41 |
+
input_keys:
|
42 |
- "code_feedback"
|
43 |
- "testing_results_summary"
|
44 |
+
|
45 |
+
CodeDebugCritic:
|
46 |
+
_target_: .CF_CodeDebugCritic.instantiate_from_default_config
|
47 |
+
|
48 |
+
topology:
|
49 |
+
- flow: CodeGenerator
|
50 |
+
reset_every_round: false
|
51 |
+
output_transformations:
|
52 |
+
- _target_: flows.data_transformations.EndOfInteraction
|
53 |
+
end_of_interaction_string: "Final answer"
|
54 |
+
input_key: "api_output"
|
55 |
+
output_key: "end_of_interaction"
|
56 |
+
|
57 |
+
- flow: CodeDebugCritic
|
58 |
+
reset_every_round: true
|
59 |
|
60 |
+
early_exit_key: "end_of_interaction"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CF_CodeDebugCollabWithPlan.yaml
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
name: "CodeDebugCollabWithPlan_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDo: To increase to 4
|
7 |
early_exit_key: "end_of_interaction"
|
8 |
|
@@ -18,7 +17,7 @@ input_keys:
|
|
18 |
output_data_transformations:
|
19 |
- _target_: flows.data_transformations.KeyRename
|
20 |
old_key2new_key:
|
21 |
-
|
22 |
output_keys:
|
23 |
- "code"
|
24 |
|
@@ -45,23 +44,28 @@ subflows_config:
|
|
45 |
partial_variables:
|
46 |
code_placeholder: "{{python_code}}"
|
47 |
template_format: jinja2
|
48 |
-
|
49 |
- "code_feedback"
|
50 |
- "testing_results_summary"
|
51 |
output_data_transformations:
|
52 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
53 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
54 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
55 |
-
input_key: "
|
56 |
output_key: "code"
|
57 |
strip: True
|
58 |
assert_unique: True
|
59 |
|
60 |
- _target_: flows.data_transformations.EndOfInteraction
|
61 |
end_of_interaction_string: "Final answer"
|
|
|
62 |
output_key: "end_of_interaction"
|
63 |
|
64 |
output_keys:
|
65 |
- "code"
|
66 |
- "end_of_interaction"
|
67 |
- _target_: martinjosifoski.CC_flows.CF_CodeDebugCriticWithPlan.instantiate_from_default_config
|
|
|
|
|
|
|
|
|
|
1 |
name: "CodeDebugCollabWithPlan_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
+
|
|
|
5 |
max_rounds: 2 # ToDo: To increase to 4
|
6 |
early_exit_key: "end_of_interaction"
|
7 |
|
|
|
17 |
output_data_transformations:
|
18 |
- _target_: flows.data_transformations.KeyRename
|
19 |
old_key2new_key:
|
20 |
+
code: "code"
|
21 |
output_keys:
|
22 |
- "code"
|
23 |
|
|
|
44 |
partial_variables:
|
45 |
code_placeholder: "{{python_code}}"
|
46 |
template_format: jinja2
|
47 |
+
input_keys:
|
48 |
- "code_feedback"
|
49 |
- "testing_results_summary"
|
50 |
output_data_transformations:
|
51 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
52 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
53 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
54 |
+
input_key: "api_output"
|
55 |
output_key: "code"
|
56 |
strip: True
|
57 |
assert_unique: True
|
58 |
|
59 |
- _target_: flows.data_transformations.EndOfInteraction
|
60 |
end_of_interaction_string: "Final answer"
|
61 |
+
input_key: "api_output"
|
62 |
output_key: "end_of_interaction"
|
63 |
|
64 |
output_keys:
|
65 |
- "code"
|
66 |
- "end_of_interaction"
|
67 |
- _target_: martinjosifoski.CC_flows.CF_CodeDebugCriticWithPlan.instantiate_from_default_config
|
68 |
+
|
69 |
+
reset_every_round:
|
70 |
+
CodeGenerator: False
|
71 |
+
CodeDebugCriticWithPlan_Flow: True
|
CF_CodeDebugCritic.yaml
CHANGED
@@ -3,7 +3,6 @@ description: "ToDo: add description"
|
|
3 |
|
4 |
early_exit_key: null
|
5 |
|
6 |
-
input_data_transformations: []
|
7 |
input_keys:
|
8 |
- "problem_description"
|
9 |
- "input_description"
|
@@ -12,19 +11,18 @@ input_keys:
|
|
12 |
- "public_tests_individual_io"
|
13 |
- "code"
|
14 |
|
15 |
-
output_data_transformations:
|
16 |
-
- _target_: flows.data_transformations.KeyRename
|
17 |
-
old_key2new_key:
|
18 |
-
raw_response.testing_results_summary: "testing_results_summary"
|
19 |
-
raw_response.all_tests_passed: "all_tests_passed"
|
20 |
-
raw_response.code_feedback: "code_feedback"
|
21 |
output_keys:
|
22 |
- "testing_results_summary"
|
23 |
- "all_tests_passed"
|
24 |
- "code_feedback"
|
25 |
|
26 |
subflows_config:
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
early_exit_key: null
|
5 |
|
|
|
6 |
input_keys:
|
7 |
- "problem_description"
|
8 |
- "input_description"
|
|
|
11 |
- "public_tests_individual_io"
|
12 |
- "code"
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
output_keys:
|
15 |
- "testing_results_summary"
|
16 |
- "all_tests_passed"
|
17 |
- "code_feedback"
|
18 |
|
19 |
subflows_config:
|
20 |
+
CodeTestingCritic:
|
21 |
+
_target_: .CF_CodeTesting.instantiate_from_default_config
|
22 |
+
CodeCriticWrongAttempt:
|
23 |
+
_target_: .CF_CodeCriticWrongAttempt.instantiate_from_default_config
|
24 |
+
|
25 |
+
topology:
|
26 |
+
- flow: CodeTestingCritic
|
27 |
+
- flow: CodeCriticWrongAttempt
|
28 |
+
|
CF_CodeDebugCriticWithPlan.yaml
CHANGED
@@ -16,9 +16,9 @@ input_keys:
|
|
16 |
output_data_transformations:
|
17 |
- _target_: flows.data_transformations.KeyRename
|
18 |
old_key2new_key:
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
output_keys:
|
23 |
- "testing_results_summary"
|
24 |
- "all_tests_passed"
|
|
|
16 |
output_data_transformations:
|
17 |
- _target_: flows.data_transformations.KeyRename
|
18 |
old_key2new_key:
|
19 |
+
testing_results_summary: "testing_results_summary"
|
20 |
+
all_tests_passed: "all_tests_passed"
|
21 |
+
code_feedback: "code_feedback"
|
22 |
output_keys:
|
23 |
- "testing_results_summary"
|
24 |
- "all_tests_passed"
|
CF_CodeReflect.yaml
CHANGED
@@ -1,48 +1,37 @@
|
|
1 |
name: "CodeReflect_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
reset_generator_every_round: False
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDo: To increase to 4
|
7 |
-
early_exit_key: "end_of_interaction"
|
8 |
|
9 |
-
input_data_transformations: []
|
10 |
input_keys:
|
11 |
- "problem_description"
|
12 |
- "input_description"
|
13 |
- "output_description"
|
14 |
- "io_examples_and_explanation"
|
15 |
|
16 |
-
output_data_transformations:
|
17 |
-
- _target_: flows.data_transformations.KeyRename
|
18 |
-
old_key2new_key:
|
19 |
-
raw_response.code: "code"
|
20 |
output_keys:
|
21 |
- "code"
|
22 |
|
23 |
subflows_config:
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
input_data_transformations:
|
29 |
-
- _target_: flows.data_transformations.KeyRename
|
30 |
-
old_key2new_key:
|
31 |
-
code_reflect_message: "query"
|
32 |
-
output_data_transformations:
|
33 |
-
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
34 |
-
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
35 |
-
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
36 |
-
output_key: "code"
|
37 |
-
strip: True
|
38 |
-
assert_unique: True
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
47 |
|
48 |
-
|
|
|
1 |
name: "CodeReflect_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
4 |
max_rounds: 2 # ToDo: To increase to 4
|
|
|
5 |
|
|
|
6 |
input_keys:
|
7 |
- "problem_description"
|
8 |
- "input_description"
|
9 |
- "output_description"
|
10 |
- "io_examples_and_explanation"
|
11 |
|
|
|
|
|
|
|
|
|
12 |
output_keys:
|
13 |
- "code"
|
14 |
|
15 |
subflows_config:
|
16 |
+
CodeGenerator:
|
17 |
+
_target_: .CF_Code.instantiate_from_default_config
|
18 |
+
CodeReflectCritic:
|
19 |
+
_target_: .FixedReply_CodeReflect.instantiate_from_default_config
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
topology:
|
22 |
+
- flow: CodeGenerator
|
23 |
+
reset_every_round: false
|
24 |
+
output_transformations:
|
25 |
+
- _target_: flows.data_transformations.EndOfInteraction
|
26 |
+
end_of_interaction_string: "Final answer"
|
27 |
+
input_key: "api_output"
|
28 |
+
output_key: "end_of_interaction"
|
29 |
|
30 |
+
- flow: CodeReflectCritic
|
31 |
+
reset_every_round: true
|
32 |
+
output_transformations:
|
33 |
+
- _target_: flows.data_transformations.KeyRename
|
34 |
+
old_key2new_key:
|
35 |
+
code_reflect_message: "query"
|
36 |
|
37 |
+
early_exit_key: "end_of_interaction"
|
CF_CodeTesting.yaml
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
description: "ToDo: add description"
|
2 |
|
3 |
input_data_transformations: []
|
@@ -10,7 +11,7 @@ output_keys:
|
|
10 |
- "testing_results_summary"
|
11 |
output_data_transformations:
|
12 |
- _target_: martinjosifoski.CC_flows.src.data_transformations.CorrectnessFlag
|
13 |
-
input_key: "
|
14 |
output_key: "all_tests_passed"
|
15 |
- _target_: martinjosifoski.CC_flows.src.data_transformations.TestingResultsSummaryGeneration
|
16 |
output_key: "testing_results_summary"
|
|
|
1 |
+
name: "CF_CodeTesting"
|
2 |
description: "ToDo: add description"
|
3 |
|
4 |
input_data_transformations: []
|
|
|
11 |
- "testing_results_summary"
|
12 |
output_data_transformations:
|
13 |
- _target_: martinjosifoski.CC_flows.src.data_transformations.CorrectnessFlag
|
14 |
+
input_key: "public_tests_results"
|
15 |
output_key: "all_tests_passed"
|
16 |
- _target_: martinjosifoski.CC_flows.src.data_transformations.TestingResultsSummaryGeneration
|
17 |
output_key: "testing_results_summary"
|
CF_CodeWithPlan.py
CHANGED
@@ -1,6 +1,4 @@
|
|
1 |
-
from
|
2 |
-
|
3 |
-
|
4 |
|
5 |
class CF_CodeWithPlan(OpenAIChatAtomicFlow):
|
6 |
def __init__(self, **kwargs):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
|
|
|
|
2 |
|
3 |
class CF_CodeWithPlan(OpenAIChatAtomicFlow):
|
4 |
def __init__(self, **kwargs):
|
CF_CodeWithPlan.yaml
CHANGED
@@ -37,7 +37,7 @@ human_message_prompt_template:
|
|
37 |
- "query"
|
38 |
template_format: jinja2
|
39 |
|
40 |
-
|
41 |
_target_: langchain.PromptTemplate
|
42 |
template: |2-
|
43 |
# Problem statement
|
@@ -71,7 +71,7 @@ query_message_prompt_template:
|
|
71 |
template_format: jinja2
|
72 |
|
73 |
input_data_transformations: []
|
74 |
-
|
75 |
- "problem_description"
|
76 |
- "input_description"
|
77 |
- "output_description"
|
@@ -82,6 +82,7 @@ output_data_transformations:
|
|
82 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
83 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
84 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
|
|
85 |
output_key: "code"
|
86 |
strip: True
|
87 |
assert_unique: True
|
|
|
37 |
- "query"
|
38 |
template_format: jinja2
|
39 |
|
40 |
+
init_human_message_prompt_template:
|
41 |
_target_: langchain.PromptTemplate
|
42 |
template: |2-
|
43 |
# Problem statement
|
|
|
71 |
template_format: jinja2
|
72 |
|
73 |
input_data_transformations: []
|
74 |
+
init_input_keys:
|
75 |
- "problem_description"
|
76 |
- "input_description"
|
77 |
- "output_description"
|
|
|
82 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
83 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
84 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
85 |
+
input_key: "api_output"
|
86 |
output_key: "code"
|
87 |
strip: True
|
88 |
assert_unique: True
|
CF_Plan.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
class CF_Plan(OpenAIChatAtomicFlow):
|
4 |
def __init__(self, **kwargs):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
2 |
|
3 |
class CF_Plan(OpenAIChatAtomicFlow):
|
4 |
def __init__(self, **kwargs):
|
CF_Plan.yaml
CHANGED
@@ -13,7 +13,7 @@ generation_parameters:
|
|
13 |
presence_penalty: 0
|
14 |
|
15 |
input_data_transformations: []
|
16 |
-
|
17 |
- "problem_description"
|
18 |
- "input_description"
|
19 |
- "output_description"
|
@@ -24,6 +24,7 @@ output_data_transformations:
|
|
24 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
25 |
regex_fallback:
|
26 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
|
|
27 |
output_key: "plan"
|
28 |
strip: True
|
29 |
assert_unique: True
|
@@ -56,7 +57,7 @@ human_message_prompt_template:
|
|
56 |
- "query"
|
57 |
template_format: jinja2
|
58 |
|
59 |
-
|
60 |
_target_: langchain.PromptTemplate
|
61 |
template: |2-
|
62 |
# Problem statement
|
|
|
13 |
presence_penalty: 0
|
14 |
|
15 |
input_data_transformations: []
|
16 |
+
init_input_keys:
|
17 |
- "problem_description"
|
18 |
- "input_description"
|
19 |
- "output_description"
|
|
|
24 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
25 |
regex_fallback:
|
26 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
27 |
+
input_key: "api_output"
|
28 |
output_key: "plan"
|
29 |
strip: True
|
30 |
assert_unique: True
|
|
|
57 |
- "query"
|
58 |
template_format: jinja2
|
59 |
|
60 |
+
init_human_message_prompt_template:
|
61 |
_target_: langchain.PromptTemplate
|
62 |
template: |2-
|
63 |
# Problem statement
|
CF_PlanCollab.yaml
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
name: "PlanCollab_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
reset_generator_every_round: False
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDo: To increase to 4
|
7 |
early_exit_key: "end_of_interaction"
|
8 |
|
@@ -16,7 +14,7 @@ input_keys:
|
|
16 |
output_data_transformations:
|
17 |
- _target_: flows.data_transformations.KeyRename
|
18 |
old_key2new_key:
|
19 |
-
|
20 |
output_keys:
|
21 |
- "plan"
|
22 |
|
@@ -41,19 +39,21 @@ subflows_config:
|
|
41 |
partial_variables:
|
42 |
plan_placeholder: "{{conceptual_solution}}"
|
43 |
template_format: jinja2
|
44 |
-
|
45 |
- "plan_feedback"
|
46 |
output_data_transformations:
|
47 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
48 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
49 |
regex_fallback:
|
50 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
|
|
51 |
output_key: "plan"
|
52 |
strip: True
|
53 |
assert_unique: True
|
54 |
|
55 |
- _target_: flows.data_transformations.EndOfInteraction
|
56 |
end_of_interaction_string: "Final answer"
|
|
|
57 |
output_key: "end_of_interaction"
|
58 |
|
59 |
output_keys:
|
@@ -65,4 +65,8 @@ subflows_config:
|
|
65 |
output_data_transformations:
|
66 |
- _target_: flows.data_transformations.KeyRename
|
67 |
old_key2new_key:
|
68 |
-
|
|
|
|
|
|
|
|
|
|
1 |
name: "PlanCollab_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
4 |
max_rounds: 2 # ToDo: To increase to 4
|
5 |
early_exit_key: "end_of_interaction"
|
6 |
|
|
|
14 |
output_data_transformations:
|
15 |
- _target_: flows.data_transformations.KeyRename
|
16 |
old_key2new_key:
|
17 |
+
plan: "plan"
|
18 |
output_keys:
|
19 |
- "plan"
|
20 |
|
|
|
39 |
partial_variables:
|
40 |
plan_placeholder: "{{conceptual_solution}}"
|
41 |
template_format: jinja2
|
42 |
+
input_keys:
|
43 |
- "plan_feedback"
|
44 |
output_data_transformations:
|
45 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
46 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
47 |
regex_fallback:
|
48 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
49 |
+
input_key: "api_output"
|
50 |
output_key: "plan"
|
51 |
strip: True
|
52 |
assert_unique: True
|
53 |
|
54 |
- _target_: flows.data_transformations.EndOfInteraction
|
55 |
end_of_interaction_string: "Final answer"
|
56 |
+
input_key: "api_output"
|
57 |
output_key: "end_of_interaction"
|
58 |
|
59 |
output_keys:
|
|
|
65 |
output_data_transformations:
|
66 |
- _target_: flows.data_transformations.KeyRename
|
67 |
old_key2new_key:
|
68 |
+
api_output: "plan_feedback"
|
69 |
+
|
70 |
+
reset_every_round:
|
71 |
+
PlanGenerator: false
|
72 |
+
PlanCritic: true
|
CF_PlanCollab_Code.yaml
CHANGED
@@ -13,7 +13,7 @@ input_keys:
|
|
13 |
output_data_transformations:
|
14 |
- _target_: flows.data_transformations.KeyRename
|
15 |
old_key2new_key:
|
16 |
-
|
17 |
output_keys:
|
18 |
- "code"
|
19 |
|
|
|
13 |
output_data_transformations:
|
14 |
- _target_: flows.data_transformations.KeyRename
|
15 |
old_key2new_key:
|
16 |
+
code: "code"
|
17 |
output_keys:
|
18 |
- "code"
|
19 |
|
CF_PlanCritic.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_PlanCritic(OpenAIChatAtomicFlow):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
2 |
|
3 |
|
4 |
class CF_PlanCritic(OpenAIChatAtomicFlow):
|
CF_PlanCritic.yaml
CHANGED
@@ -38,7 +38,7 @@ human_message_prompt_template:
|
|
38 |
- "query"
|
39 |
template_format: jinja2
|
40 |
|
41 |
-
|
42 |
_target_: langchain.PromptTemplate
|
43 |
template: |2-
|
44 |
# Problem statement
|
@@ -65,7 +65,7 @@ query_message_prompt_template:
|
|
65 |
- "plan"
|
66 |
template_format: jinja2
|
67 |
|
68 |
-
|
69 |
- "problem_description"
|
70 |
- "input_description"
|
71 |
- "output_description"
|
|
|
38 |
- "query"
|
39 |
template_format: jinja2
|
40 |
|
41 |
+
init_human_message_prompt_template:
|
42 |
_target_: langchain.PromptTemplate
|
43 |
template: |2-
|
44 |
# Problem statement
|
|
|
65 |
- "plan"
|
66 |
template_format: jinja2
|
67 |
|
68 |
+
init_input_keys:
|
69 |
- "problem_description"
|
70 |
- "input_description"
|
71 |
- "output_description"
|
CF_PlanReflect.yaml
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
name: "PlanReflect_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
reset_generator_every_round: False
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDo: increase to 4
|
7 |
early_exit_key: "end_of_interaction"
|
8 |
|
@@ -16,7 +14,7 @@ input_keys:
|
|
16 |
output_data_transformations:
|
17 |
- _target_: flows.data_transformations.KeyRename
|
18 |
old_key2new_key:
|
19 |
-
|
20 |
output_keys:
|
21 |
- "plan"
|
22 |
|
@@ -34,12 +32,14 @@ subflows_config:
|
|
34 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
35 |
regex_fallback:
|
36 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
|
|
37 |
output_key: "plan"
|
38 |
strip: True
|
39 |
assert_unique: True
|
40 |
|
41 |
- _target_: flows.data_transformations.EndOfInteraction
|
42 |
end_of_interaction_string: "Final answer"
|
|
|
43 |
output_key: "end_of_interaction"
|
44 |
|
45 |
output_keys:
|
@@ -48,3 +48,7 @@ subflows_config:
|
|
48 |
|
49 |
- _target_: martinjosifoski.CC_flows.FixedReply_PlanReflect.instantiate_from_default_config
|
50 |
|
|
|
|
|
|
|
|
|
|
1 |
name: "PlanReflect_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
4 |
max_rounds: 2 # ToDo: increase to 4
|
5 |
early_exit_key: "end_of_interaction"
|
6 |
|
|
|
14 |
output_data_transformations:
|
15 |
- _target_: flows.data_transformations.KeyRename
|
16 |
old_key2new_key:
|
17 |
+
plan: "plan"
|
18 |
output_keys:
|
19 |
- "plan"
|
20 |
|
|
|
32 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
33 |
regex_fallback:
|
34 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
35 |
+
input_key: "api_output"
|
36 |
output_key: "plan"
|
37 |
strip: True
|
38 |
assert_unique: True
|
39 |
|
40 |
- _target_: flows.data_transformations.EndOfInteraction
|
41 |
end_of_interaction_string: "Final answer"
|
42 |
+
input_key: "api_output"
|
43 |
output_key: "end_of_interaction"
|
44 |
|
45 |
output_keys:
|
|
|
48 |
|
49 |
- _target_: martinjosifoski.CC_flows.FixedReply_PlanReflect.instantiate_from_default_config
|
50 |
|
51 |
+
|
52 |
+
reset_every_round:
|
53 |
+
PlanGenerator_Flow: False # this is the name of the subflow, may be different for each config, needs to check !
|
54 |
+
PlanReflectCritic: True
|
CF_PlanReflect_Code.yaml
CHANGED
@@ -13,7 +13,7 @@ input_keys:
|
|
13 |
output_data_transformations:
|
14 |
- _target_: flows.data_transformations.KeyRename
|
15 |
old_key2new_key:
|
16 |
-
|
17 |
output_keys:
|
18 |
- "code"
|
19 |
|
|
|
13 |
output_data_transformations:
|
14 |
- _target_: flows.data_transformations.KeyRename
|
15 |
old_key2new_key:
|
16 |
+
code: "code"
|
17 |
output_keys:
|
18 |
- "code"
|
19 |
|
CF_Plan_Code.yaml
CHANGED
@@ -1,26 +1,25 @@
|
|
1 |
name: "Plan_Code_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
early_exit_key: null
|
5 |
-
|
6 |
-
input_data_transformations: []
|
7 |
input_keys:
|
8 |
- "problem_description"
|
9 |
- "input_description"
|
10 |
- "output_description"
|
11 |
- "io_examples_and_explanation"
|
12 |
|
13 |
-
output_data_transformations:
|
14 |
-
- _target_: flows.data_transformations.KeyRename
|
15 |
-
old_key2new_key:
|
16 |
-
raw_response.code: "code"
|
17 |
output_keys:
|
18 |
- "code"
|
19 |
|
20 |
subflows_config:
|
21 |
-
|
|
|
22 |
overrides:
|
23 |
model_name: "gpt-4"
|
24 |
-
|
|
|
25 |
overrides:
|
26 |
model_name: "gpt-4"
|
|
|
|
|
|
|
|
|
|
1 |
name: "Plan_Code_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
|
|
4 |
input_keys:
|
5 |
- "problem_description"
|
6 |
- "input_description"
|
7 |
- "output_description"
|
8 |
- "io_examples_and_explanation"
|
9 |
|
|
|
|
|
|
|
|
|
10 |
output_keys:
|
11 |
- "code"
|
12 |
|
13 |
subflows_config:
|
14 |
+
CF_Plan:
|
15 |
+
_target_: martinjosifoski.CC_flows.CF_Plan.instantiate_from_default_config
|
16 |
overrides:
|
17 |
model_name: "gpt-4"
|
18 |
+
CF_CodeWithPlan:
|
19 |
+
_target_: martinjosifoski.CC_flows.CF_CodeWithPlan.instantiate_from_default_config
|
20 |
overrides:
|
21 |
model_name: "gpt-4"
|
22 |
+
|
23 |
+
topology:
|
24 |
+
- flow: CF_Plan
|
25 |
+
- flow: CF_CodeWithPlan
|
CodeTesting.py
CHANGED
@@ -2,7 +2,7 @@ from copy import deepcopy
|
|
2 |
from typing import Optional, Any, List, Dict
|
3 |
|
4 |
from flows import logging
|
5 |
-
from flows.base_flows
|
6 |
|
7 |
log = logging.get_logger(__name__)
|
8 |
|
@@ -33,14 +33,12 @@ class CodeTesting(AtomicFlow):
|
|
33 |
return cls(**kwargs)
|
34 |
|
35 |
def run(self,
|
36 |
-
input_data: Dict[str, Any],
|
37 |
-
private_keys: Optional[List[str]] = [],
|
38 |
-
keys_to_ignore_for_hash: Optional[List[str]] = []) -> Dict[str, Any]:
|
39 |
|
40 |
# ~~~ Retrieve the test data ~~~
|
41 |
test_data = self._get_test_data(input_data)
|
42 |
|
43 |
# ~~~ Run tests ~~~
|
44 |
-
response = self._run_tests(input_data, test_data)
|
45 |
|
46 |
return response
|
|
|
2 |
from typing import Optional, Any, List, Dict
|
3 |
|
4 |
from flows import logging
|
5 |
+
from flows.base_flows import AtomicFlow
|
6 |
|
7 |
log = logging.get_logger(__name__)
|
8 |
|
|
|
33 |
return cls(**kwargs)
|
34 |
|
35 |
def run(self,
|
36 |
+
input_data: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
|
|
37 |
|
38 |
# ~~~ Retrieve the test data ~~~
|
39 |
test_data = self._get_test_data(input_data)
|
40 |
|
41 |
# ~~~ Run tests ~~~
|
42 |
+
response: Dict[str, Any] = self._run_tests(input_data, test_data)
|
43 |
|
44 |
return response
|
FixedReply_CodeReflect.yaml
CHANGED
@@ -8,7 +8,7 @@ input_keys: []
|
|
8 |
output_data_transformations:
|
9 |
- _target_: flows.data_transformations.KeyRename
|
10 |
old_key2new_key:
|
11 |
-
|
12 |
output_keys:
|
13 |
- "code_reflect_message"
|
14 |
|
|
|
8 |
output_data_transformations:
|
9 |
- _target_: flows.data_transformations.KeyRename
|
10 |
old_key2new_key:
|
11 |
+
fixed_reply: "code_reflect_message"
|
12 |
output_keys:
|
13 |
- "code_reflect_message"
|
14 |
|
FixedReply_PlanReflect.yaml
CHANGED
@@ -8,7 +8,7 @@ input_keys: []
|
|
8 |
output_data_transformations:
|
9 |
- _target_: flows.data_transformations.KeyRename
|
10 |
old_key2new_key:
|
11 |
-
|
12 |
output_keys:
|
13 |
- "plan_reflect_message"
|
14 |
|
|
|
8 |
output_data_transformations:
|
9 |
- _target_: flows.data_transformations.KeyRename
|
10 |
old_key2new_key:
|
11 |
+
fixed_reply: "plan_reflect_message"
|
12 |
output_keys:
|
13 |
- "plan_reflect_message"
|
14 |
|
LC_Code.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
from
|
2 |
-
|
3 |
|
4 |
class LC_Code(OpenAIChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
|
|
2 |
|
3 |
class LC_Code(OpenAIChatAtomicFlow):
|
4 |
def __init__(self, **kwargs):
|
LC_Code.yaml
CHANGED
@@ -33,7 +33,7 @@ human_message_prompt_template:
|
|
33 |
- "query"
|
34 |
template_format: jinja2
|
35 |
|
36 |
-
|
37 |
_target_: langchain.PromptTemplate
|
38 |
template: |2-
|
39 |
# Problem statement
|
@@ -64,7 +64,7 @@ query_message_prompt_template:
|
|
64 |
template_format: jinja2
|
65 |
|
66 |
input_data_transformations: []
|
67 |
-
|
68 |
- "problem_description"
|
69 |
- "io_description"
|
70 |
- "constraints"
|
@@ -74,7 +74,7 @@ output_data_transformations:
|
|
74 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
75 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
76 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
77 |
-
input_key: "
|
78 |
output_key: "code"
|
79 |
strip: True
|
80 |
assert_unique: True
|
|
|
33 |
- "query"
|
34 |
template_format: jinja2
|
35 |
|
36 |
+
init_human_message_prompt_template:
|
37 |
_target_: langchain.PromptTemplate
|
38 |
template: |2-
|
39 |
# Problem statement
|
|
|
64 |
template_format: jinja2
|
65 |
|
66 |
input_data_transformations: []
|
67 |
+
init_input_keys:
|
68 |
- "problem_description"
|
69 |
- "io_description"
|
70 |
- "constraints"
|
|
|
74 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
75 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
76 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
77 |
+
input_key: "api_output"
|
78 |
output_key: "code"
|
79 |
strip: True
|
80 |
assert_unique: True
|
LC_CodeCollab.yaml
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
name: "CodeCollab_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
reset_generator_every_round: False
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDO: To increase to 4
|
7 |
early_exit_key: "end_of_interaction"
|
8 |
|
@@ -16,7 +14,7 @@ input_keys:
|
|
16 |
output_data_transformations:
|
17 |
- _target_: flows.data_transformations.KeyRename
|
18 |
old_key2new_key:
|
19 |
-
|
20 |
output_keys:
|
21 |
- "code"
|
22 |
|
@@ -43,19 +41,20 @@ subflows_config:
|
|
43 |
partial_variables:
|
44 |
code_placeholder: "{{python_code}}"
|
45 |
template_format: jinja2
|
46 |
-
|
47 |
- "code_feedback"
|
48 |
output_data_transformations:
|
49 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
50 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
51 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
52 |
-
input_key: "
|
53 |
output_key: "code"
|
54 |
strip: True
|
55 |
assert_unique: True
|
56 |
|
57 |
- _target_: flows.data_transformations.EndOfInteraction
|
58 |
end_of_interaction_string: "Final answer"
|
|
|
59 |
output_key: "end_of_interaction"
|
60 |
|
61 |
output_keys:
|
@@ -67,4 +66,8 @@ subflows_config:
|
|
67 |
output_data_transformations:
|
68 |
- _target_: flows.data_transformations.KeyRename
|
69 |
old_key2new_key:
|
70 |
-
|
|
|
|
|
|
|
|
|
|
1 |
name: "CodeCollab_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
4 |
max_rounds: 2 # ToDO: To increase to 4
|
5 |
early_exit_key: "end_of_interaction"
|
6 |
|
|
|
14 |
output_data_transformations:
|
15 |
- _target_: flows.data_transformations.KeyRename
|
16 |
old_key2new_key:
|
17 |
+
code: "code"
|
18 |
output_keys:
|
19 |
- "code"
|
20 |
|
|
|
41 |
partial_variables:
|
42 |
code_placeholder: "{{python_code}}"
|
43 |
template_format: jinja2
|
44 |
+
input_keys:
|
45 |
- "code_feedback"
|
46 |
output_data_transformations:
|
47 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
48 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
49 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
50 |
+
input_key: "api_output"
|
51 |
output_key: "code"
|
52 |
strip: True
|
53 |
assert_unique: True
|
54 |
|
55 |
- _target_: flows.data_transformations.EndOfInteraction
|
56 |
end_of_interaction_string: "Final answer"
|
57 |
+
input_key: "api_output"
|
58 |
output_key: "end_of_interaction"
|
59 |
|
60 |
output_keys:
|
|
|
66 |
output_data_transformations:
|
67 |
- _target_: flows.data_transformations.KeyRename
|
68 |
old_key2new_key:
|
69 |
+
api_output: "code_feedback"
|
70 |
+
|
71 |
+
reset_every_round:
|
72 |
+
CodeGenerator: False
|
73 |
+
CodeCritic: True
|
LC_CodeCritic.py
CHANGED
@@ -1,6 +1,4 @@
|
|
1 |
-
from
|
2 |
-
|
3 |
-
|
4 |
|
5 |
class LC_CodeCritic(OpenAIChatAtomicFlow):
|
6 |
def __init__(self, **kwargs):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
|
|
|
|
2 |
|
3 |
class LC_CodeCritic(OpenAIChatAtomicFlow):
|
4 |
def __init__(self, **kwargs):
|
LC_CodeCritic.yaml
CHANGED
@@ -36,7 +36,7 @@ human_message_prompt_template:
|
|
36 |
- "query"
|
37 |
template_format: jinja2
|
38 |
|
39 |
-
|
40 |
_target_: langchain.PromptTemplate
|
41 |
template: |2-
|
42 |
# Problem statement
|
@@ -67,7 +67,7 @@ query_message_prompt_template:
|
|
67 |
- "code"
|
68 |
template_format: jinja2
|
69 |
|
70 |
-
|
71 |
- "problem_description"
|
72 |
- "io_description"
|
73 |
- "constraints"
|
|
|
36 |
- "query"
|
37 |
template_format: jinja2
|
38 |
|
39 |
+
init_human_message_prompt_template:
|
40 |
_target_: langchain.PromptTemplate
|
41 |
template: |2-
|
42 |
# Problem statement
|
|
|
67 |
- "code"
|
68 |
template_format: jinja2
|
69 |
|
70 |
+
init_input_keys:
|
71 |
- "problem_description"
|
72 |
- "io_description"
|
73 |
- "constraints"
|
LC_CodeCriticWrongAttempt.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
from
|
2 |
-
|
3 |
|
4 |
class LC_CodeCriticWrongAttempt(OpenAIChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
|
|
2 |
|
3 |
class LC_CodeCriticWrongAttempt(OpenAIChatAtomicFlow):
|
4 |
def __init__(self, **kwargs):
|
LC_CodeCriticWrongAttempt.yaml
CHANGED
@@ -37,7 +37,7 @@ human_message_prompt_template:
|
|
37 |
- "query"
|
38 |
template_format: jinja2
|
39 |
|
40 |
-
|
41 |
_target_: langchain.PromptTemplate
|
42 |
template: |2-
|
43 |
# Problem statement
|
@@ -72,7 +72,7 @@ query_message_prompt_template:
|
|
72 |
template_format: jinja2
|
73 |
|
74 |
input_data_transformations: []
|
75 |
-
|
76 |
- "problem_description"
|
77 |
- "io_description"
|
78 |
- "constraints"
|
@@ -83,6 +83,6 @@ input_keys:
|
|
83 |
output_data_transformations:
|
84 |
- _target_: flows.data_transformations.KeyRename
|
85 |
old_key2new_key:
|
86 |
-
|
87 |
output_keys:
|
88 |
- "code_feedback"
|
|
|
37 |
- "query"
|
38 |
template_format: jinja2
|
39 |
|
40 |
+
init_human_message_prompt_template:
|
41 |
_target_: langchain.PromptTemplate
|
42 |
template: |2-
|
43 |
# Problem statement
|
|
|
72 |
template_format: jinja2
|
73 |
|
74 |
input_data_transformations: []
|
75 |
+
init_input_keys:
|
76 |
- "problem_description"
|
77 |
- "io_description"
|
78 |
- "constraints"
|
|
|
83 |
output_data_transformations:
|
84 |
- _target_: flows.data_transformations.KeyRename
|
85 |
old_key2new_key:
|
86 |
+
api_output: "code_feedback"
|
87 |
output_keys:
|
88 |
- "code_feedback"
|
LC_CodeCriticWrongAttemptWithPlan.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
from
|
2 |
-
|
3 |
|
4 |
class LC_CodeCriticWrongAttemptWithPlan(OpenAIChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
|
|
2 |
|
3 |
class LC_CodeCriticWrongAttemptWithPlan(OpenAIChatAtomicFlow):
|
4 |
def __init__(self, **kwargs):
|
LC_CodeCriticWrongAttemptWithPlan.yaml
CHANGED
@@ -39,7 +39,7 @@ human_message_prompt_template:
|
|
39 |
- "query"
|
40 |
template_format: jinja2
|
41 |
|
42 |
-
|
43 |
_target_: langchain.PromptTemplate
|
44 |
template: |2-
|
45 |
# Problem statement
|
@@ -79,7 +79,7 @@ query_message_prompt_template:
|
|
79 |
template_format: jinja2
|
80 |
|
81 |
input_data_transformations: []
|
82 |
-
|
83 |
- "problem_description"
|
84 |
- "io_description"
|
85 |
- "constraints"
|
@@ -91,6 +91,6 @@ input_keys:
|
|
91 |
output_data_transformations:
|
92 |
- _target_: flows.data_transformations.KeyRename
|
93 |
old_key2new_key:
|
94 |
-
|
95 |
output_keys:
|
96 |
- "code_feedback"
|
|
|
39 |
- "query"
|
40 |
template_format: jinja2
|
41 |
|
42 |
+
init_human_message_prompt_template:
|
43 |
_target_: langchain.PromptTemplate
|
44 |
template: |2-
|
45 |
# Problem statement
|
|
|
79 |
template_format: jinja2
|
80 |
|
81 |
input_data_transformations: []
|
82 |
+
init_input_keys:
|
83 |
- "problem_description"
|
84 |
- "io_description"
|
85 |
- "constraints"
|
|
|
91 |
output_data_transformations:
|
92 |
- _target_: flows.data_transformations.KeyRename
|
93 |
old_key2new_key:
|
94 |
+
api_output: "code_feedback"
|
95 |
output_keys:
|
96 |
- "code_feedback"
|
LC_CodeDebug.yaml
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
name: "CodeDebug_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
reset_generator_every_round: False
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDo: To increase to 4
|
7 |
early_exit_key: "end_of_interaction"
|
8 |
|
@@ -17,7 +15,7 @@ input_keys:
|
|
17 |
output_data_transformations:
|
18 |
- _target_: flows.data_transformations.KeyRename
|
19 |
old_key2new_key:
|
20 |
-
|
21 |
output_keys:
|
22 |
- "code"
|
23 |
|
@@ -39,20 +37,21 @@ subflows_config:
|
|
39 |
- testing_results_summary
|
40 |
partial_variables:
|
41 |
code_placeholder: "{{python_code}}"
|
42 |
-
|
43 |
- "testing_results_summary"
|
44 |
- "all_tests_passed"
|
45 |
output_data_transformations:
|
46 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
47 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
48 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
49 |
-
input_key: "
|
50 |
output_key: "code"
|
51 |
strip: True
|
52 |
assert_unique: True
|
53 |
|
54 |
- _target_: flows.data_transformations.EndOfInteraction
|
55 |
end_of_interaction_string: "Final answer"
|
|
|
56 |
output_key: "end_of_interaction"
|
57 |
|
58 |
output_keys:
|
@@ -61,3 +60,7 @@ subflows_config:
|
|
61 |
- _target_: martinjosifoski.CC_flows.LC_CodeTesting.instantiate_from_default_config
|
62 |
overrides:
|
63 |
name: "CodeTestingCritic"
|
|
|
|
|
|
|
|
|
|
1 |
name: "CodeDebug_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
4 |
max_rounds: 2 # ToDo: To increase to 4
|
5 |
early_exit_key: "end_of_interaction"
|
6 |
|
|
|
15 |
output_data_transformations:
|
16 |
- _target_: flows.data_transformations.KeyRename
|
17 |
old_key2new_key:
|
18 |
+
code: "code"
|
19 |
output_keys:
|
20 |
- "code"
|
21 |
|
|
|
37 |
- testing_results_summary
|
38 |
partial_variables:
|
39 |
code_placeholder: "{{python_code}}"
|
40 |
+
input_keys:
|
41 |
- "testing_results_summary"
|
42 |
- "all_tests_passed"
|
43 |
output_data_transformations:
|
44 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
45 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
46 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
47 |
+
input_key: "api_output"
|
48 |
output_key: "code"
|
49 |
strip: True
|
50 |
assert_unique: True
|
51 |
|
52 |
- _target_: flows.data_transformations.EndOfInteraction
|
53 |
end_of_interaction_string: "Final answer"
|
54 |
+
input_key: "api_output"
|
55 |
output_key: "end_of_interaction"
|
56 |
|
57 |
output_keys:
|
|
|
60 |
- _target_: martinjosifoski.CC_flows.LC_CodeTesting.instantiate_from_default_config
|
61 |
overrides:
|
62 |
name: "CodeTestingCritic"
|
63 |
+
|
64 |
+
reset_every_round:
|
65 |
+
CodeGenerator: False
|
66 |
+
CodeTestingCritic: True
|
LC_CodeDebugCollab.yaml
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
name: "CodeDebugCollab_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
reset_generator_every_round: False
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDo: To increase to 4
|
7 |
early_exit_key: "end_of_interaction"
|
8 |
|
@@ -17,7 +15,7 @@ input_keys:
|
|
17 |
output_data_transformations:
|
18 |
- _target_: flows.data_transformations.KeyRename
|
19 |
old_key2new_key:
|
20 |
-
|
21 |
output_keys:
|
22 |
- "code"
|
23 |
|
@@ -44,20 +42,21 @@ subflows_config:
|
|
44 |
partial_variables:
|
45 |
code_placeholder: "{{python_code}}"
|
46 |
template_format: jinja2
|
47 |
-
|
48 |
- "code_feedback"
|
49 |
- "testing_results_summary"
|
50 |
output_data_transformations:
|
51 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
52 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
53 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
54 |
-
input_key: "
|
55 |
output_key: "code"
|
56 |
strip: True
|
57 |
assert_unique: True
|
58 |
|
59 |
- _target_: flows.data_transformations.EndOfInteraction
|
60 |
end_of_interaction_string: "Final answer"
|
|
|
61 |
output_key: "end_of_interaction"
|
62 |
|
63 |
output_keys:
|
@@ -65,3 +64,7 @@ subflows_config:
|
|
65 |
- "end_of_interaction"
|
66 |
- _target_: martinjosifoski.CC_flows.LC_CodeDebugCritic.instantiate_from_default_config
|
67 |
|
|
|
|
|
|
|
|
|
|
1 |
name: "CodeDebugCollab_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
4 |
max_rounds: 2 # ToDo: To increase to 4
|
5 |
early_exit_key: "end_of_interaction"
|
6 |
|
|
|
15 |
output_data_transformations:
|
16 |
- _target_: flows.data_transformations.KeyRename
|
17 |
old_key2new_key:
|
18 |
+
code: "code"
|
19 |
output_keys:
|
20 |
- "code"
|
21 |
|
|
|
42 |
partial_variables:
|
43 |
code_placeholder: "{{python_code}}"
|
44 |
template_format: jinja2
|
45 |
+
input_keys:
|
46 |
- "code_feedback"
|
47 |
- "testing_results_summary"
|
48 |
output_data_transformations:
|
49 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
50 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
51 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
52 |
+
input_key: "api_output"
|
53 |
output_key: "code"
|
54 |
strip: True
|
55 |
assert_unique: True
|
56 |
|
57 |
- _target_: flows.data_transformations.EndOfInteraction
|
58 |
end_of_interaction_string: "Final answer"
|
59 |
+
input_key: "api_output"
|
60 |
output_key: "end_of_interaction"
|
61 |
|
62 |
output_keys:
|
|
|
64 |
- "end_of_interaction"
|
65 |
- _target_: martinjosifoski.CC_flows.LC_CodeDebugCritic.instantiate_from_default_config
|
66 |
|
67 |
+
|
68 |
+
reset_every_round:
|
69 |
+
CodeGenerator: False
|
70 |
+
CodeDebugCritic_Flow: True
|
LC_CodeDebugCollabWithPlan.yaml
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
name: "CodeDebugCollabWithPlan_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
reset_generator_every_round: False
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDo: To increase to 4
|
7 |
early_exit_key: "end_of_interaction"
|
8 |
|
@@ -18,7 +16,7 @@ input_keys:
|
|
18 |
output_data_transformations:
|
19 |
- _target_: flows.data_transformations.KeyRename
|
20 |
old_key2new_key:
|
21 |
-
|
22 |
output_keys:
|
23 |
- "code"
|
24 |
|
@@ -45,23 +43,29 @@ subflows_config:
|
|
45 |
partial_variables:
|
46 |
code_placeholder: "{{python_code}}"
|
47 |
template_format: jinja2
|
48 |
-
|
49 |
- "code_feedback"
|
50 |
- "testing_results_summary"
|
51 |
output_data_transformations:
|
52 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
53 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
54 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
55 |
-
input_key: "
|
56 |
output_key: "code"
|
57 |
strip: True
|
58 |
assert_unique: True
|
59 |
|
60 |
- _target_: flows.data_transformations.EndOfInteraction
|
61 |
end_of_interaction_string: "Final answer"
|
|
|
62 |
output_key: "end_of_interaction"
|
63 |
|
64 |
output_keys:
|
65 |
- "code"
|
66 |
- "end_of_interaction"
|
67 |
- _target_: martinjosifoski.CC_flows.LC_CodeDebugCriticWithPlan.instantiate_from_default_config
|
|
|
|
|
|
|
|
|
|
|
|
1 |
name: "CodeDebugCollabWithPlan_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
4 |
max_rounds: 2 # ToDo: To increase to 4
|
5 |
early_exit_key: "end_of_interaction"
|
6 |
|
|
|
16 |
output_data_transformations:
|
17 |
- _target_: flows.data_transformations.KeyRename
|
18 |
old_key2new_key:
|
19 |
+
code: "code"
|
20 |
output_keys:
|
21 |
- "code"
|
22 |
|
|
|
43 |
partial_variables:
|
44 |
code_placeholder: "{{python_code}}"
|
45 |
template_format: jinja2
|
46 |
+
input_keys:
|
47 |
- "code_feedback"
|
48 |
- "testing_results_summary"
|
49 |
output_data_transformations:
|
50 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
51 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
52 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
53 |
+
input_key: "api_output"
|
54 |
output_key: "code"
|
55 |
strip: True
|
56 |
assert_unique: True
|
57 |
|
58 |
- _target_: flows.data_transformations.EndOfInteraction
|
59 |
end_of_interaction_string: "Final answer"
|
60 |
+
input_key: "api_output"
|
61 |
output_key: "end_of_interaction"
|
62 |
|
63 |
output_keys:
|
64 |
- "code"
|
65 |
- "end_of_interaction"
|
66 |
- _target_: martinjosifoski.CC_flows.LC_CodeDebugCriticWithPlan.instantiate_from_default_config
|
67 |
+
|
68 |
+
|
69 |
+
reset_every_round:
|
70 |
+
CodeGenerator: False
|
71 |
+
CodeDebugCriticWithPlan_Flow: True
|
LC_CodeDebugCritic.yaml
CHANGED
@@ -15,9 +15,9 @@ input_keys:
|
|
15 |
output_data_transformations:
|
16 |
- _target_: flows.data_transformations.KeyRename
|
17 |
old_key2new_key:
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
output_keys:
|
22 |
- "testing_results_summary"
|
23 |
- "all_tests_passed"
|
|
|
15 |
output_data_transformations:
|
16 |
- _target_: flows.data_transformations.KeyRename
|
17 |
old_key2new_key:
|
18 |
+
testing_results_summary: "testing_results_summary"
|
19 |
+
all_tests_passed: "all_tests_passed"
|
20 |
+
code_feedback: "code_feedback"
|
21 |
output_keys:
|
22 |
- "testing_results_summary"
|
23 |
- "all_tests_passed"
|
LC_CodeDebugCriticWithPlan.yaml
CHANGED
@@ -16,9 +16,9 @@ input_keys:
|
|
16 |
output_data_transformations:
|
17 |
- _target_: flows.data_transformations.KeyRename
|
18 |
old_key2new_key:
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
output_keys:
|
23 |
- "testing_results_summary"
|
24 |
- "all_tests_passed"
|
|
|
16 |
output_data_transformations:
|
17 |
- _target_: flows.data_transformations.KeyRename
|
18 |
old_key2new_key:
|
19 |
+
testing_results_summary: "testing_results_summary"
|
20 |
+
all_tests_passed: "all_tests_passed"
|
21 |
+
code_feedback: "code_feedback"
|
22 |
output_keys:
|
23 |
- "testing_results_summary"
|
24 |
- "all_tests_passed"
|
LC_CodeReflect.yaml
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
name: "CodeReflect_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
4 |
-
reset_generator_every_round: False
|
5 |
-
reset_critic_every_round: True
|
6 |
max_rounds: 2 # ToDo: To increase to 4
|
7 |
early_exit_key: "end_of_interaction"
|
8 |
|
@@ -16,7 +14,7 @@ input_keys:
|
|
16 |
output_data_transformations:
|
17 |
- _target_: flows.data_transformations.KeyRename
|
18 |
old_key2new_key:
|
19 |
-
|
20 |
output_keys:
|
21 |
- "code"
|
22 |
|
@@ -33,12 +31,14 @@ subflows_config:
|
|
33 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
34 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
35 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
|
|
36 |
output_key: "code"
|
37 |
strip: True
|
38 |
assert_unique: True
|
39 |
|
40 |
- _target_: flows.data_transformations.EndOfInteraction
|
41 |
end_of_interaction_string: "Final answer"
|
|
|
42 |
output_key: "end_of_interaction"
|
43 |
|
44 |
output_keys:
|
@@ -46,3 +46,7 @@ subflows_config:
|
|
46 |
- "end_of_interaction"
|
47 |
|
48 |
- _target_: martinjosifoski.CC_flows.FixedReply_CodeReflect.instantiate_from_default_config
|
|
|
|
|
|
|
|
|
|
1 |
name: "CodeReflect_Flow"
|
2 |
description: "ToDO: add description"
|
3 |
|
|
|
|
|
4 |
max_rounds: 2 # ToDo: To increase to 4
|
5 |
early_exit_key: "end_of_interaction"
|
6 |
|
|
|
14 |
output_data_transformations:
|
15 |
- _target_: flows.data_transformations.KeyRename
|
16 |
old_key2new_key:
|
17 |
+
code: "code"
|
18 |
output_keys:
|
19 |
- "code"
|
20 |
|
|
|
31 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
32 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
33 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
34 |
+
input_key: "api_output"
|
35 |
output_key: "code"
|
36 |
strip: True
|
37 |
assert_unique: True
|
38 |
|
39 |
- _target_: flows.data_transformations.EndOfInteraction
|
40 |
end_of_interaction_string: "Final answer"
|
41 |
+
input_key: "api_output"
|
42 |
output_key: "end_of_interaction"
|
43 |
|
44 |
output_keys:
|
|
|
46 |
- "end_of_interaction"
|
47 |
|
48 |
- _target_: martinjosifoski.CC_flows.FixedReply_CodeReflect.instantiate_from_default_config
|
49 |
+
|
50 |
+
reset_every_round:
|
51 |
+
CodeGenerator: False
|
52 |
+
CodeReflectCritic: True
|
LC_CodeTesting.yaml
CHANGED
@@ -12,7 +12,7 @@ output_keys:
|
|
12 |
- "testing_results_summary"
|
13 |
output_data_transformations:
|
14 |
- _target_: .src.data_transformations.CorrectnessFlag
|
15 |
-
input_key: "
|
16 |
output_key: "all_tests_passed"
|
17 |
- _target_: .src.data_transformations.TestingResultsSummaryGeneration
|
18 |
output_key: "testing_results_summary"
|
|
|
12 |
- "testing_results_summary"
|
13 |
output_data_transformations:
|
14 |
- _target_: .src.data_transformations.CorrectnessFlag
|
15 |
+
input_key: "public_tests_results"
|
16 |
output_key: "all_tests_passed"
|
17 |
- _target_: .src.data_transformations.TestingResultsSummaryGeneration
|
18 |
output_key: "testing_results_summary"
|
LC_CodeWithPlan.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
from
|
2 |
-
|
3 |
|
4 |
class LC_CodeWithPlan(OpenAIChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
|
|
2 |
|
3 |
class LC_CodeWithPlan(OpenAIChatAtomicFlow):
|
4 |
def __init__(self, **kwargs):
|
LC_CodeWithPlan.yaml
CHANGED
@@ -35,7 +35,7 @@ human_message_prompt_template:
|
|
35 |
- "query"
|
36 |
template_format: jinja2
|
37 |
|
38 |
-
|
39 |
_target_: langchain.PromptTemplate
|
40 |
template: |2-
|
41 |
# Problem statement
|
@@ -72,7 +72,7 @@ query_message_prompt_template:
|
|
72 |
template_format: jinja2
|
73 |
|
74 |
input_data_transformations: []
|
75 |
-
|
76 |
- "problem_description"
|
77 |
- "io_description"
|
78 |
- "constraints"
|
@@ -83,6 +83,7 @@ output_data_transformations:
|
|
83 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
84 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
85 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
|
|
86 |
output_key: "code"
|
87 |
strip: True
|
88 |
assert_unique: True
|
|
|
35 |
- "query"
|
36 |
template_format: jinja2
|
37 |
|
38 |
+
init_human_message_prompt_template:
|
39 |
_target_: langchain.PromptTemplate
|
40 |
template: |2-
|
41 |
# Problem statement
|
|
|
72 |
template_format: jinja2
|
73 |
|
74 |
input_data_transformations: []
|
75 |
+
init_input_keys:
|
76 |
- "problem_description"
|
77 |
- "io_description"
|
78 |
- "constraints"
|
|
|
83 |
- _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
|
84 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
85 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
86 |
+
input_key: "api_output"
|
87 |
output_key: "code"
|
88 |
strip: True
|
89 |
assert_unique: True
|
LC_Plan.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
from
|
2 |
-
|
3 |
|
4 |
class LC_Plan(OpenAIChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
|
|
1 |
+
from flows.application_flows import OpenAIChatAtomicFlow
|
|
|
2 |
|
3 |
class LC_Plan(OpenAIChatAtomicFlow):
|
4 |
def __init__(self, **kwargs):
|
LC_Plan.yaml
CHANGED
@@ -13,7 +13,7 @@ generation_parameters:
|
|
13 |
presence_penalty: 0
|
14 |
|
15 |
input_data_transformations: []
|
16 |
-
|
17 |
- "problem_description"
|
18 |
- "io_description"
|
19 |
- "constraints"
|
@@ -23,6 +23,7 @@ output_data_transformations:
|
|
23 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
24 |
regex_fallback:
|
25 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
|
|
26 |
output_key: "plan"
|
27 |
strip: True
|
28 |
assert_unique: True
|
@@ -53,7 +54,7 @@ human_message_prompt_template:
|
|
53 |
- "query"
|
54 |
template_format: jinja2
|
55 |
|
56 |
-
|
57 |
_target_: langchain.PromptTemplate
|
58 |
template: |2-
|
59 |
# Problem statement
|
|
|
13 |
presence_penalty: 0
|
14 |
|
15 |
input_data_transformations: []
|
16 |
+
init_input_keys:
|
17 |
- "problem_description"
|
18 |
- "io_description"
|
19 |
- "constraints"
|
|
|
23 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
24 |
regex_fallback:
|
25 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
26 |
+
input_key: "api_output"
|
27 |
output_key: "plan"
|
28 |
strip: True
|
29 |
assert_unique: True
|
|
|
54 |
- "query"
|
55 |
template_format: jinja2
|
56 |
|
57 |
+
init_human_message_prompt_template:
|
58 |
_target_: langchain.PromptTemplate
|
59 |
template: |2-
|
60 |
# Problem statement
|