martinjosifoski commited on
Commit
91b62cb
1 Parent(s): df98f2b

Remove dep. on application_flows & misc updates.

Browse files
CF_Code.py CHANGED
@@ -1,4 +1,4 @@
1
- from flows.application_flows import OpenAIChatAtomicFlow
2
 
3
 
4
  class CF_Code(OpenAIChatAtomicFlow):
 
1
+ from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow
2
 
3
 
4
  class CF_Code(OpenAIChatAtomicFlow):
CF_Code.yaml CHANGED
@@ -21,7 +21,7 @@ model_name: "gpt-4"
21
 
22
  generation_parameters:
23
  n: 1
24
- max_tokens: 2000
25
  temperature: 0.3
26
 
27
  model_kwargs:
 
21
 
22
  generation_parameters:
23
  n: 1
24
+ max_tokens: 3000
25
  temperature: 0.3
26
 
27
  model_kwargs:
CF_CodeCollab.py CHANGED
@@ -1,6 +1,6 @@
1
- from flows.application_flows import GeneratorCriticFlow
2
 
3
 
4
- class CF_CodeCollab(GeneratorCriticFlow):
5
  def __init__(self, **kwargs):
6
  super().__init__(**kwargs)
 
1
+ from flows.base_flows import CircularFlow
2
 
3
 
4
+ class CF_CodeCollab(CircularFlow):
5
  def __init__(self, **kwargs):
6
  super().__init__(**kwargs)
CF_CodeCollab.yaml CHANGED
@@ -2,8 +2,8 @@ name: "CodeCollab_Flow"
2
  description: |2-
3
  Given a problem description, alternate between a step in which code is generated, and a step in which the produced code is evaluated and useful feedback is provided.
4
 
5
-
6
  max_rounds: 4
 
7
 
8
  input_interface:
9
  - "problem_description"
@@ -89,5 +89,3 @@ topology:
89
  api_output: "code_feedback"
90
 
91
  reset: true
92
-
93
- early_exit_key: "end_of_interaction"
 
2
  description: |2-
3
  Given a problem description, alternate between a step in which code is generated, and a step in which the produced code is evaluated and useful feedback is provided.
4
 
 
5
  max_rounds: 4
6
+ early_exit_key: "end_of_interaction"
7
 
8
  input_interface:
9
  - "problem_description"
 
89
  api_output: "code_feedback"
90
 
91
  reset: true
 
 
CF_CodeCritic.py CHANGED
@@ -1,4 +1,4 @@
1
- from flows.application_flows import OpenAIChatAtomicFlow
2
 
3
 
4
  class CF_CodeCritic(OpenAIChatAtomicFlow):
 
1
+ from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow
2
 
3
 
4
  class CF_CodeCritic(OpenAIChatAtomicFlow):
CF_CodeCritic.yaml CHANGED
@@ -83,5 +83,3 @@ init_human_message_prompt_template:
83
  - "io_examples_and_explanation"
84
  - "code"
85
  template_format: jinja2
86
-
87
-
 
83
  - "io_examples_and_explanation"
84
  - "code"
85
  template_format: jinja2
 
 
CF_CodeCriticWrongAttempt.py CHANGED
@@ -1,4 +1,4 @@
1
- from flows.application_flows import OpenAIChatAtomicFlow
2
 
3
 
4
  class CF_CodeCriticWrongAttempt(OpenAIChatAtomicFlow):
 
1
+ from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow
2
 
3
 
4
  class CF_CodeCriticWrongAttempt(OpenAIChatAtomicFlow):
CF_CodeDebug.py CHANGED
@@ -1,7 +1,7 @@
1
- from flows.application_flows import GeneratorCriticFlow
2
 
3
 
4
- class CF_CodeDebug(GeneratorCriticFlow):
5
  def __init__(self, **kwargs):
6
  super().__init__(**kwargs)
7
 
 
1
+ from flows.base_flows import CircularFlow
2
 
3
 
4
+ class CF_CodeDebug(CircularFlow):
5
  def __init__(self, **kwargs):
6
  super().__init__(**kwargs)
7
 
CF_CodeDebugCollab.py CHANGED
@@ -1,7 +1,7 @@
1
- from flows.application_flows import GeneratorCriticFlow
2
 
3
 
4
- class CF_CodeDebugCollab(GeneratorCriticFlow):
5
  def __init__(self, **kwargs):
6
  super().__init__(**kwargs)
7
 
 
1
+ from flows.base_flows import CircularFlow
2
 
3
 
4
+ class CF_CodeDebugCollab(CircularFlow):
5
  def __init__(self, **kwargs):
6
  super().__init__(**kwargs)
7
 
CF_CodeDebugCritic.yaml CHANGED
@@ -1,5 +1,6 @@
1
  name: "CodeDebugCritic_Flow"
2
- description: "Given a problem description and a candidate solution, test the code and provide useful feedback concerning the correctness of the solution and the potential mistakes."
 
3
 
4
  # ~~~ Input interface specification ~~~
5
  input_interface:
@@ -17,8 +18,6 @@ output_interface:
17
  - "code_feedback"
18
 
