diff --git a/CF_Code.py b/CF_Code.py index 0b0902f0bcce27a2f012e638ea61c5e4baf37100..93cc9ed8703cbff4386041bdb5abcc2ea581dac3 100644 --- a/CF_Code.py +++ b/CF_Code.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class CF_Code(OpenAIChatAtomicFlow): +class CF_Code(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/CF_Code.yaml b/CF_Code.yaml index e8e1c3075faa1c5292dd34fc777a9dde2c7bfd56..daa4998d7ca197168224c634ef5d4cd6568a6d44 100644 --- a/CF_Code.yaml +++ b/CF_Code.yaml @@ -18,7 +18,7 @@ output_interface: # ~~~ Flow specification ~~~ backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend wait_time_per_key: 6 model_name: openai: "gpt-4" @@ -31,7 +31,7 @@ backend: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- 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. @@ -47,14 +47,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/CF_CodeCollab.py b/CF_CodeCollab.py index d662c3b2970f55a23c8b509b188d8a38f8873229..98ad1ad506c39b2f5562b271ca1348486e04dffb 100644 --- a/CF_CodeCollab.py +++ b/CF_CodeCollab.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class CF_CodeCollab(CircularFlow): diff --git a/CF_CodeCollab.yaml b/CF_CodeCollab.yaml index 4b32dde231a1abf0b4d1b1bdee782734ff11a51d..d9f3fcd93d25b74ee0b3fb2f737ef90a1471e58a 100644 --- a/CF_CodeCollab.yaml +++ b/CF_CodeCollab.yaml @@ -18,7 +18,7 @@ subflows_config: _target_: .CF_Code.instantiate_from_default_config name: "CodeGenerator" human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Feedback on the last proposed solution {{code_feedback}} @@ -45,29 +45,29 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.EndOfInteraction + - _target_: aiflows.data_transformations.EndOfInteraction end_of_interaction_string: "Final answer" input_key: "api_output" output_key: "end_of_interaction" - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages reset: false # ~~~ Code Critic ~~~ @@ -75,16 +75,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeCritic ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_rename: api_output: "code_feedback" diff --git a/CF_CodeCritic.py b/CF_CodeCritic.py index 777882f32a81f468a531d38ece89254607f510cc..340ad61b9b925e1d56f52271515e51a40bb55fe1 100644 --- a/CF_CodeCritic.py +++ b/CF_CodeCritic.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class CF_CodeCritic(OpenAIChatAtomicFlow): +class CF_CodeCritic(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/CF_CodeCritic.yaml b/CF_CodeCritic.yaml index 3e580cb5edebde9288b256d1f18099940c0496a1..264db914d03e5c560304d42f14582ebf8ea573e4 100644 --- a/CF_CodeCritic.yaml +++ b/CF_CodeCritic.yaml @@ -19,7 +19,7 @@ output_interface: # ~~~ Flow specification ~~~ backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" @@ -33,7 +33,7 @@ backend: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- Your goal is to identify potential issues with a competitive programming solution attempt. @@ -51,14 +51,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/CF_CodeCriticWrongAttempt.py b/CF_CodeCriticWrongAttempt.py index b9611a00c5a7c26c29a166365d6bb0bf37d5c912..97306aad68ae90b8578aca4ebfe41aba37db6931 100644 --- a/CF_CodeCriticWrongAttempt.py +++ b/CF_CodeCriticWrongAttempt.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class CF_CodeCriticWrongAttempt(OpenAIChatAtomicFlow): +class CF_CodeCriticWrongAttempt(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/CF_CodeCriticWrongAttempt.yaml b/CF_CodeCriticWrongAttempt.yaml index 9ed584068b3b0390621d6f3331d60c4d64c0dd9b..48510b91552aac37ea95f5177e3d0d930e550a6d 100644 --- a/CF_CodeCriticWrongAttempt.yaml +++ b/CF_CodeCriticWrongAttempt.yaml @@ -20,7 +20,7 @@ output_interface: # ~~~ Flow specification ~~~ backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" @@ -35,7 +35,7 @@ backend: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- Your goal is to identify the issues with an incorrect competitive programming solution attempt. @@ -54,14 +54,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/CF_CodeCriticWrongAttemptWithPlan.py b/CF_CodeCriticWrongAttemptWithPlan.py index eeb1f2ddc497fc04433a693cdf5b2e9fb618b752..d5c0a21200db1a1edb0ca404af495b99f8f50e43 100644 --- a/CF_CodeCriticWrongAttemptWithPlan.py +++ b/CF_CodeCriticWrongAttemptWithPlan.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class CF_CodeCriticWrongAttemptWithPlan(OpenAIChatAtomicFlow): +class CF_CodeCriticWrongAttemptWithPlan(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/CF_CodeCriticWrongAttemptWithPlan.yaml b/CF_CodeCriticWrongAttemptWithPlan.yaml index d53b250f1e65ad277cc37446fd68d743be8b46bd..e482bc68439607c9697b501a6202874b98817ae3 100644 --- a/CF_CodeCriticWrongAttemptWithPlan.yaml +++ b/CF_CodeCriticWrongAttemptWithPlan.yaml @@ -21,7 +21,7 @@ output_interface: # ~~~ Flow specification ~~~ backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" @@ -36,7 +36,7 @@ backend: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- Your goal is to identify the issues with an incorrect competitive programming solution attempt. @@ -57,14 +57,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/CF_CodeDebug.py b/CF_CodeDebug.py index 4632045aefca9e7e5ccf19dde826c43a3a9c2bfb..6e285fa4d42363d0cf6eb3db6d5294ef4b6e0396 100644 --- a/CF_CodeDebug.py +++ b/CF_CodeDebug.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class CF_CodeDebug(CircularFlow): diff --git a/CF_CodeDebug.yaml b/CF_CodeDebug.yaml index fcf9b57369148fa9db7713edd1b48db87b0fac40..846852ceaaedae66562fca3e508826749880d918 100644 --- a/CF_CodeDebug.yaml +++ b/CF_CodeDebug.yaml @@ -23,7 +23,7 @@ subflows_config: _target_: .CF_Code.instantiate_from_default_config name: "CodeGenerator" backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend model_name: openai: "gpt-4" azure: "azure/gpt-4" @@ -52,25 +52,25 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "code" @@ -82,16 +82,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeTestingCritic ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - _target_: .src.data_transformations.CorrectnessFlag input_key: "public_tests_results" diff --git a/CF_CodeDebugCollab.py b/CF_CodeDebugCollab.py index d2a638a9c86a142a2a1c338d1d9d064531578bb2..e31cfdb803b751d199a85ee40b8aa70cb4d03286 100644 --- a/CF_CodeDebugCollab.py +++ b/CF_CodeDebugCollab.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class CF_CodeDebugCollab(CircularFlow): diff --git a/CF_CodeDebugCollab.yaml b/CF_CodeDebugCollab.yaml index 11d9aea5d91baadaf4fb7ffed1e2c8ad367b9f9b..c2049a1b9e5061aefc4b38ba854f7f2275a79e9d 100644 --- a/CF_CodeDebugCollab.yaml +++ b/CF_CodeDebugCollab.yaml @@ -22,12 +22,12 @@ subflows_config: _target_: .CF_Code.instantiate_from_default_config name: "CodeGenerator" backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend model_name: openai: "gpt-4" azure: "azure/gpt-4" human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- {{testing_results_summary}} @@ -55,18 +55,18 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" @@ -83,9 +83,9 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeDebugCritic diff --git a/CF_CodeDebugCollabWithPlan.py b/CF_CodeDebugCollabWithPlan.py index 1cff309cda99b0139cf3700c0dea285c0ac47da5..a521c2043253e0f9bb6fe31c77c083d6341d0261 100644 --- a/CF_CodeDebugCollabWithPlan.py +++ b/CF_CodeDebugCollabWithPlan.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class CF_CodeDebugCollabWithPlan(CircularFlow): diff --git a/CF_CodeDebugCollabWithPlan.yaml b/CF_CodeDebugCollabWithPlan.yaml index f5f6208a0deeb020204b63181d4b3e3fbf491b00..e5d1cbc66ec2294e81aee65b00f261e7de6bae3e 100644 --- a/CF_CodeDebugCollabWithPlan.yaml +++ b/CF_CodeDebugCollabWithPlan.yaml @@ -23,13 +23,13 @@ subflows_config: _target_: .CF_CodeWithPlan.instantiate_from_default_config name: "CodeGenerator" backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" azure: "azure/gpt-4" human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- {{testing_results_summary}} @@ -57,18 +57,18 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" @@ -85,9 +85,9 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeDebugCritic diff --git a/CF_CodeDebugCritic.py b/CF_CodeDebugCritic.py index c444f68de4fa6100097dec4ddff30bb161f358fd..19423444152f8bbba97262443d14864101bbfaae 100644 --- a/CF_CodeDebugCritic.py +++ b/CF_CodeDebugCritic.py @@ -1,4 +1,4 @@ -from flows.base_flows import SequentialFlow +from aiflows.base_flows import SequentialFlow class CF_CodeDebugCritic(SequentialFlow): diff --git a/CF_CodeDebugCritic.yaml b/CF_CodeDebugCritic.yaml index 9f1f2c41d4d8baf76c7f6d24a116fa344cf85bc4..9cf42449388dd3d7be8ddc9eb5db577cf0ac8676 100644 --- a/CF_CodeDebugCritic.yaml +++ b/CF_CodeDebugCritic.yaml @@ -30,16 +30,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeTestingCritic ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - _target_: .src.data_transformations.CorrectnessFlag input_key: "public_tests_results" @@ -111,18 +111,18 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeCriticWrongAttempt ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyRename + - _target_: aiflows.data_transformations.KeyRename old_key2new_key: api_output: "code_feedback" diff --git a/CF_CodeDebugCriticWithPlan.py b/CF_CodeDebugCriticWithPlan.py index 5433c6f1213f1b3c4c654ec8c7d6a7ec18de1fe9..7875cdb1501d0c9571e5419860492fcc2fd9dfd1 100644 --- a/CF_CodeDebugCriticWithPlan.py +++ b/CF_CodeDebugCriticWithPlan.py @@ -1,4 +1,4 @@ -from flows.base_flows import SequentialFlow +from aiflows.base_flows import SequentialFlow class CF_CodeDebugCriticWithPlan(SequentialFlow): diff --git a/CF_CodeDebugCriticWithPlan.yaml b/CF_CodeDebugCriticWithPlan.yaml index c59ca0d820f17517115340754ef7dda9537522d8..e6238db9ba785537e27214c85731dcbe432297de 100644 --- a/CF_CodeDebugCriticWithPlan.yaml +++ b/CF_CodeDebugCriticWithPlan.yaml @@ -31,16 +31,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeTestingCritic ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - _target_: .src.data_transformations.CorrectnessFlag input_key: "public_tests_results" @@ -112,18 +112,18 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeCriticWrongAttempt ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyRename + - _target_: aiflows.data_transformations.KeyRename old_key2new_key: api_output: "code_feedback" diff --git a/CF_CodeReflect.py b/CF_CodeReflect.py index 6df32191ab31f693af5397063c1c9cd85ed96705..0cee1fae0ef1cb7a6941d36e6ec0591f3bb348ae 100644 --- a/CF_CodeReflect.py +++ b/CF_CodeReflect.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class CF_CodeReflect(CircularFlow): diff --git a/CF_CodeReflect.yaml b/CF_CodeReflect.yaml index 3a90b33b4aeeb34e62af1517f659e842522d5dca..231384ba8c85b04a85a36333f0be64d47cf19f89 100644 --- a/CF_CodeReflect.yaml +++ b/CF_CodeReflect.yaml @@ -31,9 +31,9 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput keys_to_rename: code_reflect_message: "query" @@ -42,20 +42,20 @@ topology: ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.EndOfInteraction + - _target_: aiflows.data_transformations.EndOfInteraction end_of_interaction_string: "Final answer" input_key: "api_output" output_key: "end_of_interaction" - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "code" - "end_of_interaction" @@ -67,9 +67,9 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification @@ -77,7 +77,7 @@ topology: ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_rename: fixed_reply: "code_reflect_message" diff --git a/CF_CodeTesting.py b/CF_CodeTesting.py index f2bd3b3318a3cd8c37d0ccbedb2ed7071a730a11..2bb9fb044b6a8d3ac399808660d7b41ecf9b5636 100644 --- a/CF_CodeTesting.py +++ b/CF_CodeTesting.py @@ -1,7 +1,7 @@ from typing import Any, Dict -from flows import logging -from flows.utils.general_helpers import validate_flow_config +from aiflows import logging +from aiflows.utils.general_helpers import validate_flow_config from .src.evaluation import testing_utils_codeforces from .CodeTesting import CodeTesting diff --git a/CF_CodeWithPlan.py b/CF_CodeWithPlan.py index 9bf4535b4dca6df0474b6b6aff1614c186b55dd6..44e190865cc3d5bddf4ce6a29c80d4796f2436ed 100644 --- a/CF_CodeWithPlan.py +++ b/CF_CodeWithPlan.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class CF_CodeWithPlan(OpenAIChatAtomicFlow): +class CF_CodeWithPlan(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/CF_CodeWithPlan.yaml b/CF_CodeWithPlan.yaml index d757dc274cd985d2eeda39bdd3ea9921030e694a..cf4d64ead40d0305f5247faa4d2d03dbca81a82d 100644 --- a/CF_CodeWithPlan.yaml +++ b/CF_CodeWithPlan.yaml @@ -19,7 +19,7 @@ output_interface: # ~~~ Flow specification ~~~ backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" @@ -32,7 +32,7 @@ backend: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- 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. @@ -50,14 +50,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/CF_Plan.py b/CF_Plan.py index 8bbf6e1b5815875683b646a8d116686b09f89bd4..9acbf328e65d96ed7cac236cf49110efa46e8fab 100644 --- a/CF_Plan.py +++ b/CF_Plan.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class CF_Plan(OpenAIChatAtomicFlow): +class CF_Plan(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/CF_Plan.yaml b/CF_Plan.yaml index 89c6d5cba6712f37ea5d567cb35669947f01a7da..c7213d0a1d14d2e998e54a88b3e5674ffa238bb9 100644 --- a/CF_Plan.yaml +++ b/CF_Plan.yaml @@ -30,7 +30,7 @@ backend: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- Your goal is to provide a high-level conceptual solution that, if implemented, will solve a given competitive programming problem. @@ -48,14 +48,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/CF_PlanCollab.py b/CF_PlanCollab.py index c9146fbaa03655df0a3637af5a6fd4286c26b650..854d831fb53036e384ec3f7df0729b1a03421e87 100644 --- a/CF_PlanCollab.py +++ b/CF_PlanCollab.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class CF_PlanCollab(CircularFlow): diff --git a/CF_PlanCollab.yaml b/CF_PlanCollab.yaml index c0ff631ade26cb1cc3b2367bffafad870bbd2542..94839a1941d85be3d8b649920ea66a172f2af6e8 100644 --- a/CF_PlanCollab.yaml +++ b/CF_PlanCollab.yaml @@ -21,7 +21,7 @@ subflows_config: PlanGenerator: _target_: .CF_Plan.instantiate_from_default_config human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Feedback on the last proposed conceptual solution {{plan_feedback}} @@ -48,18 +48,18 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' regex_fallback: - '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' @@ -67,27 +67,27 @@ topology: output_key: "plan" strip: True assert_unique: True - - _target_: flows.data_transformations.EndOfInteraction + - _target_: aiflows.data_transformations.EndOfInteraction end_of_interaction_string: "Final answer" input_key: "api_output" output_key: "end_of_interaction" - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages reset: false # ~~~ Plan Critic ~~~ - goal: "Provide feedback for the candidate solution." ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanCritic ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_rename: api_output: "plan_feedback" diff --git a/CF_PlanCollab_Code.py b/CF_PlanCollab_Code.py index b0b941505987367895e3c3c5aa85a5785340fdfb..022758491fde008a314bcb20055d79ddfa2dd48f 100644 --- a/CF_PlanCollab_Code.py +++ b/CF_PlanCollab_Code.py @@ -1,4 +1,4 @@ -from flows.base_flows import SequentialFlow +from aiflows.base_flows import SequentialFlow class CF_PlanCollab_Code(SequentialFlow): diff --git a/CF_PlanCollab_Code.yaml b/CF_PlanCollab_Code.yaml index 705c4abb526c813b7860b4a4d3188af46cac418f..05dfab7b51499e2efcbb87c25550c076bf84ebba 100644 --- a/CF_PlanCollab_Code.yaml +++ b/CF_PlanCollab_Code.yaml @@ -26,16 +26,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_select: - "plan" @@ -44,24 +44,24 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "code" diff --git a/CF_PlanCritic.py b/CF_PlanCritic.py index e57973d1add437f110b7b9106c631dd8a5e1fbe4..c46390dc12a59b14920ade0c9d6ce1805cd98b95 100644 --- a/CF_PlanCritic.py +++ b/CF_PlanCritic.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class CF_PlanCritic(OpenAIChatAtomicFlow): +class CF_PlanCritic(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/CF_PlanCritic.yaml b/CF_PlanCritic.yaml index f6074a8039d24c16b76fa27a95d23f6eced2e64b..c73f54ed0dbca9e3a358675961bd815c122c1910 100644 --- a/CF_PlanCritic.yaml +++ b/CF_PlanCritic.yaml @@ -19,7 +19,7 @@ output_interface: # ~~~ Flow specification ~~~ backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" @@ -33,7 +33,7 @@ backend: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- Your goal is to identify potential issues with a conceptual solution to a given competitive programming problem. @@ -52,14 +52,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/CF_PlanReflect.py b/CF_PlanReflect.py index 3c2c622ef2ff75be01b13c3a00acb8b0f5c72ab0..871662229e4ccf071e2f25102d51ae928861893e 100644 --- a/CF_PlanReflect.py +++ b/CF_PlanReflect.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class CF_PlanReflect(CircularFlow): diff --git a/CF_PlanReflect.yaml b/CF_PlanReflect.yaml index 0af64bec803550d476dae135dc6999f6229d73c5..767a2805452cc702a2cd01fc9b955eb492cc6b63 100644 --- a/CF_PlanReflect.yaml +++ b/CF_PlanReflect.yaml @@ -30,9 +30,9 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput keys_to_rename: plan_reflect_message: "query" @@ -41,9 +41,9 @@ topology: ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' regex_fallback: - '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' @@ -51,11 +51,11 @@ topology: output_key: "plan" strip: True assert_unique: True - - _target_: flows.data_transformations.EndOfInteraction + - _target_: aiflows.data_transformations.EndOfInteraction end_of_interaction_string: "Final answer" input_key: "api_output" output_key: "end_of_interaction" - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "plan" - "end_of_interaction" @@ -67,16 +67,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanReflectCritic ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_rename: fixed_reply: "plan_reflect_message" diff --git a/CF_PlanReflect_Code.py b/CF_PlanReflect_Code.py index d52814d4bdab63cd3f2e1dc22ce30216d04eb810..a71a16c251996211d4b213cb3fbf73e94740dfb2 100644 --- a/CF_PlanReflect_Code.py +++ b/CF_PlanReflect_Code.py @@ -1,4 +1,4 @@ -from flows.base_flows import SequentialFlow +from aiflows.base_flows import SequentialFlow class CF_PlanReflect_Code(SequentialFlow): diff --git a/CF_PlanReflect_Code.yaml b/CF_PlanReflect_Code.yaml index e61c6c2562bb3042d979b036a3e62c28df7cc48a..89a993fb7a3bcca46f6e9ec49df0d9f0fa06f071 100644 --- a/CF_PlanReflect_Code.yaml +++ b/CF_PlanReflect_Code.yaml @@ -26,16 +26,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_select: - "plan" @@ -44,24 +44,24 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "code" diff --git a/CF_Plan_Code.py b/CF_Plan_Code.py index b839b92cb58b79ef1a089ce698b109730aaf856d..e8b2adb639638bbfaec4125a8803ae96b2de685e 100644 --- a/CF_Plan_Code.py +++ b/CF_Plan_Code.py @@ -1,4 +1,4 @@ -from flows.base_flows import SequentialFlow +from aiflows.base_flows import SequentialFlow class CF_Plan_Code(SequentialFlow): diff --git a/CF_Plan_Code.yaml b/CF_Plan_Code.yaml index 1ed2225ea1435d0edda64a4f19d00d5dd9e416c9..2f0aad6fec4ebe66d935db0ab923275c169bec85 100644 --- a/CF_Plan_Code.yaml +++ b/CF_Plan_Code.yaml @@ -26,18 +26,18 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' regex_fallback: - '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' @@ -45,7 +45,7 @@ topology: output_key: "plan" strip: True assert_unique: True - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "plan" @@ -54,24 +54,24 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "code" diff --git a/CodeTesting.py b/CodeTesting.py index b50ff5c0d38e428a12cbf2b88feb33753cec8f84..6a6892e8684b02b9f9e4035bf456d3eaf4498aef 100644 --- a/CodeTesting.py +++ b/CodeTesting.py @@ -1,7 +1,7 @@ from typing import Any, Dict -from flows import logging -from flows.base_flows import AtomicFlow +from aiflows import logging +from aiflows.base_flows import AtomicFlow log = logging.get_logger(__name__) diff --git a/LC_Code.py b/LC_Code.py index b45d275697db567d79ae39de8b056fa18abe9210..aa0aef73d9dd3732e10eb7fc0a35cccdbb638842 100644 --- a/LC_Code.py +++ b/LC_Code.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class LC_Code(OpenAIChatAtomicFlow): +class LC_Code(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/LC_Code.yaml b/LC_Code.yaml index c76f539a61412edb2296ffe825f6881b28f78d0e..cb02129da6341192d34d068a846c10d28dda58e3 100644 --- a/LC_Code.yaml +++ b/LC_Code.yaml @@ -18,7 +18,7 @@ output_interface: # ~~~ Flow specification ~~~ backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" @@ -33,7 +33,7 @@ backend: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- 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. @@ -47,14 +47,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/LC_CodeCollab.py b/LC_CodeCollab.py index 1ca3ce57a762c66a496a0cf57568004a07a10589..2fcb9386041aba9350fd30994fa710ed9b77ec71 100644 --- a/LC_CodeCollab.py +++ b/LC_CodeCollab.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class LC_CodeCollab(CircularFlow): diff --git a/LC_CodeCollab.yaml b/LC_CodeCollab.yaml index 36ae8e31f5a97dbec94641eaa23ad913d9a62303..56dbb143853e45946f8dee82fae5e80c3157f63e 100644 --- a/LC_CodeCollab.yaml +++ b/LC_CodeCollab.yaml @@ -18,7 +18,7 @@ subflows_config: _target_: .LC_Code.instantiate_from_default_config name: "CodeGenerator" human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Feedback on the last proposed solution {{code_feedback}} @@ -45,29 +45,29 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.EndOfInteraction + - _target_: aiflows.data_transformations.EndOfInteraction end_of_interaction_string: "Final answer" input_key: "api_output" output_key: "end_of_interaction" - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages reset: false # ~~~ Code Critic ~~~ @@ -75,16 +75,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeCritic ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_rename: api_output: "code_feedback" diff --git a/LC_CodeCritic.py b/LC_CodeCritic.py index e6f9fc9589ffaea32502b28f58a31e6252095ff5..75b3ec662f3a144538ee613644822498afef3d60 100644 --- a/LC_CodeCritic.py +++ b/LC_CodeCritic.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class LC_CodeCritic(OpenAIChatAtomicFlow): +class LC_CodeCritic(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/LC_CodeCritic.yaml b/LC_CodeCritic.yaml index 4c2406d1919a731fc47cd2808d775fed328789d5..b380a365d5d887c996bd50ea66e5726ef2cf0157 100644 --- a/LC_CodeCritic.yaml +++ b/LC_CodeCritic.yaml @@ -19,7 +19,7 @@ output_interface: # ~~~ Flow specification ~~~ backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" @@ -35,7 +35,7 @@ backend: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- Your goal is to identify potential issues with a competitive programming solution attempt. @@ -52,14 +52,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/LC_CodeCriticWrongAttempt.py b/LC_CodeCriticWrongAttempt.py index 867bf621175a0333eee9c2145504232d82b5462c..c14adcb1368b0fe9a76a24831bbc6911e6bfb8b3 100644 --- a/LC_CodeCriticWrongAttempt.py +++ b/LC_CodeCriticWrongAttempt.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class LC_CodeCriticWrongAttempt(OpenAIChatAtomicFlow): +class LC_CodeCriticWrongAttempt(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/LC_CodeCriticWrongAttempt.yaml b/LC_CodeCriticWrongAttempt.yaml index 0d05695a18bc0d449477f409d492f60d83ed77c0..d70490fab76f908cc623f2b53d3994de4e4d3ac9 100644 --- a/LC_CodeCriticWrongAttempt.yaml +++ b/LC_CodeCriticWrongAttempt.yaml @@ -20,7 +20,7 @@ output_interface: # ~~~ Flow specification ~~~ backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" @@ -35,7 +35,7 @@ backend: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- Your goal is to identify the issues with an incorrect competitive programming solution attempt. @@ -53,14 +53,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/LC_CodeDebug.py b/LC_CodeDebug.py index 0f246a9645240b1b70b7ab93062e1de6881d28a3..00b41bbf1d7c963e343e56de5b043abf3449c0b2 100644 --- a/LC_CodeDebug.py +++ b/LC_CodeDebug.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class LC_CodeDebug(CircularFlow): diff --git a/LC_CodeDebug.yaml b/LC_CodeDebug.yaml index e282ad29a1f509438423eca01c988c79469c60dd..ef299607462790a294c11304be944508196913c9 100644 --- a/LC_CodeDebug.yaml +++ b/LC_CodeDebug.yaml @@ -23,7 +23,7 @@ subflows_config: _target_: .LC_Code.instantiate_from_default_config name: "CodeGenerator" backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" @@ -54,25 +54,25 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "code" @@ -84,16 +84,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeTestingCritic ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - _target_: .src.data_transformations.CorrectnessFlag input_key: "public_tests_results" diff --git a/LC_CodeDebugCollab.py b/LC_CodeDebugCollab.py index 6c777101e109b25b5640b75b2240ce9797526e88..87c6e78f506269fcfe01b3608c11e89cbd8d697b 100644 --- a/LC_CodeDebugCollab.py +++ b/LC_CodeDebugCollab.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class LC_CodeDebugCollab(CircularFlow): diff --git a/LC_CodeDebugCollab.yaml b/LC_CodeDebugCollab.yaml index f341853a7b1ed7ef974e3fc6b9053bd8dbdadc8e..9b9bdb89deb6c1a765fa6b5e53e707fd6e98196f 100644 --- a/LC_CodeDebugCollab.yaml +++ b/LC_CodeDebugCollab.yaml @@ -22,13 +22,13 @@ subflows_config: _target_: .LC_Code.instantiate_from_default_config name: "CodeGenerator" backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" azure: "azure/gpt-4" human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- {{testing_results_summary}} @@ -56,18 +56,18 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" @@ -84,9 +84,9 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeDebugCritic diff --git a/LC_CodeDebugCritic.py b/LC_CodeDebugCritic.py index fd32761afc5e896ecab128bf8cf30d1850a8da51..55fcf28841b4fe9d87818d02a3f8548ab6053aa3 100644 --- a/LC_CodeDebugCritic.py +++ b/LC_CodeDebugCritic.py @@ -1,4 +1,4 @@ -from flows.base_flows import SequentialFlow +from aiflows.base_flows import SequentialFlow class LC_CodeDebugCritic(SequentialFlow): diff --git a/LC_CodeDebugCritic.yaml b/LC_CodeDebugCritic.yaml index bc9e90c7c85ba79b16f6b13b602d3ac3fb473902..f4004c842631f575b03f8525e240ce3d9e1f551e 100644 --- a/LC_CodeDebugCritic.yaml +++ b/LC_CodeDebugCritic.yaml @@ -30,16 +30,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeTestingCritic ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - _target_: .src.data_transformations.CorrectnessFlag input_key: "public_tests_results" @@ -124,18 +124,18 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeCriticWrongAttempt ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyRename + - _target_: aiflows.data_transformations.KeyRename old_key2new_key: api_output: "code_feedback" diff --git a/LC_CodeReflect.yaml b/LC_CodeReflect.yaml index b678932f8122d798a364aa973b8743a6bfcd615d..b1ca8c13490931afe245269a424ab2e2ca098047 100644 --- a/LC_CodeReflect.yaml +++ b/LC_CodeReflect.yaml @@ -30,9 +30,9 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput keys_to_rename: code_reflect_message: "query" @@ -41,20 +41,20 @@ topology: ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.EndOfInteraction + - _target_: aiflows.data_transformations.EndOfInteraction end_of_interaction_string: "Final answer" input_key: "api_output" output_key: "end_of_interaction" - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "code" - "end_of_interaction" @@ -66,9 +66,9 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification @@ -76,7 +76,7 @@ topology: ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_rename: fixed_reply: "code_reflect_message" diff --git a/LC_CodeTesting.py b/LC_CodeTesting.py index a68acfe6cb0f9436e3d9d4a40a476096617eb1e4..7b672961c8ac5a5ff251e411bcba85aecf90b755 100644 --- a/LC_CodeTesting.py +++ b/LC_CodeTesting.py @@ -1,6 +1,6 @@ from typing import Any, Dict -from flows.utils import logging +from aiflows.utils import logging from .src.evaluation import testing_utils_leetcode from .CodeTesting import CodeTesting diff --git a/LC_CodeWithPlan.py b/LC_CodeWithPlan.py index 7521522ebaf73325b05b42ae4d3ddcda322b4735..6e590d9005746c0d90c11d1f432ec6caf760c203 100644 --- a/LC_CodeWithPlan.py +++ b/LC_CodeWithPlan.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class LC_CodeWithPlan(OpenAIChatAtomicFlow): +class LC_CodeWithPlan(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/LC_CodeWithPlan.yaml b/LC_CodeWithPlan.yaml index 85b39cd82233d9d73b39520f2a4fd2c1552bc57d..fc25ad331ec245444341b986d9b8a4aa6c5b60d2 100644 --- a/LC_CodeWithPlan.yaml +++ b/LC_CodeWithPlan.yaml @@ -19,7 +19,7 @@ output_interface: # ~~~ Flow specification ~~~ backend: - _target_: flows.backends.llm_lite.LiteLLMBackend + _target_: aiflows.backends.llm_lite.LiteLLMBackend api_infos: ??? model_name: openai: "gpt-4" @@ -36,7 +36,7 @@ generation_parameters: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- 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. @@ -52,14 +52,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/LC_Plan.py b/LC_Plan.py index 07a3d1a5c27341860bd1bafbdcb2e298d3abee55..b5565c60e11f07aca385fb3ff07081bd6aa735e4 100644 --- a/LC_Plan.py +++ b/LC_Plan.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class LC_Plan(OpenAIChatAtomicFlow): +class LC_Plan(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/LC_Plan.yaml b/LC_Plan.yaml index fcabc200ecd99a688f9bb021a992df8e1c11ff82..66aebae950b0ac221c936612fa9adfb28927aa0a 100644 --- a/LC_Plan.yaml +++ b/LC_Plan.yaml @@ -29,7 +29,7 @@ model_name: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- Your goal is to provide a high-level conceptual solution that, if implemented, will solve a given coding interview problem. @@ -45,14 +45,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/LC_PlanCollab.py b/LC_PlanCollab.py index 565fceacc57aa842d9519d2a31a2ffffb7d71cc3..9ab5c95acb4097b31de7920ab5b0f14779b31caa 100644 --- a/LC_PlanCollab.py +++ b/LC_PlanCollab.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class LC_PlanCollab(CircularFlow): diff --git a/LC_PlanCollab.yaml b/LC_PlanCollab.yaml index f9272c0b610f562a2f460b35c41eb3a6742346c4..0a91a882e1094e6feba7fee85bbc8cfddcf5abc4 100644 --- a/LC_PlanCollab.yaml +++ b/LC_PlanCollab.yaml @@ -21,7 +21,7 @@ subflows_config: PlanGenerator: _target_: .LC_Plan.instantiate_from_default_config human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Feedback on the last proposed conceptual solution {{plan_feedback}} @@ -48,18 +48,18 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' regex_fallback: - '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' @@ -67,27 +67,27 @@ topology: output_key: "plan" strip: True assert_unique: True - - _target_: flows.data_transformations.EndOfInteraction + - _target_: aiflows.data_transformations.EndOfInteraction end_of_interaction_string: "Final answer" input_key: "api_output" output_key: "end_of_interaction" - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages reset: false # ~~~ Plan Critic ~~~ - goal: "Provide feedback for the candidate solution." ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanCritic ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_rename: api_output: "plan_feedback" diff --git a/LC_PlanCollab_Code.py b/LC_PlanCollab_Code.py index f52b4a43aa31a95d3a395de5f35c5f59c2a69c32..f08c5a903aad050711ebf0fdfe68abd4ece6aab6 100644 --- a/LC_PlanCollab_Code.py +++ b/LC_PlanCollab_Code.py @@ -1,4 +1,4 @@ -from flows.base_flows import SequentialFlow +from aiflows.base_flows import SequentialFlow class LC_PlanCollab_Code(SequentialFlow): diff --git a/LC_PlanCollab_Code.yaml b/LC_PlanCollab_Code.yaml index 39cd3765842c71810d3e2fd1212aad1d5577de82..0fa62d9bf10e875fdcd4e6bbbe835862cc264525 100644 --- a/LC_PlanCollab_Code.yaml +++ b/LC_PlanCollab_Code.yaml @@ -26,16 +26,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_select: - "plan" @@ -44,24 +44,24 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "code" diff --git a/LC_PlanCritic.py b/LC_PlanCritic.py index 6f4c97ae9310702cc0df9a549ad8bf3db3a7a01b..8310bb21337f67f64d3aec2f9f05060b6ab75b6c 100644 --- a/LC_PlanCritic.py +++ b/LC_PlanCritic.py @@ -1,6 +1,6 @@ -from flow_modules.aiflows.OpenAIChatFlowModule import OpenAIChatAtomicFlow +from flow_modules.aiflows.ChatFlowModule import ChatAtomicFlow -class LC_PlanCritic(OpenAIChatAtomicFlow): +class LC_PlanCritic(ChatAtomicFlow): def __init__(self, **kwargs): super().__init__(**kwargs) diff --git a/LC_PlanCritic.yaml b/LC_PlanCritic.yaml index 3ec20a67c823bf6f7b7d244f7750f6a53aa70c22..4fb7f438b9488e119b09a15772927a84d07cc9e6 100644 --- a/LC_PlanCritic.yaml +++ b/LC_PlanCritic.yaml @@ -32,7 +32,7 @@ backends: presence_penalty: 0 system_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- Your goal is to identify potential issues with a conceptual solution to a given competitive programming problem. @@ -49,14 +49,14 @@ system_message_prompt_template: human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: "{{query}}" input_variables: - "query" init_human_message_prompt_template: - _target_: flows.prompt_template.JinjaPrompt + _target_: aiflows.prompt_template.JinjaPrompt template: |2- # Problem statement {{problem_description}} diff --git a/LC_PlanReflect.py b/LC_PlanReflect.py index e581a89c45909f2e6e08ead730e39d747f5105e9..4b555c08c6e7601f8ac2cb60f47b956089dbe2fe 100644 --- a/LC_PlanReflect.py +++ b/LC_PlanReflect.py @@ -1,4 +1,4 @@ -from flows.base_flows import CircularFlow +from aiflows.base_flows import CircularFlow class LC_PlanReflect(CircularFlow): diff --git a/LC_PlanReflect.yaml b/LC_PlanReflect.yaml index 03e95e2ac74cca80348cabad36a550abedff6ad5..7b6744684784b9bf3478677c240aaf7009a70097 100644 --- a/LC_PlanReflect.yaml +++ b/LC_PlanReflect.yaml @@ -29,9 +29,9 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput keys_to_rename: plan_reflect_message: "query" @@ -40,9 +40,9 @@ topology: ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' regex_fallback: - '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' @@ -50,11 +50,11 @@ topology: output_key: "plan" strip: True assert_unique: True - - _target_: flows.data_transformations.EndOfInteraction + - _target_: aiflows.data_transformations.EndOfInteraction end_of_interaction_string: "Final answer" input_key: "api_output" output_key: "end_of_interaction" - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "plan" - "end_of_interaction" @@ -66,16 +66,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanReflectCritic ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_rename: fixed_reply: "plan_reflect_message" diff --git a/LC_PlanReflect_Code.py b/LC_PlanReflect_Code.py index 28606301f3655ed0a5838933c1f86d25e81eac6d..64d97e4d1887b75e5663d1c4bab3e1753588c214 100644 --- a/LC_PlanReflect_Code.py +++ b/LC_PlanReflect_Code.py @@ -1,4 +1,4 @@ -from flows.base_flows import SequentialFlow +from aiflows.base_flows import SequentialFlow class LC_PlanReflect_Code(SequentialFlow): diff --git a/LC_PlanReflect_Code.yaml b/LC_PlanReflect_Code.yaml index 91c6f4dff76ae6bc18978ea52c2de65e064ad613..db63d7eb4c041b08880f2757d439324122cb0304 100644 --- a/LC_PlanReflect_Code.yaml +++ b/LC_PlanReflect_Code.yaml @@ -26,16 +26,16 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface keys_to_select: - "plan" @@ -44,24 +44,24 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "code" \ No newline at end of file diff --git a/LC_Plan_Code.py b/LC_Plan_Code.py index de03c05b1fe634315324265de9ad2db6f3d57eb2..5e0ed3d46886ab9d019ad2f14d0c0e68be72d557 100644 --- a/LC_Plan_Code.py +++ b/LC_Plan_Code.py @@ -1,4 +1,4 @@ -from flows.base_flows import SequentialFlow +from aiflows.base_flows import SequentialFlow class LC_Plan_Code(SequentialFlow): diff --git a/LC_Plan_Code.yaml b/LC_Plan_Code.yaml index 78fe5f5c604472738f9222975b06a0bae5b24ee0..41ed3af80c231f608a6217042776fd5aa940bd4f 100644 --- a/LC_Plan_Code.yaml +++ b/LC_Plan_Code.yaml @@ -26,18 +26,18 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: PlanGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=Conceptual solution)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' regex_fallback: - '(?<=Conceptual solution:)([\s\S]*?)(?=\n\n# [A-Z]|\Z)' @@ -45,7 +45,7 @@ topology: output_key: "plan" strip: True assert_unique: True - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "plan" @@ -54,24 +54,24 @@ topology: ### Input Interface input_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.KeyMatchInput + - _target_: aiflows.data_transformations.KeyMatchInput ### Flow Specification flow: CodeGenerator ### Output Interface output_interface: - _target_: flows.interfaces.KeyInterface + _target_: aiflows.interfaces.KeyInterface additional_transformations: - - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor + - _target_: aiflows.data_transformations.RegexFirstOccurrenceExtractor regex: '(?<=```python)([\s\S]*?)(?=```)' regex_fallback: '(?<=```)([\s\S]*?)(?=```)' input_key: "api_output" output_key: "code" strip: True assert_unique: True - - _target_: flows.data_transformations.PrintPreviousMessages + - _target_: aiflows.data_transformations.PrintPreviousMessages keys_to_select: - "code" diff --git a/__init__.py b/__init__.py index 5bc6ab3083278dee9ab75c943133c69cef064541..e4088cc6b82622b78931af8d8a42f00b9cdfa19d 100644 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,7 @@ dependencies = [ {"url": "aiflows/FixedReplyFlowModule", "revision": "main"}, ] -from flows import flow_verse +from aiflows import flow_verse flow_verse.sync_dependencies(dependencies) # ~~~ diff --git a/src/data_transformations/correctness_flag.py b/src/data_transformations/correctness_flag.py index f793a23026fffbb111c3c45556947095d5b88f64..d36f7fc04de6a845e57aacb519681e4a5263e7cb 100644 --- a/src/data_transformations/correctness_flag.py +++ b/src/data_transformations/correctness_flag.py @@ -1,6 +1,6 @@ from typing import Dict, Any -from flows.data_transformations.abstract import DataTransformation +from aiflows.data_transformations.abstract import DataTransformation class CorrectnessFlag(DataTransformation): diff --git a/src/data_transformations/testing_results_summary_generation.py b/src/data_transformations/testing_results_summary_generation.py index 1d87715cef6a1393d5983cd18dfedc606bc36afa..2b328ceb7140afffa77852f83061957a1933724c 100644 --- a/src/data_transformations/testing_results_summary_generation.py +++ b/src/data_transformations/testing_results_summary_generation.py @@ -2,8 +2,8 @@ from typing import Dict, Any import jinja2 -from flows.data_transformations.abstract import DataTransformation -from flows.utils.general_helpers import unflatten_dict +from aiflows.data_transformations.abstract import DataTransformation +from aiflows.utils.general_helpers import unflatten_dict class TestingResultsSummaryGeneration(DataTransformation): diff --git a/src/evaluation/testing_utils_codeforces.py b/src/evaluation/testing_utils_codeforces.py index a0661dd038713cd366f631d2c4183b9007b176e0..9458a74988e29c6cb3c160342b9bba469db0655b 100644 --- a/src/evaluation/testing_utils_codeforces.py +++ b/src/evaluation/testing_utils_codeforces.py @@ -19,7 +19,7 @@ import threading from ..datasets.schema import assert_test_format_codeforces -from flows import logging +from aiflows import logging log = logging.get_logger(__name__) lock = threading.Lock()