renamed flows to aiflows
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- CF_Code.py +2 -2
- CF_Code.yaml +4 -4
- CF_CodeCollab.py +1 -1
- CF_CodeCollab.yaml +10 -10
- CF_CodeCritic.py +2 -2
- CF_CodeCritic.yaml +4 -4
- CF_CodeCriticWrongAttempt.py +2 -2
- CF_CodeCriticWrongAttempt.yaml +4 -4
- CF_CodeCriticWrongAttemptWithPlan.py +2 -2
- CF_CodeCriticWrongAttemptWithPlan.yaml +4 -4
- CF_CodeDebug.py +1 -1
- CF_CodeDebug.yaml +9 -9
- CF_CodeDebugCollab.py +1 -1
- CF_CodeDebugCollab.yaml +8 -8
- CF_CodeDebugCollabWithPlan.py +1 -1
- CF_CodeDebugCollabWithPlan.yaml +8 -8
- CF_CodeDebugCritic.py +1 -1
- CF_CodeDebugCritic.yaml +7 -7
- CF_CodeDebugCriticWithPlan.py +1 -1
- CF_CodeDebugCriticWithPlan.yaml +7 -7
- CF_CodeReflect.py +1 -1
- CF_CodeReflect.yaml +9 -9
- CF_CodeTesting.py +2 -2
- CF_CodeWithPlan.py +2 -2
- CF_CodeWithPlan.yaml +4 -4
- CF_Plan.py +2 -2
- CF_Plan.yaml +3 -3
- CF_PlanCollab.py +1 -1
- CF_PlanCollab.yaml +10 -10
- CF_PlanCollab_Code.py +1 -1
- CF_PlanCollab_Code.yaml +8 -8
- CF_PlanCritic.py +2 -2
- CF_PlanCritic.yaml +4 -4
- CF_PlanReflect.py +1 -1
- CF_PlanReflect.yaml +9 -9
- CF_PlanReflect_Code.py +1 -1
- CF_PlanReflect_Code.yaml +8 -8
- CF_Plan_Code.py +1 -1
- CF_Plan_Code.yaml +10 -10
- CodeTesting.py +2 -2
- LC_Code.py +2 -2
- LC_Code.yaml +4 -4
- LC_CodeCollab.py +1 -1
- LC_CodeCollab.yaml +10 -10
- LC_CodeCritic.py +2 -2
- LC_CodeCritic.yaml +4 -4
- LC_CodeCriticWrongAttempt.py +2 -2
- LC_CodeCriticWrongAttempt.yaml +4 -4
- LC_CodeDebug.py +1 -1
- LC_CodeDebug.yaml +9 -9
CF_Code.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from flow_modules.aiflows.
|
2 |
|
3 |
|
4 |
-
class CF_Code(
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
|
|
1 |
+
from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow
|
2 |
|
3 |
|
4 |
+
class CF_Code(ChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
CF_Code.yaml
CHANGED
@@ -18,7 +18,7 @@ output_interface:
|
|
18 |
|
19 |
# ~~~ Flow specification ~~~
|
20 |
backend:
|
21 |
-
_target_:
|
22 |
wait_time_per_key: 6
|
23 |
model_name:
|
24 |
openai: "gpt-4"
|
@@ -31,7 +31,7 @@ backend:
|
|
31 |
presence_penalty: 0
|
32 |
|
33 |
system_message_prompt_template:
|
34 |
-
_target_:
|
35 |
template: |2-
|
36 |
Your goal is to provide executable Python code that solves a competitive programming problem. The code should correctly handle all corner cases in order to pass the hidden test cases, which are used to evaluate the correctness of the solution.
|
37 |
|
@@ -47,14 +47,14 @@ system_message_prompt_template:
|
|
47 |
|
48 |
|
49 |
human_message_prompt_template:
|
50 |
-
_target_:
|
51 |
template: "{{query}}"
|
52 |
input_variables:
|
53 |
- "query"
|
54 |
|
55 |
|
56 |
init_human_message_prompt_template:
|
57 |
-
_target_:
|
58 |
template: |2-
|
59 |
# Problem statement
|
60 |
{{problem_description}}
|
|
|
18 |
|
19 |
# ~~~ Flow specification ~~~
|
20 |
backend:
|
21 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
22 |
wait_time_per_key: 6
|
23 |
model_name:
|
24 |
openai: "gpt-4"
|
|
|
31 |
presence_penalty: 0
|
32 |
|
33 |
system_message_prompt_template:
|
34 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
35 |
template: |2-
|
36 |
Your goal is to provide executable Python code that solves a competitive programming problem. The code should correctly handle all corner cases in order to pass the hidden test cases, which are used to evaluate the correctness of the solution.
|
37 |
|
|
|
47 |
|
48 |
|
49 |
human_message_prompt_template:
|
50 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
51 |
template: "{{query}}"
|
52 |
input_variables:
|
53 |
- "query"
|
54 |
|
55 |
|
56 |
init_human_message_prompt_template:
|
57 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
58 |
template: |2-
|
59 |
# Problem statement
|
60 |
{{problem_description}}
|
CF_CodeCollab.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_CodeCollab(CircularFlow):
|
|
|
1 |
+
from aiflows.base_flows import CircularFlow
|
2 |
|
3 |
|
4 |
class CF_CodeCollab(CircularFlow):
|
CF_CodeCollab.yaml
CHANGED
@@ -18,7 +18,7 @@ subflows_config:
|
|
18 |
_target_: .CF_Code.instantiate_from_default_config
|
19 |
name: "CodeGenerator"
|
20 |
human_message_prompt_template:
|
21 |
-
_target_:
|
22 |
template: |2-
|
23 |
# Feedback on the last proposed solution
|
24 |
{{code_feedback}}
|
@@ -45,29 +45,29 @@ topology:
|
|
45 |
|
46 |
### Input Interface
|
47 |
input_interface:
|
48 |
-
_target_:
|
49 |
additional_transformations:
|
50 |
-
- _target_:
|
51 |
|
52 |
### Flow Specification
|
53 |
flow: CodeGenerator
|
54 |
|
55 |
### Output Interface
|
56 |
output_interface:
|
57 |
-
_target_:
|
58 |
additional_transformations:
|
59 |
-
- _target_:
|
60 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
61 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
62 |
input_key: "api_output"
|
63 |
output_key: "code"
|
64 |
strip: True
|
65 |
assert_unique: True
|
66 |
-
- _target_:
|
67 |
end_of_interaction_string: "Final answer"
|
68 |
input_key: "api_output"
|
69 |
output_key: "end_of_interaction"
|
70 |
-
- _target_:
|
71 |
reset: false
|
72 |
|
73 |
# ~~~ Code Critic ~~~
|
@@ -75,16 +75,16 @@ topology:
|
|
75 |
|
76 |
### Input Interface
|
77 |
input_interface:
|
78 |
-
_target_:
|
79 |
additional_transformations:
|
80 |
-
- _target_:
|
81 |
|
82 |
### Flow Specification
|
83 |
flow: CodeCritic
|
84 |
|
85 |
### Output Interface
|
86 |
output_interface:
|
87 |
-
_target_:
|
88 |
keys_to_rename:
|
89 |
api_output: "code_feedback"
|
90 |
|
|
|
18 |
_target_: .CF_Code.instantiate_from_default_config
|
19 |
name: "CodeGenerator"
|
20 |
human_message_prompt_template:
|
21 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
22 |
template: |2-
|
23 |
# Feedback on the last proposed solution
|
24 |
{{code_feedback}}
|
|
|
45 |
|
46 |
### Input Interface
|
47 |
input_interface:
|
48 |
+
_target_: aiflows.interfaces.KeyInterface
|
49 |
additional_transformations:
|
50 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
51 |
|
52 |
### Flow Specification
|
53 |
flow: CodeGenerator
|
54 |
|
55 |
### Output Interface
|
56 |
output_interface:
|
57 |
+
_target_: aiflows.interfaces.KeyInterface
|
58 |
additional_transformations:
|
59 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
60 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
61 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
62 |
input_key: "api_output"
|
63 |
output_key: "code"
|
64 |
strip: True
|
65 |
assert_unique: True
|
66 |
+
- _target_: aiflows.data_transformations.EndOfInteraction
|
67 |
end_of_interaction_string: "Final answer"
|
68 |
input_key: "api_output"
|
69 |
output_key: "end_of_interaction"
|
70 |
+
- _target_: aiflows.data_transformations.PrintPreviousMessages
|
71 |
reset: false
|
72 |
|
73 |
# ~~~ Code Critic ~~~
|
|
|
75 |
|
76 |
### Input Interface
|
77 |
input_interface:
|
78 |
+
_target_: aiflows.interfaces.KeyInterface
|
79 |
additional_transformations:
|
80 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
81 |
|
82 |
### Flow Specification
|
83 |
flow: CodeCritic
|
84 |
|
85 |
### Output Interface
|
86 |
output_interface:
|
87 |
+
_target_: aiflows.interfaces.KeyInterface
|
88 |
keys_to_rename:
|
89 |
api_output: "code_feedback"
|
90 |
|
CF_CodeCritic.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from flow_modules.aiflows.
|
2 |
|
3 |
|
4 |
-
class CF_CodeCritic(
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
|
|
1 |
+
from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow
|
2 |
|
3 |
|
4 |
+
class CF_CodeCritic(ChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
CF_CodeCritic.yaml
CHANGED
@@ -19,7 +19,7 @@ output_interface:
|
|
19 |
|
20 |
# ~~~ Flow specification ~~~
|
21 |
backend:
|
22 |
-
_target_:
|
23 |
api_infos: ???
|
24 |
model_name:
|
25 |
openai: "gpt-4"
|
@@ -33,7 +33,7 @@ backend:
|
|
33 |
presence_penalty: 0
|
34 |
|
35 |
system_message_prompt_template:
|
36 |
-
_target_:
|
37 |
template: |2-
|
38 |
Your goal is to identify potential issues with a competitive programming solution attempt.
|
39 |
|
@@ -51,14 +51,14 @@ system_message_prompt_template:
|
|
51 |
|
52 |
|
53 |
human_message_prompt_template:
|
54 |
-
_target_:
|
55 |
template: "{{query}}"
|
56 |
input_variables:
|
57 |
- "query"
|
58 |
|
59 |
|
60 |
init_human_message_prompt_template:
|
61 |
-
_target_:
|
62 |
template: |2-
|
63 |
# Problem statement
|
64 |
{{problem_description}}
|
|
|
19 |
|
20 |
# ~~~ Flow specification ~~~
|
21 |
backend:
|
22 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
23 |
api_infos: ???
|
24 |
model_name:
|
25 |
openai: "gpt-4"
|
|
|
33 |
presence_penalty: 0
|
34 |
|
35 |
system_message_prompt_template:
|
36 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
37 |
template: |2-
|
38 |
Your goal is to identify potential issues with a competitive programming solution attempt.
|
39 |
|
|
|
51 |
|
52 |
|
53 |
human_message_prompt_template:
|
54 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
55 |
template: "{{query}}"
|
56 |
input_variables:
|
57 |
- "query"
|
58 |
|
59 |
|
60 |
init_human_message_prompt_template:
|
61 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
62 |
template: |2-
|
63 |
# Problem statement
|
64 |
{{problem_description}}
|
CF_CodeCriticWrongAttempt.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from flow_modules.aiflows.
|
2 |
|
3 |
|
4 |
-
class CF_CodeCriticWrongAttempt(
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
|
|
1 |
+
from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow
|
2 |
|
3 |
|
4 |
+
class CF_CodeCriticWrongAttempt(ChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
CF_CodeCriticWrongAttempt.yaml
CHANGED
@@ -20,7 +20,7 @@ output_interface:
|
|
20 |
|
21 |
# ~~~ Flow specification ~~~
|
22 |
backend:
|
23 |
-
_target_:
|
24 |
api_infos: ???
|
25 |
model_name:
|
26 |
openai: "gpt-4"
|
@@ -35,7 +35,7 @@ backend:
|
|
35 |
presence_penalty: 0
|
36 |
|
37 |
system_message_prompt_template:
|
38 |
-
_target_:
|
39 |
template: |2-
|
40 |
Your goal is to identify the issues with an incorrect competitive programming solution attempt.
|
41 |
|
@@ -54,14 +54,14 @@ system_message_prompt_template:
|
|
54 |
|
55 |
|
56 |
human_message_prompt_template:
|
57 |
-
_target_:
|
58 |
template: "{{query}}"
|
59 |
input_variables:
|
60 |
- "query"
|
61 |
|
62 |
|
63 |
init_human_message_prompt_template:
|
64 |
-
_target_:
|
65 |
template: |2-
|
66 |
# Problem statement
|
67 |
{{problem_description}}
|
|
|
20 |
|
21 |
# ~~~ Flow specification ~~~
|
22 |
backend:
|
23 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
24 |
api_infos: ???
|
25 |
model_name:
|
26 |
openai: "gpt-4"
|
|
|
35 |
presence_penalty: 0
|
36 |
|
37 |
system_message_prompt_template:
|
38 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
39 |
template: |2-
|
40 |
Your goal is to identify the issues with an incorrect competitive programming solution attempt.
|
41 |
|
|
|
54 |
|
55 |
|
56 |
human_message_prompt_template:
|
57 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
58 |
template: "{{query}}"
|
59 |
input_variables:
|
60 |
- "query"
|
61 |
|
62 |
|
63 |
init_human_message_prompt_template:
|
64 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
65 |
template: |2-
|
66 |
# Problem statement
|
67 |
{{problem_description}}
|
CF_CodeCriticWrongAttemptWithPlan.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from flow_modules.aiflows.
|
2 |
|
3 |
|
4 |
-
class CF_CodeCriticWrongAttemptWithPlan(
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
|
|
1 |
+
from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow
|
2 |
|
3 |
|
4 |
+
class CF_CodeCriticWrongAttemptWithPlan(ChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
CF_CodeCriticWrongAttemptWithPlan.yaml
CHANGED
@@ -21,7 +21,7 @@ output_interface:
|
|
21 |
|
22 |
# ~~~ Flow specification ~~~
|
23 |
backend:
|
24 |
-
_target_:
|
25 |
api_infos: ???
|
26 |
model_name:
|
27 |
openai: "gpt-4"
|
@@ -36,7 +36,7 @@ backend:
|
|
36 |
presence_penalty: 0
|
37 |
|
38 |
system_message_prompt_template:
|
39 |
-
_target_:
|
40 |
template: |2-
|
41 |
Your goal is to identify the issues with an incorrect competitive programming solution attempt.
|
42 |
|
@@ -57,14 +57,14 @@ system_message_prompt_template:
|
|
57 |
|
58 |
|
59 |
human_message_prompt_template:
|
60 |
-
_target_:
|
61 |
template: "{{query}}"
|
62 |
input_variables:
|
63 |
- "query"
|
64 |
|
65 |
|
66 |
init_human_message_prompt_template:
|
67 |
-
_target_:
|
68 |
template: |2-
|
69 |
# Problem statement
|
70 |
{{problem_description}}
|
|
|
21 |
|
22 |
# ~~~ Flow specification ~~~
|
23 |
backend:
|
24 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
25 |
api_infos: ???
|
26 |
model_name:
|
27 |
openai: "gpt-4"
|
|
|
36 |
presence_penalty: 0
|
37 |
|
38 |
system_message_prompt_template:
|
39 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
40 |
template: |2-
|
41 |
Your goal is to identify the issues with an incorrect competitive programming solution attempt.
|
42 |
|
|
|
57 |
|
58 |
|
59 |
human_message_prompt_template:
|
60 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
61 |
template: "{{query}}"
|
62 |
input_variables:
|
63 |
- "query"
|
64 |
|
65 |
|
66 |
init_human_message_prompt_template:
|
67 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
68 |
template: |2-
|
69 |
# Problem statement
|
70 |
{{problem_description}}
|
CF_CodeDebug.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_CodeDebug(CircularFlow):
|
|
|
1 |
+
from aiflows.base_flows import CircularFlow
|
2 |
|
3 |
|
4 |
class CF_CodeDebug(CircularFlow):
|
CF_CodeDebug.yaml
CHANGED
@@ -23,7 +23,7 @@ subflows_config:
|
|
23 |
_target_: .CF_Code.instantiate_from_default_config
|
24 |
name: "CodeGenerator"
|
25 |
backend:
|
26 |
-
_target_:
|
27 |
model_name:
|
28 |
openai: "gpt-4"
|
29 |
azure: "azure/gpt-4"
|
@@ -52,25 +52,25 @@ topology:
|
|
52 |
|
53 |
### Input Interface
|
54 |
input_interface:
|
55 |
-
_target_:
|
56 |
additional_transformations:
|
57 |
-
- _target_:
|
58 |
|
59 |
### Flow Specification
|
60 |
flow: CodeGenerator
|
61 |
|
62 |
### Output Interface
|
63 |
output_interface:
|
64 |
-
_target_:
|
65 |
additional_transformations:
|
66 |
-
- _target_:
|
67 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
68 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
69 |
input_key: "api_output"
|
70 |
output_key: "code"
|
71 |
strip: True
|
72 |
assert_unique: True
|
73 |
-
- _target_:
|
74 |
keys_to_select:
|
75 |
- "code"
|
76 |
|
@@ -82,16 +82,16 @@ topology:
|
|
82 |
|
83 |
### Input Interface
|
84 |
input_interface:
|
85 |
-
_target_:
|
86 |
additional_transformations:
|
87 |
-
- _target_:
|
88 |
|
89 |
### Flow Specification
|
90 |
flow: CodeTestingCritic
|
91 |
|
92 |
### Output Interface
|
93 |
output_interface:
|
94 |
-
_target_:
|
95 |
additional_transformations:
|
96 |
- _target_: .src.data_transformations.CorrectnessFlag
|
97 |
input_key: "public_tests_results"
|
|
|
23 |
_target_: .CF_Code.instantiate_from_default_config
|
24 |
name: "CodeGenerator"
|
25 |
backend:
|
26 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
27 |
model_name:
|
28 |
openai: "gpt-4"
|
29 |
azure: "azure/gpt-4"
|
|
|
52 |
|
53 |
### Input Interface
|
54 |
input_interface:
|
55 |
+
_target_: aiflows.interfaces.KeyInterface
|
56 |
additional_transformations:
|
57 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
58 |
|
59 |
### Flow Specification
|
60 |
flow: CodeGenerator
|
61 |
|
62 |
### Output Interface
|
63 |
output_interface:
|
64 |
+
_target_: aiflows.interfaces.KeyInterface
|
65 |
additional_transformations:
|
66 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
67 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
68 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
69 |
input_key: "api_output"
|
70 |
output_key: "code"
|
71 |
strip: True
|
72 |
assert_unique: True
|
73 |
+
- _target_: aiflows.data_transformations.PrintPreviousMessages
|
74 |
keys_to_select:
|
75 |
- "code"
|
76 |
|
|
|
82 |
|
83 |
### Input Interface
|
84 |
input_interface:
|
85 |
+
_target_: aiflows.interfaces.KeyInterface
|
86 |
additional_transformations:
|
87 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
88 |
|
89 |
### Flow Specification
|
90 |
flow: CodeTestingCritic
|
91 |
|
92 |
### Output Interface
|
93 |
output_interface:
|
94 |
+
_target_: aiflows.interfaces.KeyInterface
|
95 |
additional_transformations:
|
96 |
- _target_: .src.data_transformations.CorrectnessFlag
|
97 |
input_key: "public_tests_results"
|
CF_CodeDebugCollab.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_CodeDebugCollab(CircularFlow):
|
|
|
1 |
+
from aiflows.base_flows import CircularFlow
|
2 |
|
3 |
|
4 |
class CF_CodeDebugCollab(CircularFlow):
|
CF_CodeDebugCollab.yaml
CHANGED
@@ -22,12 +22,12 @@ subflows_config:
|
|
22 |
_target_: .CF_Code.instantiate_from_default_config
|
23 |
name: "CodeGenerator"
|
24 |
backend:
|
25 |
-
_target_:
|
26 |
model_name:
|
27 |
openai: "gpt-4"
|
28 |
azure: "azure/gpt-4"
|
29 |
human_message_prompt_template:
|
30 |
-
_target_:
|
31 |
template: |2-
|
32 |
{{testing_results_summary}}
|
33 |
|
@@ -55,18 +55,18 @@ topology:
|
|
55 |
|
56 |
### Input Interface
|
57 |
input_interface:
|
58 |
-
_target_:
|
59 |
additional_transformations:
|
60 |
-
- _target_:
|
61 |
|
62 |
### Flow Specification
|
63 |
flow: CodeGenerator
|
64 |
|
65 |
### Output Interface
|
66 |
output_interface:
|
67 |
-
_target_:
|
68 |
additional_transformations:
|
69 |
-
- _target_:
|
70 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
71 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
72 |
input_key: "api_output"
|
@@ -83,9 +83,9 @@ topology:
|
|
83 |
|
84 |
### Input Interface
|
85 |
input_interface:
|
86 |
-
_target_:
|
87 |
additional_transformations:
|
88 |
-
- _target_:
|
89 |
|
90 |
### Flow Specification
|
91 |
flow: CodeDebugCritic
|
|
|
22 |
_target_: .CF_Code.instantiate_from_default_config
|
23 |
name: "CodeGenerator"
|
24 |
backend:
|
25 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
26 |
model_name:
|
27 |
openai: "gpt-4"
|
28 |
azure: "azure/gpt-4"
|
29 |
human_message_prompt_template:
|
30 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
31 |
template: |2-
|
32 |
{{testing_results_summary}}
|
33 |
|
|
|
55 |
|
56 |
### Input Interface
|
57 |
input_interface:
|
58 |
+
_target_: aiflows.interfaces.KeyInterface
|
59 |
additional_transformations:
|
60 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
61 |
|
62 |
### Flow Specification
|
63 |
flow: CodeGenerator
|
64 |
|
65 |
### Output Interface
|
66 |
output_interface:
|
67 |
+
_target_: aiflows.interfaces.KeyInterface
|
68 |
additional_transformations:
|
69 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
70 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
71 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
72 |
input_key: "api_output"
|
|
|
83 |
|
84 |
### Input Interface
|
85 |
input_interface:
|
86 |
+
_target_: aiflows.interfaces.KeyInterface
|
87 |
additional_transformations:
|
88 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
89 |
|
90 |
### Flow Specification
|
91 |
flow: CodeDebugCritic
|
CF_CodeDebugCollabWithPlan.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_CodeDebugCollabWithPlan(CircularFlow):
|
|
|
1 |
+
from aiflows.base_flows import CircularFlow
|
2 |
|
3 |
|
4 |
class CF_CodeDebugCollabWithPlan(CircularFlow):
|
CF_CodeDebugCollabWithPlan.yaml
CHANGED
@@ -23,13 +23,13 @@ subflows_config:
|
|
23 |
_target_: .CF_CodeWithPlan.instantiate_from_default_config
|
24 |
name: "CodeGenerator"
|
25 |
backend:
|
26 |
-
_target_:
|
27 |
api_infos: ???
|
28 |
model_name:
|
29 |
openai: "gpt-4"
|
30 |
azure: "azure/gpt-4"
|
31 |
human_message_prompt_template:
|
32 |
-
_target_:
|
33 |
template: |2-
|
34 |
{{testing_results_summary}}
|
35 |
|
@@ -57,18 +57,18 @@ topology:
|
|
57 |
|
58 |
### Input Interface
|
59 |
input_interface:
|
60 |
-
_target_:
|
61 |
additional_transformations:
|
62 |
-
- _target_:
|
63 |
|
64 |
### Flow Specification
|
65 |
flow: CodeGenerator
|
66 |
|
67 |
### Output Interface
|
68 |
output_interface:
|
69 |
-
_target_:
|
70 |
additional_transformations:
|
71 |
-
- _target_:
|
72 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
73 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
74 |
input_key: "api_output"
|
@@ -85,9 +85,9 @@ topology:
|
|
85 |
|
86 |
### Input Interface
|
87 |
input_interface:
|
88 |
-
_target_:
|
89 |
additional_transformations:
|
90 |
-
- _target_:
|
91 |
|
92 |
### Flow Specification
|
93 |
flow: CodeDebugCritic
|
|
|
23 |
_target_: .CF_CodeWithPlan.instantiate_from_default_config
|
24 |
name: "CodeGenerator"
|
25 |
backend:
|
26 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
27 |
api_infos: ???
|
28 |
model_name:
|
29 |
openai: "gpt-4"
|
30 |
azure: "azure/gpt-4"
|
31 |
human_message_prompt_template:
|
32 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
33 |
template: |2-
|
34 |
{{testing_results_summary}}
|
35 |
|
|
|
57 |
|
58 |
### Input Interface
|
59 |
input_interface:
|
60 |
+
_target_: aiflows.interfaces.KeyInterface
|
61 |
additional_transformations:
|
62 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
63 |
|
64 |
### Flow Specification
|
65 |
flow: CodeGenerator
|
66 |
|
67 |
### Output Interface
|
68 |
output_interface:
|
69 |
+
_target_: aiflows.interfaces.KeyInterface
|
70 |
additional_transformations:
|
71 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
72 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
73 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
74 |
input_key: "api_output"
|
|
|
85 |
|
86 |
### Input Interface
|
87 |
input_interface:
|
88 |
+
_target_: aiflows.interfaces.KeyInterface
|
89 |
additional_transformations:
|
90 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
91 |
|
92 |
### Flow Specification
|
93 |
flow: CodeDebugCritic
|
CF_CodeDebugCritic.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_CodeDebugCritic(SequentialFlow):
|
|
|
1 |
+
from aiflows.base_flows import SequentialFlow
|
2 |
|
3 |
|
4 |
class CF_CodeDebugCritic(SequentialFlow):
|
CF_CodeDebugCritic.yaml
CHANGED
@@ -30,16 +30,16 @@ topology:
|
|
30 |
|
31 |
### Input Interface
|
32 |
input_interface:
|
33 |
-
_target_:
|
34 |
additional_transformations:
|
35 |
-
- _target_:
|
36 |
|
37 |
### Flow Specification
|
38 |
flow: CodeTestingCritic
|
39 |
|
40 |
### Output Interface
|
41 |
output_interface:
|
42 |
-
_target_:
|
43 |
additional_transformations:
|
44 |
- _target_: .src.data_transformations.CorrectnessFlag
|
45 |
input_key: "public_tests_results"
|
@@ -111,18 +111,18 @@ topology:
|
|
111 |
|
112 |
### Input Interface
|
113 |
input_interface:
|
114 |
-
_target_:
|
115 |
additional_transformations:
|
116 |
-
- _target_:
|
117 |
|
118 |
### Flow Specification
|
119 |
flow: CodeCriticWrongAttempt
|
120 |
|
121 |
### Output Interface
|
122 |
output_interface:
|
123 |
-
_target_:
|
124 |
additional_transformations:
|
125 |
-
- _target_:
|
126 |
old_key2new_key:
|
127 |
api_output: "code_feedback"
|
128 |
|
|
|
30 |
|
31 |
### Input Interface
|
32 |
input_interface:
|
33 |
+
_target_: aiflows.interfaces.KeyInterface
|
34 |
additional_transformations:
|
35 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
36 |
|
37 |
### Flow Specification
|
38 |
flow: CodeTestingCritic
|
39 |
|
40 |
### Output Interface
|
41 |
output_interface:
|
42 |
+
_target_: aiflows.interfaces.KeyInterface
|
43 |
additional_transformations:
|
44 |
- _target_: .src.data_transformations.CorrectnessFlag
|
45 |
input_key: "public_tests_results"
|
|
|
111 |
|
112 |
### Input Interface
|
113 |
input_interface:
|
114 |
+
_target_: aiflows.interfaces.KeyInterface
|
115 |
additional_transformations:
|
116 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
117 |
|
118 |
### Flow Specification
|
119 |
flow: CodeCriticWrongAttempt
|
120 |
|
121 |
### Output Interface
|
122 |
output_interface:
|
123 |
+
_target_: aiflows.interfaces.KeyInterface
|
124 |
additional_transformations:
|
125 |
+
- _target_: aiflows.data_transformations.KeyRename
|
126 |
old_key2new_key:
|
127 |
api_output: "code_feedback"
|
128 |
|
CF_CodeDebugCriticWithPlan.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_CodeDebugCriticWithPlan(SequentialFlow):
|
|
|
1 |
+
from aiflows.base_flows import SequentialFlow
|
2 |
|
3 |
|
4 |
class CF_CodeDebugCriticWithPlan(SequentialFlow):
|
CF_CodeDebugCriticWithPlan.yaml
CHANGED
@@ -31,16 +31,16 @@ topology:
|
|
31 |
|
32 |
### Input Interface
|
33 |
input_interface:
|
34 |
-
_target_:
|
35 |
additional_transformations:
|
36 |
-
- _target_:
|
37 |
|
38 |
### Flow Specification
|
39 |
flow: CodeTestingCritic
|
40 |
|
41 |
### Output Interface
|
42 |
output_interface:
|
43 |
-
_target_:
|
44 |
additional_transformations:
|
45 |
- _target_: .src.data_transformations.CorrectnessFlag
|
46 |
input_key: "public_tests_results"
|
@@ -112,18 +112,18 @@ topology:
|
|
112 |
|
113 |
### Input Interface
|
114 |
input_interface:
|
115 |
-
_target_:
|
116 |
additional_transformations:
|
117 |
-
- _target_:
|
118 |
|
119 |
### Flow Specification
|
120 |
flow: CodeCriticWrongAttempt
|
121 |
|
122 |
### Output Interface
|
123 |
output_interface:
|
124 |
-
_target_:
|
125 |
additional_transformations:
|
126 |
-
- _target_:
|
127 |
old_key2new_key:
|
128 |
api_output: "code_feedback"
|
129 |
|
|
|
31 |
|
32 |
### Input Interface
|
33 |
input_interface:
|
34 |
+
_target_: aiflows.interfaces.KeyInterface
|
35 |
additional_transformations:
|
36 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
37 |
|
38 |
### Flow Specification
|
39 |
flow: CodeTestingCritic
|
40 |
|
41 |
### Output Interface
|
42 |
output_interface:
|
43 |
+
_target_: aiflows.interfaces.KeyInterface
|
44 |
additional_transformations:
|
45 |
- _target_: .src.data_transformations.CorrectnessFlag
|
46 |
input_key: "public_tests_results"
|
|
|
112 |
|
113 |
### Input Interface
|
114 |
input_interface:
|
115 |
+
_target_: aiflows.interfaces.KeyInterface
|
116 |
additional_transformations:
|
117 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
118 |
|
119 |
### Flow Specification
|
120 |
flow: CodeCriticWrongAttempt
|
121 |
|
122 |
### Output Interface
|
123 |
output_interface:
|
124 |
+
_target_: aiflows.interfaces.KeyInterface
|
125 |
additional_transformations:
|
126 |
+
- _target_: aiflows.data_transformations.KeyRename
|
127 |
old_key2new_key:
|
128 |
api_output: "code_feedback"
|
129 |
|
CF_CodeReflect.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_CodeReflect(CircularFlow):
|
|
|
1 |
+
from aiflows.base_flows import CircularFlow
|
2 |
|
3 |
|
4 |
class CF_CodeReflect(CircularFlow):
|
CF_CodeReflect.yaml
CHANGED
@@ -31,9 +31,9 @@ topology:
|
|
31 |
|
32 |
### Input Interface
|
33 |
input_interface:
|
34 |
-
_target_:
|
35 |
additional_transformations:
|
36 |
-
- _target_:
|
37 |
keys_to_rename:
|
38 |
code_reflect_message: "query"
|
39 |
|
@@ -42,20 +42,20 @@ topology:
|
|
42 |
|
43 |
### Output Interface
|
44 |
output_interface:
|
45 |
-
_target_:
|
46 |
additional_transformations:
|
47 |
-
- _target_:
|
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 |
-
- _target_:
|
55 |
end_of_interaction_string: "Final answer"
|
56 |
input_key: "api_output"
|
57 |
output_key: "end_of_interaction"
|
58 |
-
- _target_:
|
59 |
keys_to_select:
|
60 |
- "code"
|
61 |
- "end_of_interaction"
|
@@ -67,9 +67,9 @@ topology:
|
|
67 |
|
68 |
### Input Interface
|
69 |
input_interface:
|
70 |
-
_target_:
|
71 |
additional_transformations:
|
72 |
-
- _target_:
|
73 |
|
74 |
|
75 |
### Flow Specification
|
@@ -77,7 +77,7 @@ topology:
|
|
77 |
|
78 |
### Output Interface
|
79 |
output_interface:
|
80 |
-
_target_:
|
81 |
keys_to_rename:
|
82 |
fixed_reply: "code_reflect_message"
|
83 |
|
|
|
31 |
|
32 |
### Input Interface
|
33 |
input_interface:
|
34 |
+
_target_: aiflows.interfaces.KeyInterface
|
35 |
additional_transformations:
|
36 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
37 |
keys_to_rename:
|
38 |
code_reflect_message: "query"
|
39 |
|
|
|
42 |
|
43 |
### Output Interface
|
44 |
output_interface:
|
45 |
+
_target_: aiflows.interfaces.KeyInterface
|
46 |
additional_transformations:
|
47 |
+
- _target_: aiflows.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 |
+
- _target_: aiflows.data_transformations.EndOfInteraction
|
55 |
end_of_interaction_string: "Final answer"
|
56 |
input_key: "api_output"
|
57 |
output_key: "end_of_interaction"
|
58 |
+
- _target_: aiflows.data_transformations.PrintPreviousMessages
|
59 |
keys_to_select:
|
60 |
- "code"
|
61 |
- "end_of_interaction"
|
|
|
67 |
|
68 |
### Input Interface
|
69 |
input_interface:
|
70 |
+
_target_: aiflows.interfaces.KeyInterface
|
71 |
additional_transformations:
|
72 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
73 |
|
74 |
|
75 |
### Flow Specification
|
|
|
77 |
|
78 |
### Output Interface
|
79 |
output_interface:
|
80 |
+
_target_: aiflows.interfaces.KeyInterface
|
81 |
keys_to_rename:
|
82 |
fixed_reply: "code_reflect_message"
|
83 |
|
CF_CodeTesting.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from typing import Any, Dict
|
2 |
|
3 |
-
from
|
4 |
-
from
|
5 |
from .src.evaluation import testing_utils_codeforces
|
6 |
from .CodeTesting import CodeTesting
|
7 |
|
|
|
1 |
from typing import Any, Dict
|
2 |
|
3 |
+
from aiflows import logging
|
4 |
+
from aiflows.utils.general_helpers import validate_flow_config
|
5 |
from .src.evaluation import testing_utils_codeforces
|
6 |
from .CodeTesting import CodeTesting
|
7 |
|
CF_CodeWithPlan.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from flow_modules.aiflows.
|
2 |
|
3 |
|
4 |
-
class CF_CodeWithPlan(
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
|
|
1 |
+
from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow
|
2 |
|
3 |
|
4 |
+
class CF_CodeWithPlan(ChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
CF_CodeWithPlan.yaml
CHANGED
@@ -19,7 +19,7 @@ output_interface:
|
|
19 |
|
20 |
# ~~~ Flow specification ~~~
|
21 |
backend:
|
22 |
-
_target_:
|
23 |
api_infos: ???
|
24 |
model_name:
|
25 |
openai: "gpt-4"
|
@@ -32,7 +32,7 @@ backend:
|
|
32 |
presence_penalty: 0
|
33 |
|
34 |
system_message_prompt_template:
|
35 |
-
_target_:
|
36 |
template: |2-
|
37 |
Your goal is to provide executable Python code that solves a competitive programming problem. The code should correctly handle all corner cases in order to pass the hidden test cases, which are used to evaluate the correctness of the solution.
|
38 |
|
@@ -50,14 +50,14 @@ system_message_prompt_template:
|
|
50 |
|
51 |
|
52 |
human_message_prompt_template:
|
53 |
-
_target_:
|
54 |
template: "{{query}}"
|
55 |
input_variables:
|
56 |
- "query"
|
57 |
|
58 |
|
59 |
init_human_message_prompt_template:
|
60 |
-
_target_:
|
61 |
template: |2-
|
62 |
# Problem statement
|
63 |
{{problem_description}}
|
|
|
19 |
|
20 |
# ~~~ Flow specification ~~~
|
21 |
backend:
|
22 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
23 |
api_infos: ???
|
24 |
model_name:
|
25 |
openai: "gpt-4"
|
|
|
32 |
presence_penalty: 0
|
33 |
|
34 |
system_message_prompt_template:
|
35 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
36 |
template: |2-
|
37 |
Your goal is to provide executable Python code that solves a competitive programming problem. The code should correctly handle all corner cases in order to pass the hidden test cases, which are used to evaluate the correctness of the solution.
|
38 |
|
|
|
50 |
|
51 |
|
52 |
human_message_prompt_template:
|
53 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
54 |
template: "{{query}}"
|
55 |
input_variables:
|
56 |
- "query"
|
57 |
|
58 |
|
59 |
init_human_message_prompt_template:
|
60 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
61 |
template: |2-
|
62 |
# Problem statement
|
63 |
{{problem_description}}
|
CF_Plan.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from flow_modules.aiflows.
|
2 |
|
3 |
|
4 |
-
class CF_Plan(
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
|
|
1 |
+
from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow
|
2 |
|
3 |
|
4 |
+
class CF_Plan(ChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
CF_Plan.yaml
CHANGED
@@ -30,7 +30,7 @@ backend:
|
|
30 |
presence_penalty: 0
|
31 |
|
32 |
system_message_prompt_template:
|
33 |
-
_target_:
|
34 |
template: |2-
|
35 |
Your goal is to provide a high-level conceptual solution that, if implemented, will solve a given competitive programming problem.
|
36 |
|
@@ -48,14 +48,14 @@ system_message_prompt_template:
|
|
48 |
|
49 |
|
50 |
human_message_prompt_template:
|
51 |
-
_target_:
|
52 |
template: "{{query}}"
|
53 |
input_variables:
|
54 |
- "query"
|
55 |
|
56 |
|
57 |
init_human_message_prompt_template:
|
58 |
-
_target_:
|
59 |
template: |2-
|
60 |
# Problem statement
|
61 |
{{problem_description}}
|
|
|
30 |
presence_penalty: 0
|
31 |
|
32 |
system_message_prompt_template:
|
33 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
34 |
template: |2-
|
35 |
Your goal is to provide a high-level conceptual solution that, if implemented, will solve a given competitive programming problem.
|
36 |
|
|
|
48 |
|
49 |
|
50 |
human_message_prompt_template:
|
51 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
52 |
template: "{{query}}"
|
53 |
input_variables:
|
54 |
- "query"
|
55 |
|
56 |
|
57 |
init_human_message_prompt_template:
|
58 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
59 |
template: |2-
|
60 |
# Problem statement
|
61 |
{{problem_description}}
|
CF_PlanCollab.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_PlanCollab(CircularFlow):
|
|
|
1 |
+
from aiflows.base_flows import CircularFlow
|
2 |
|
3 |
|
4 |
class CF_PlanCollab(CircularFlow):
|
CF_PlanCollab.yaml
CHANGED
@@ -21,7 +21,7 @@ subflows_config:
|
|
21 |
PlanGenerator:
|
22 |
_target_: .CF_Plan.instantiate_from_default_config
|
23 |
human_message_prompt_template:
|
24 |
-
_target_:
|
25 |
template: |2-
|
26 |
# Feedback on the last proposed conceptual solution
|
27 |
{{plan_feedback}}
|
@@ -48,18 +48,18 @@ topology:
|
|
48 |
|
49 |
### Input Interface
|
50 |
input_interface:
|
51 |
-
_target_:
|
52 |
additional_transformations:
|
53 |
-
- _target_:
|
54 |
|
55 |
### Flow Specification
|
56 |
flow: PlanGenerator
|
57 |
|
58 |
### Output Interface
|
59 |
output_interface:
|
60 |
-
_target_:
|
61 |
additional_transformations:
|
62 |
-
- _target_:
|
63 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
64 |
regex_fallback:
|
65 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
@@ -67,27 +67,27 @@ topology:
|
|
67 |
output_key: "plan"
|
68 |
strip: True
|
69 |
assert_unique: True
|
70 |
-
- _target_:
|
71 |
end_of_interaction_string: "Final answer"
|
72 |
input_key: "api_output"
|
73 |
output_key: "end_of_interaction"
|
74 |
-
- _target_:
|
75 |
reset: false
|
76 |
# ~~~ Plan Critic ~~~
|
77 |
- goal: "Provide feedback for the candidate solution."
|
78 |
|
79 |
### Input Interface
|
80 |
input_interface:
|
81 |
-
_target_:
|
82 |
additional_transformations:
|
83 |
-
- _target_:
|
84 |
|
85 |
### Flow Specification
|
86 |
flow: PlanCritic
|
87 |
|
88 |
### Output Interface
|
89 |
output_interface:
|
90 |
-
_target_:
|
91 |
keys_to_rename:
|
92 |
api_output: "plan_feedback"
|
93 |
|
|
|
21 |
PlanGenerator:
|
22 |
_target_: .CF_Plan.instantiate_from_default_config
|
23 |
human_message_prompt_template:
|
24 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
25 |
template: |2-
|
26 |
# Feedback on the last proposed conceptual solution
|
27 |
{{plan_feedback}}
|
|
|
48 |
|
49 |
### Input Interface
|
50 |
input_interface:
|
51 |
+
_target_: aiflows.interfaces.KeyInterface
|
52 |
additional_transformations:
|
53 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
54 |
|
55 |
### Flow Specification
|
56 |
flow: PlanGenerator
|
57 |
|
58 |
### Output Interface
|
59 |
output_interface:
|
60 |
+
_target_: aiflows.interfaces.KeyInterface
|
61 |
additional_transformations:
|
62 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
63 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
64 |
regex_fallback:
|
65 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
|
|
67 |
output_key: "plan"
|
68 |
strip: True
|
69 |
assert_unique: True
|
70 |
+
- _target_: aiflows.data_transformations.EndOfInteraction
|
71 |
end_of_interaction_string: "Final answer"
|
72 |
input_key: "api_output"
|
73 |
output_key: "end_of_interaction"
|
74 |
+
- _target_: aiflows.data_transformations.PrintPreviousMessages
|
75 |
reset: false
|
76 |
# ~~~ Plan Critic ~~~
|
77 |
- goal: "Provide feedback for the candidate solution."
|
78 |
|
79 |
### Input Interface
|
80 |
input_interface:
|
81 |
+
_target_: aiflows.interfaces.KeyInterface
|
82 |
additional_transformations:
|
83 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
84 |
|
85 |
### Flow Specification
|
86 |
flow: PlanCritic
|
87 |
|
88 |
### Output Interface
|
89 |
output_interface:
|
90 |
+
_target_: aiflows.interfaces.KeyInterface
|
91 |
keys_to_rename:
|
92 |
api_output: "plan_feedback"
|
93 |
|
CF_PlanCollab_Code.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_PlanCollab_Code(SequentialFlow):
|
|
|
1 |
+
from aiflows.base_flows import SequentialFlow
|
2 |
|
3 |
|
4 |
class CF_PlanCollab_Code(SequentialFlow):
|
CF_PlanCollab_Code.yaml
CHANGED
@@ -26,16 +26,16 @@ topology:
|
|
26 |
|
27 |
### Input Interface
|
28 |
input_interface:
|
29 |
-
_target_:
|
30 |
additional_transformations:
|
31 |
-
- _target_:
|
32 |
|
33 |
### Flow Specification
|
34 |
flow: PlanGenerator
|
35 |
|
36 |
### Output Interface
|
37 |
output_interface:
|
38 |
-
_target_:
|
39 |
keys_to_select:
|
40 |
- "plan"
|
41 |
|
@@ -44,24 +44,24 @@ topology:
|
|
44 |
|
45 |
### Input Interface
|
46 |
input_interface:
|
47 |
-
_target_:
|
48 |
additional_transformations:
|
49 |
-
- _target_:
|
50 |
|
51 |
### Flow Specification
|
52 |
flow: CodeGenerator
|
53 |
|
54 |
### Output Interface
|
55 |
output_interface:
|
56 |
-
_target_:
|
57 |
additional_transformations:
|
58 |
-
- _target_:
|
59 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
60 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
61 |
input_key: "api_output"
|
62 |
output_key: "code"
|
63 |
strip: True
|
64 |
assert_unique: True
|
65 |
-
- _target_:
|
66 |
keys_to_select:
|
67 |
- "code"
|
|
|
26 |
|
27 |
### Input Interface
|
28 |
input_interface:
|
29 |
+
_target_: aiflows.interfaces.KeyInterface
|
30 |
additional_transformations:
|
31 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
32 |
|
33 |
### Flow Specification
|
34 |
flow: PlanGenerator
|
35 |
|
36 |
### Output Interface
|
37 |
output_interface:
|
38 |
+
_target_: aiflows.interfaces.KeyInterface
|
39 |
keys_to_select:
|
40 |
- "plan"
|
41 |
|
|
|
44 |
|
45 |
### Input Interface
|
46 |
input_interface:
|
47 |
+
_target_: aiflows.interfaces.KeyInterface
|
48 |
additional_transformations:
|
49 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
50 |
|
51 |
### Flow Specification
|
52 |
flow: CodeGenerator
|
53 |
|
54 |
### Output Interface
|
55 |
output_interface:
|
56 |
+
_target_: aiflows.interfaces.KeyInterface
|
57 |
additional_transformations:
|
58 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
59 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
60 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
61 |
input_key: "api_output"
|
62 |
output_key: "code"
|
63 |
strip: True
|
64 |
assert_unique: True
|
65 |
+
- _target_: aiflows.data_transformations.PrintPreviousMessages
|
66 |
keys_to_select:
|
67 |
- "code"
|
CF_PlanCritic.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from flow_modules.aiflows.
|
2 |
|
3 |
|
4 |
-
class CF_PlanCritic(
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
|
|
1 |
+
from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow
|
2 |
|
3 |
|
4 |
+
class CF_PlanCritic(ChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
CF_PlanCritic.yaml
CHANGED
@@ -19,7 +19,7 @@ output_interface:
|
|
19 |
|
20 |
# ~~~ Flow specification ~~~
|
21 |
backend:
|
22 |
-
_target_:
|
23 |
api_infos: ???
|
24 |
model_name:
|
25 |
openai: "gpt-4"
|
@@ -33,7 +33,7 @@ backend:
|
|
33 |
presence_penalty: 0
|
34 |
|
35 |
system_message_prompt_template:
|
36 |
-
_target_:
|
37 |
template: |2-
|
38 |
Your goal is to identify potential issues with a conceptual solution to a given competitive programming problem.
|
39 |
|
@@ -52,14 +52,14 @@ system_message_prompt_template:
|
|
52 |
|
53 |
|
54 |
human_message_prompt_template:
|
55 |
-
_target_:
|
56 |
template: "{{query}}"
|
57 |
input_variables:
|
58 |
- "query"
|
59 |
|
60 |
|
61 |
init_human_message_prompt_template:
|
62 |
-
_target_:
|
63 |
template: |2-
|
64 |
# Problem statement
|
65 |
{{problem_description}}
|
|
|
19 |
|
20 |
# ~~~ Flow specification ~~~
|
21 |
backend:
|
22 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
23 |
api_infos: ???
|
24 |
model_name:
|
25 |
openai: "gpt-4"
|
|
|
33 |
presence_penalty: 0
|
34 |
|
35 |
system_message_prompt_template:
|
36 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
37 |
template: |2-
|
38 |
Your goal is to identify potential issues with a conceptual solution to a given competitive programming problem.
|
39 |
|
|
|
52 |
|
53 |
|
54 |
human_message_prompt_template:
|
55 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
56 |
template: "{{query}}"
|
57 |
input_variables:
|
58 |
- "query"
|
59 |
|
60 |
|
61 |
init_human_message_prompt_template:
|
62 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
63 |
template: |2-
|
64 |
# Problem statement
|
65 |
{{problem_description}}
|
CF_PlanReflect.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_PlanReflect(CircularFlow):
|
|
|
1 |
+
from aiflows.base_flows import CircularFlow
|
2 |
|
3 |
|
4 |
class CF_PlanReflect(CircularFlow):
|
CF_PlanReflect.yaml
CHANGED
@@ -30,9 +30,9 @@ topology:
|
|
30 |
|
31 |
### Input Interface
|
32 |
input_interface:
|
33 |
-
_target_:
|
34 |
additional_transformations:
|
35 |
-
- _target_:
|
36 |
keys_to_rename:
|
37 |
plan_reflect_message: "query"
|
38 |
|
@@ -41,9 +41,9 @@ topology:
|
|
41 |
|
42 |
### Output Interface
|
43 |
output_interface:
|
44 |
-
_target_:
|
45 |
additional_transformations:
|
46 |
-
- _target_:
|
47 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
48 |
regex_fallback:
|
49 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
@@ -51,11 +51,11 @@ topology:
|
|
51 |
output_key: "plan"
|
52 |
strip: True
|
53 |
assert_unique: True
|
54 |
-
- _target_:
|
55 |
end_of_interaction_string: "Final answer"
|
56 |
input_key: "api_output"
|
57 |
output_key: "end_of_interaction"
|
58 |
-
- _target_:
|
59 |
keys_to_select:
|
60 |
- "plan"
|
61 |
- "end_of_interaction"
|
@@ -67,16 +67,16 @@ topology:
|
|
67 |
|
68 |
### Input Interface
|
69 |
input_interface:
|
70 |
-
_target_:
|
71 |
additional_transformations:
|
72 |
-
- _target_:
|
73 |
|
74 |
### Flow Specification
|
75 |
flow: PlanReflectCritic
|
76 |
|
77 |
### Output Interface
|
78 |
output_interface:
|
79 |
-
_target_:
|
80 |
keys_to_rename:
|
81 |
fixed_reply: "plan_reflect_message"
|
82 |
|
|
|
30 |
|
31 |
### Input Interface
|
32 |
input_interface:
|
33 |
+
_target_: aiflows.interfaces.KeyInterface
|
34 |
additional_transformations:
|
35 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
36 |
keys_to_rename:
|
37 |
plan_reflect_message: "query"
|
38 |
|
|
|
41 |
|
42 |
### Output Interface
|
43 |
output_interface:
|
44 |
+
_target_: aiflows.interfaces.KeyInterface
|
45 |
additional_transformations:
|
46 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
47 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
48 |
regex_fallback:
|
49 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
|
|
51 |
output_key: "plan"
|
52 |
strip: True
|
53 |
assert_unique: True
|
54 |
+
- _target_: aiflows.data_transformations.EndOfInteraction
|
55 |
end_of_interaction_string: "Final answer"
|
56 |
input_key: "api_output"
|
57 |
output_key: "end_of_interaction"
|
58 |
+
- _target_: aiflows.data_transformations.PrintPreviousMessages
|
59 |
keys_to_select:
|
60 |
- "plan"
|
61 |
- "end_of_interaction"
|
|
|
67 |
|
68 |
### Input Interface
|
69 |
input_interface:
|
70 |
+
_target_: aiflows.interfaces.KeyInterface
|
71 |
additional_transformations:
|
72 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
73 |
|
74 |
### Flow Specification
|
75 |
flow: PlanReflectCritic
|
76 |
|
77 |
### Output Interface
|
78 |
output_interface:
|
79 |
+
_target_: aiflows.interfaces.KeyInterface
|
80 |
keys_to_rename:
|
81 |
fixed_reply: "plan_reflect_message"
|
82 |
|
CF_PlanReflect_Code.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_PlanReflect_Code(SequentialFlow):
|
|
|
1 |
+
from aiflows.base_flows import SequentialFlow
|
2 |
|
3 |
|
4 |
class CF_PlanReflect_Code(SequentialFlow):
|
CF_PlanReflect_Code.yaml
CHANGED
@@ -26,16 +26,16 @@ topology:
|
|
26 |
|
27 |
### Input Interface
|
28 |
input_interface:
|
29 |
-
_target_:
|
30 |
additional_transformations:
|
31 |
-
- _target_:
|
32 |
|
33 |
### Flow Specification
|
34 |
flow: PlanGenerator
|
35 |
|
36 |
### Output Interface
|
37 |
output_interface:
|
38 |
-
_target_:
|
39 |
keys_to_select:
|
40 |
- "plan"
|
41 |
|
@@ -44,24 +44,24 @@ topology:
|
|
44 |
|
45 |
### Input Interface
|
46 |
input_interface:
|
47 |
-
_target_:
|
48 |
additional_transformations:
|
49 |
-
- _target_:
|
50 |
|
51 |
### Flow Specification
|
52 |
flow: CodeGenerator
|
53 |
|
54 |
### Output Interface
|
55 |
output_interface:
|
56 |
-
_target_:
|
57 |
additional_transformations:
|
58 |
-
- _target_:
|
59 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
60 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
61 |
input_key: "api_output"
|
62 |
output_key: "code"
|
63 |
strip: True
|
64 |
assert_unique: True
|
65 |
-
- _target_:
|
66 |
keys_to_select:
|
67 |
- "code"
|
|
|
26 |
|
27 |
### Input Interface
|
28 |
input_interface:
|
29 |
+
_target_: aiflows.interfaces.KeyInterface
|
30 |
additional_transformations:
|
31 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
32 |
|
33 |
### Flow Specification
|
34 |
flow: PlanGenerator
|
35 |
|
36 |
### Output Interface
|
37 |
output_interface:
|
38 |
+
_target_: aiflows.interfaces.KeyInterface
|
39 |
keys_to_select:
|
40 |
- "plan"
|
41 |
|
|
|
44 |
|
45 |
### Input Interface
|
46 |
input_interface:
|
47 |
+
_target_: aiflows.interfaces.KeyInterface
|
48 |
additional_transformations:
|
49 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
50 |
|
51 |
### Flow Specification
|
52 |
flow: CodeGenerator
|
53 |
|
54 |
### Output Interface
|
55 |
output_interface:
|
56 |
+
_target_: aiflows.interfaces.KeyInterface
|
57 |
additional_transformations:
|
58 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
59 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
60 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
61 |
input_key: "api_output"
|
62 |
output_key: "code"
|
63 |
strip: True
|
64 |
assert_unique: True
|
65 |
+
- _target_: aiflows.data_transformations.PrintPreviousMessages
|
66 |
keys_to_select:
|
67 |
- "code"
|
CF_Plan_Code.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class CF_Plan_Code(SequentialFlow):
|
|
|
1 |
+
from aiflows.base_flows import SequentialFlow
|
2 |
|
3 |
|
4 |
class CF_Plan_Code(SequentialFlow):
|
CF_Plan_Code.yaml
CHANGED
@@ -26,18 +26,18 @@ topology:
|
|
26 |
|
27 |
### Input Interface
|
28 |
input_interface:
|
29 |
-
_target_:
|
30 |
additional_transformations:
|
31 |
-
- _target_:
|
32 |
|
33 |
### Flow Specification
|
34 |
flow: PlanGenerator
|
35 |
|
36 |
### Output Interface
|
37 |
output_interface:
|
38 |
-
_target_:
|
39 |
additional_transformations:
|
40 |
-
- _target_:
|
41 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
42 |
regex_fallback:
|
43 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
@@ -45,7 +45,7 @@ topology:
|
|
45 |
output_key: "plan"
|
46 |
strip: True
|
47 |
assert_unique: True
|
48 |
-
- _target_:
|
49 |
keys_to_select:
|
50 |
- "plan"
|
51 |
|
@@ -54,24 +54,24 @@ topology:
|
|
54 |
|
55 |
### Input Interface
|
56 |
input_interface:
|
57 |
-
_target_:
|
58 |
additional_transformations:
|
59 |
-
- _target_:
|
60 |
|
61 |
### Flow Specification
|
62 |
flow: CodeGenerator
|
63 |
|
64 |
### Output Interface
|
65 |
output_interface:
|
66 |
-
_target_:
|
67 |
additional_transformations:
|
68 |
-
- _target_:
|
69 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
70 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
71 |
input_key: "api_output"
|
72 |
output_key: "code"
|
73 |
strip: True
|
74 |
assert_unique: True
|
75 |
-
- _target_:
|
76 |
keys_to_select:
|
77 |
- "code"
|
|
|
26 |
|
27 |
### Input Interface
|
28 |
input_interface:
|
29 |
+
_target_: aiflows.interfaces.KeyInterface
|
30 |
additional_transformations:
|
31 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
32 |
|
33 |
### Flow Specification
|
34 |
flow: PlanGenerator
|
35 |
|
36 |
### Output Interface
|
37 |
output_interface:
|
38 |
+
_target_: aiflows.interfaces.KeyInterface
|
39 |
additional_transformations:
|
40 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
41 |
regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
42 |
regex_fallback:
|
43 |
- '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)'
|
|
|
45 |
output_key: "plan"
|
46 |
strip: True
|
47 |
assert_unique: True
|
48 |
+
- _target_: aiflows.data_transformations.PrintPreviousMessages
|
49 |
keys_to_select:
|
50 |
- "plan"
|
51 |
|
|
|
54 |
|
55 |
### Input Interface
|
56 |
input_interface:
|
57 |
+
_target_: aiflows.interfaces.KeyInterface
|
58 |
additional_transformations:
|
59 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
60 |
|
61 |
### Flow Specification
|
62 |
flow: CodeGenerator
|
63 |
|
64 |
### Output Interface
|
65 |
output_interface:
|
66 |
+
_target_: aiflows.interfaces.KeyInterface
|
67 |
additional_transformations:
|
68 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
69 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
70 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
71 |
input_key: "api_output"
|
72 |
output_key: "code"
|
73 |
strip: True
|
74 |
assert_unique: True
|
75 |
+
- _target_: aiflows.data_transformations.PrintPreviousMessages
|
76 |
keys_to_select:
|
77 |
- "code"
|
CodeTesting.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from typing import Any, Dict
|
2 |
|
3 |
-
from
|
4 |
-
from
|
5 |
|
6 |
log = logging.get_logger(__name__)
|
7 |
|
|
|
1 |
from typing import Any, Dict
|
2 |
|
3 |
+
from aiflows import logging
|
4 |
+
from aiflows.base_flows import AtomicFlow
|
5 |
|
6 |
log = logging.get_logger(__name__)
|
7 |
|
LC_Code.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from flow_modules.aiflows.
|
2 |
|
3 |
|
4 |
-
class LC_Code(
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
|
|
1 |
+
from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow
|
2 |
|
3 |
|
4 |
+
class LC_Code(ChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
LC_Code.yaml
CHANGED
@@ -18,7 +18,7 @@ output_interface:
|
|
18 |
|
19 |
# ~~~ Flow specification ~~~
|
20 |
backend:
|
21 |
-
_target_:
|
22 |
api_infos: ???
|
23 |
model_name:
|
24 |
openai: "gpt-4"
|
@@ -33,7 +33,7 @@ backend:
|
|
33 |
presence_penalty: 0
|
34 |
|
35 |
system_message_prompt_template:
|
36 |
-
_target_:
|
37 |
template: |2-
|
38 |
Your goal is to provide executable Python code that solves a coding interview problem. The code should correctly handle all corner cases in order to pass the hidden test cases, which are used to evaluate the correctness of the solution.
|
39 |
|
@@ -47,14 +47,14 @@ system_message_prompt_template:
|
|
47 |
|
48 |
|
49 |
human_message_prompt_template:
|
50 |
-
_target_:
|
51 |
template: "{{query}}"
|
52 |
input_variables:
|
53 |
- "query"
|
54 |
|
55 |
|
56 |
init_human_message_prompt_template:
|
57 |
-
_target_:
|
58 |
template: |2-
|
59 |
# Problem statement
|
60 |
{{problem_description}}
|
|
|
18 |
|
19 |
# ~~~ Flow specification ~~~
|
20 |
backend:
|
21 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
22 |
api_infos: ???
|
23 |
model_name:
|
24 |
openai: "gpt-4"
|
|
|
33 |
presence_penalty: 0
|
34 |
|
35 |
system_message_prompt_template:
|
36 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
37 |
template: |2-
|
38 |
Your goal is to provide executable Python code that solves a coding interview problem. The code should correctly handle all corner cases in order to pass the hidden test cases, which are used to evaluate the correctness of the solution.
|
39 |
|
|
|
47 |
|
48 |
|
49 |
human_message_prompt_template:
|
50 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
51 |
template: "{{query}}"
|
52 |
input_variables:
|
53 |
- "query"
|
54 |
|
55 |
|
56 |
init_human_message_prompt_template:
|
57 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
58 |
template: |2-
|
59 |
# Problem statement
|
60 |
{{problem_description}}
|
LC_CodeCollab.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class LC_CodeCollab(CircularFlow):
|
|
|
1 |
+
from aiflows.base_flows import CircularFlow
|
2 |
|
3 |
|
4 |
class LC_CodeCollab(CircularFlow):
|
LC_CodeCollab.yaml
CHANGED
@@ -18,7 +18,7 @@ subflows_config:
|
|
18 |
_target_: .LC_Code.instantiate_from_default_config
|
19 |
name: "CodeGenerator"
|
20 |
human_message_prompt_template:
|
21 |
-
_target_:
|
22 |
template: |2-
|
23 |
# Feedback on the last proposed solution
|
24 |
{{code_feedback}}
|
@@ -45,29 +45,29 @@ topology:
|
|
45 |
|
46 |
### Input Interface
|
47 |
input_interface:
|
48 |
-
_target_:
|
49 |
additional_transformations:
|
50 |
-
- _target_:
|
51 |
|
52 |
### Flow Specification
|
53 |
flow: CodeGenerator
|
54 |
|
55 |
### Output Interface
|
56 |
output_interface:
|
57 |
-
_target_:
|
58 |
additional_transformations:
|
59 |
-
- _target_:
|
60 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
61 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
62 |
input_key: "api_output"
|
63 |
output_key: "code"
|
64 |
strip: True
|
65 |
assert_unique: True
|
66 |
-
- _target_:
|
67 |
end_of_interaction_string: "Final answer"
|
68 |
input_key: "api_output"
|
69 |
output_key: "end_of_interaction"
|
70 |
-
- _target_:
|
71 |
reset: false
|
72 |
|
73 |
# ~~~ Code Critic ~~~
|
@@ -75,16 +75,16 @@ topology:
|
|
75 |
|
76 |
### Input Interface
|
77 |
input_interface:
|
78 |
-
_target_:
|
79 |
additional_transformations:
|
80 |
-
- _target_:
|
81 |
|
82 |
### Flow Specification
|
83 |
flow: CodeCritic
|
84 |
|
85 |
### Output Interface
|
86 |
output_interface:
|
87 |
-
_target_:
|
88 |
keys_to_rename:
|
89 |
api_output: "code_feedback"
|
90 |
|
|
|
18 |
_target_: .LC_Code.instantiate_from_default_config
|
19 |
name: "CodeGenerator"
|
20 |
human_message_prompt_template:
|
21 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
22 |
template: |2-
|
23 |
# Feedback on the last proposed solution
|
24 |
{{code_feedback}}
|
|
|
45 |
|
46 |
### Input Interface
|
47 |
input_interface:
|
48 |
+
_target_: aiflows.interfaces.KeyInterface
|
49 |
additional_transformations:
|
50 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
51 |
|
52 |
### Flow Specification
|
53 |
flow: CodeGenerator
|
54 |
|
55 |
### Output Interface
|
56 |
output_interface:
|
57 |
+
_target_: aiflows.interfaces.KeyInterface
|
58 |
additional_transformations:
|
59 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
60 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
61 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
62 |
input_key: "api_output"
|
63 |
output_key: "code"
|
64 |
strip: True
|
65 |
assert_unique: True
|
66 |
+
- _target_: aiflows.data_transformations.EndOfInteraction
|
67 |
end_of_interaction_string: "Final answer"
|
68 |
input_key: "api_output"
|
69 |
output_key: "end_of_interaction"
|
70 |
+
- _target_: aiflows.data_transformations.PrintPreviousMessages
|
71 |
reset: false
|
72 |
|
73 |
# ~~~ Code Critic ~~~
|
|
|
75 |
|
76 |
### Input Interface
|
77 |
input_interface:
|
78 |
+
_target_: aiflows.interfaces.KeyInterface
|
79 |
additional_transformations:
|
80 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
81 |
|
82 |
### Flow Specification
|
83 |
flow: CodeCritic
|
84 |
|
85 |
### Output Interface
|
86 |
output_interface:
|
87 |
+
_target_: aiflows.interfaces.KeyInterface
|
88 |
keys_to_rename:
|
89 |
api_output: "code_feedback"
|
90 |
|
LC_CodeCritic.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from flow_modules.aiflows.
|
2 |
|
3 |
|
4 |
-
class LC_CodeCritic(
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
|
|
1 |
+
from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow
|
2 |
|
3 |
|
4 |
+
class LC_CodeCritic(ChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
LC_CodeCritic.yaml
CHANGED
@@ -19,7 +19,7 @@ output_interface:
|
|
19 |
|
20 |
# ~~~ Flow specification ~~~
|
21 |
backend:
|
22 |
-
_target_:
|
23 |
api_infos: ???
|
24 |
model_name:
|
25 |
openai: "gpt-4"
|
@@ -35,7 +35,7 @@ backend:
|
|
35 |
presence_penalty: 0
|
36 |
|
37 |
system_message_prompt_template:
|
38 |
-
_target_:
|
39 |
template: |2-
|
40 |
Your goal is to identify potential issues with a competitive programming solution attempt.
|
41 |
|
@@ -52,14 +52,14 @@ system_message_prompt_template:
|
|
52 |
|
53 |
|
54 |
human_message_prompt_template:
|
55 |
-
_target_:
|
56 |
template: "{{query}}"
|
57 |
input_variables:
|
58 |
- "query"
|
59 |
|
60 |
|
61 |
init_human_message_prompt_template:
|
62 |
-
_target_:
|
63 |
template: |2-
|
64 |
# Problem statement
|
65 |
{{problem_description}}
|
|
|
19 |
|
20 |
# ~~~ Flow specification ~~~
|
21 |
backend:
|
22 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
23 |
api_infos: ???
|
24 |
model_name:
|
25 |
openai: "gpt-4"
|
|
|
35 |
presence_penalty: 0
|
36 |
|
37 |
system_message_prompt_template:
|
38 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
39 |
template: |2-
|
40 |
Your goal is to identify potential issues with a competitive programming solution attempt.
|
41 |
|
|
|
52 |
|
53 |
|
54 |
human_message_prompt_template:
|
55 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
56 |
template: "{{query}}"
|
57 |
input_variables:
|
58 |
- "query"
|
59 |
|
60 |
|
61 |
init_human_message_prompt_template:
|
62 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
63 |
template: |2-
|
64 |
# Problem statement
|
65 |
{{problem_description}}
|
LC_CodeCriticWrongAttempt.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
from flow_modules.aiflows.
|
2 |
|
3 |
|
4 |
-
class LC_CodeCriticWrongAttempt(
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
|
|
1 |
+
from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow
|
2 |
|
3 |
|
4 |
+
class LC_CodeCriticWrongAttempt(ChatAtomicFlow):
|
5 |
def __init__(self, **kwargs):
|
6 |
super().__init__(**kwargs)
|
LC_CodeCriticWrongAttempt.yaml
CHANGED
@@ -20,7 +20,7 @@ output_interface:
|
|
20 |
|
21 |
# ~~~ Flow specification ~~~
|
22 |
backend:
|
23 |
-
_target_:
|
24 |
api_infos: ???
|
25 |
model_name:
|
26 |
openai: "gpt-4"
|
@@ -35,7 +35,7 @@ backend:
|
|
35 |
presence_penalty: 0
|
36 |
|
37 |
system_message_prompt_template:
|
38 |
-
_target_:
|
39 |
template: |2-
|
40 |
Your goal is to identify the issues with an incorrect competitive programming solution attempt.
|
41 |
|
@@ -53,14 +53,14 @@ system_message_prompt_template:
|
|
53 |
|
54 |
|
55 |
human_message_prompt_template:
|
56 |
-
_target_:
|
57 |
template: "{{query}}"
|
58 |
input_variables:
|
59 |
- "query"
|
60 |
|
61 |
|
62 |
init_human_message_prompt_template:
|
63 |
-
_target_:
|
64 |
template: |2-
|
65 |
# Problem statement
|
66 |
{{problem_description}}
|
|
|
20 |
|
21 |
# ~~~ Flow specification ~~~
|
22 |
backend:
|
23 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
24 |
api_infos: ???
|
25 |
model_name:
|
26 |
openai: "gpt-4"
|
|
|
35 |
presence_penalty: 0
|
36 |
|
37 |
system_message_prompt_template:
|
38 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
39 |
template: |2-
|
40 |
Your goal is to identify the issues with an incorrect competitive programming solution attempt.
|
41 |
|
|
|
53 |
|
54 |
|
55 |
human_message_prompt_template:
|
56 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
57 |
template: "{{query}}"
|
58 |
input_variables:
|
59 |
- "query"
|
60 |
|
61 |
|
62 |
init_human_message_prompt_template:
|
63 |
+
_target_: aiflows.prompt_template.JinjaPrompt
|
64 |
template: |2-
|
65 |
# Problem statement
|
66 |
{{problem_description}}
|
LC_CodeDebug.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
|
4 |
class LC_CodeDebug(CircularFlow):
|
|
|
1 |
+
from aiflows.base_flows import CircularFlow
|
2 |
|
3 |
|
4 |
class LC_CodeDebug(CircularFlow):
|
LC_CodeDebug.yaml
CHANGED
@@ -23,7 +23,7 @@ subflows_config:
|
|
23 |
_target_: .LC_Code.instantiate_from_default_config
|
24 |
name: "CodeGenerator"
|
25 |
backend:
|
26 |
-
_target_:
|
27 |
api_infos: ???
|
28 |
model_name:
|
29 |
openai: "gpt-4"
|
@@ -54,25 +54,25 @@ topology:
|
|
54 |
|
55 |
### Input Interface
|
56 |
input_interface:
|
57 |
-
_target_:
|
58 |
additional_transformations:
|
59 |
-
- _target_:
|
60 |
|
61 |
### Flow Specification
|
62 |
flow: CodeGenerator
|
63 |
|
64 |
### Output Interface
|
65 |
output_interface:
|
66 |
-
_target_:
|
67 |
additional_transformations:
|
68 |
-
- _target_:
|
69 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
70 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
71 |
input_key: "api_output"
|
72 |
output_key: "code"
|
73 |
strip: True
|
74 |
assert_unique: True
|
75 |
-
- _target_:
|
76 |
keys_to_select:
|
77 |
- "code"
|
78 |
|
@@ -84,16 +84,16 @@ topology:
|
|
84 |
|
85 |
### Input Interface
|
86 |
input_interface:
|
87 |
-
_target_:
|
88 |
additional_transformations:
|
89 |
-
- _target_:
|
90 |
|
91 |
### Flow Specification
|
92 |
flow: CodeTestingCritic
|
93 |
|
94 |
### Output Interface
|
95 |
output_interface:
|
96 |
-
_target_:
|
97 |
additional_transformations:
|
98 |
- _target_: .src.data_transformations.CorrectnessFlag
|
99 |
input_key: "public_tests_results"
|
|
|
23 |
_target_: .LC_Code.instantiate_from_default_config
|
24 |
name: "CodeGenerator"
|
25 |
backend:
|
26 |
+
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
27 |
api_infos: ???
|
28 |
model_name:
|
29 |
openai: "gpt-4"
|
|
|
54 |
|
55 |
### Input Interface
|
56 |
input_interface:
|
57 |
+
_target_: aiflows.interfaces.KeyInterface
|
58 |
additional_transformations:
|
59 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
60 |
|
61 |
### Flow Specification
|
62 |
flow: CodeGenerator
|
63 |
|
64 |
### Output Interface
|
65 |
output_interface:
|
66 |
+
_target_: aiflows.interfaces.KeyInterface
|
67 |
additional_transformations:
|
68 |
+
- _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor
|
69 |
regex: '(?<=```python)([\s\S]*?)(?=```)'
|
70 |
regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
|
71 |
input_key: "api_output"
|
72 |
output_key: "code"
|
73 |
strip: True
|
74 |
assert_unique: True
|
75 |
+
- _target_: aiflows.data_transformations.PrintPreviousMessages
|
76 |
keys_to_select:
|
77 |
- "code"
|
78 |
|
|
|
84 |
|
85 |
### Input Interface
|
86 |
input_interface:
|
87 |
+
_target_: aiflows.interfaces.KeyInterface
|
88 |
additional_transformations:
|
89 |
+
- _target_: aiflows.data_transformations.KeyMatchInput
|
90 |
|
91 |
### Flow Specification
|
92 |
flow: CodeTestingCritic
|
93 |
|
94 |
### Output Interface
|
95 |
output_interface:
|
96 |
+
_target_: aiflows.interfaces.KeyInterface
|
97 |
additional_transformations:
|
98 |
- _target_: .src.data_transformations.CorrectnessFlag
|
99 |
input_key: "public_tests_results"
|