19
  # ~~~ Flow specification ~~~
20
- public_tests_key: "public_tests_individual_io"
21
-
22
  subflows_config:
23
  CodeTestingCritic:
24
  _target_: .CF_CodeTesting.instantiate_from_default_config
 
1
  name: "CodeDebugCritic_Flow"
2
+ description: |-2
3
+ Given a problem description and a candidate solution, test the code and provide useful feedback concerning the correctness of the solution and the potential mistakes.
4
 
5
  # ~~~ Input interface specification ~~~
6
  input_interface:
 
18
  - "code_feedback"
19
 
20
  # ~~~ Flow specification ~~~
 
 
21
  subflows_config:
22
  CodeTestingCritic:
23
  _target_: .CF_CodeTesting.instantiate_from_default_config
CF_CodeReflect.py CHANGED
@@ -1,6 +1,6 @@
1
- from flows.application_flows import GeneratorCriticFlow
2
 
3
 
4
- class CF_CodeReflect(GeneratorCriticFlow):
5
  def __init__(self, **kwargs):
6
  super().__init__(**kwargs)
 
1
+ from flows.base_flows import CircularFlow
2
 
3
 
4
+ class CF_CodeReflect(CircularFlow):
5
  def __init__(self, **kwargs):
6
  super().__init__(**kwargs)
CF_CodeReflect.yaml CHANGED
@@ -1,5 +1,6 @@
1
  name: "CodeReflect_Flow"
2
- description: "Given a problem description, generate code, reflecting on it and improving it until a message suggesting that the code seems correct or a maximum number of rounds is reached."
 
3
 
4
  # ~~~ Input interface specification ~~~
5
  input_interface:
@@ -14,6 +15,7 @@ output_interface:
14
 
15
  # ~~~ Flow specification ~~~
16
  max_rounds: 4
 
17
 
18
  ### Subflows specification
19
  subflows_config:
@@ -81,5 +83,3 @@ topology:
81
 
82
  ### Reset flag
83
  reset: true
84
-
85
- early_exit_key: "end_of_interaction"
 
1
  name: "CodeReflect_Flow"
2
+ description: |-2
3
+ Given a problem description, generate code, reflect on it and improve it until a message suggesting that the code seems correct or a maximum number of rounds is reached.
4
 
5
  # ~~~ Input interface specification ~~~
6
  input_interface:
 
15
 
16
  # ~~~ Flow specification ~~~
17
  max_rounds: 4
18
+ early_exit_key: "end_of_interaction"
19
 
20
  ### Subflows specification
21
  subflows_config:
 
83
 
84
  ### Reset flag
85
  reset: true
 
 
CF_CodeTesting.py CHANGED
@@ -1,7 +1,7 @@
1
  from typing import Any, Dict
2
 
3
  from flows import logging
4
- from flows.utils.general_helpers import validate_parameters
5
  from .src.evaluation import testing_utils_codeforces
6
  from .CodeTesting import CodeTesting
7
 
@@ -16,10 +16,10 @@ class CF_CodeTesting(CodeTesting):
16
  super().__init__(**kwargs)
17
 
18
  @classmethod
19
- def _validate_parameters(cls, kwargs):
20
- validate_parameters(cls, kwargs)
21
 
22
- if "public_tests_key" not in kwargs["flow_config"] and "hidden_tests_key" not in kwargs["flow_config"]:
23
  raise ValueError("At least one of 'public_tests_key' "
24
  "and 'hidden_tests_key' must be specified in the config.")
25
 
 
1
  from typing import Any, Dict
2
 
3
  from flows import logging
4
+ from flows.utils.general_helpers import validate_flow_config
5
  from .src.evaluation import testing_utils_codeforces
6
  from .CodeTesting import CodeTesting
7
 
 
16
  super().__init__(**kwargs)
17
 
18
  @classmethod
19
+ def _validate_flow_config(cls, kwargs):
20
+ validate_flow_config(cls, kwargs)
21
 
22
+ if "public_tests_key" not in kwargs and "hidden_tests_key" not in kwargs:
23
  raise ValueError("At least one of 'public_tests_key' "
24
  "and 'hidden_tests_key' must be specified in the config.")
25
 
FixedReply_CodeReflect.py CHANGED
@@ -1,4 +1,4 @@
1
- from flows.application_flows import FixedReplyFlow
2
 
3
 
4
  class FixedReply_CodeReflect(FixedReplyFlow):
 
1
+ from flow_modules.aiflows.FixedReplyFlowModule import FixedReplyFlow
2
 
3
 
4
  class FixedReply_CodeReflect(FixedReplyFlow):
FixedReply_CodeReflect.yaml CHANGED
@@ -1,5 +1,6 @@
1
  name: "CodeReflectCritic"
2
- description: "A flow that prompts the caller to reflect on the generated code and provide a corrected version if necessary."
 
3
 
4
  input_interface: []
5
  output_interface:
 
1
  name: "CodeReflectCritic"
2
+ description: |-2
3
+ A flow that prompts the caller to reflect on the generated code and provide a corrected version if necessary.
4
 
5
  input_interface: []
6
  output_interface: