2024-05-21 22:48:41 +08:00
|
|
|
from pathlib import Path
|
2024-06-28 11:45:23 +08:00
|
|
|
from typing import Literal, Union
|
2024-05-21 22:48:41 +08:00
|
|
|
|
2024-06-14 12:59:44 +08:00
|
|
|
from pydantic_settings import BaseSettings
|
2024-05-21 22:48:41 +08:00
|
|
|
|
2024-06-14 12:59:44 +08:00
|
|
|
SELECT_METHOD = Literal["random", "scheduler"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FactorImplementSettings(BaseSettings):
|
2024-05-21 22:48:41 +08:00
|
|
|
file_based_execution_data_folder: str = str(
|
2024-06-27 09:39:17 +01:00
|
|
|
(Path().cwd() / "git_ignore_folder" / "factor_implementation_source_data").absolute(),
|
2024-05-21 22:48:41 +08:00
|
|
|
)
|
|
|
|
|
file_based_execution_workspace: str = str(
|
2024-06-27 09:39:17 +01:00
|
|
|
(Path().cwd() / "git_ignore_folder" / "factor_implementation_workspace").absolute(),
|
2024-05-21 22:48:41 +08:00
|
|
|
)
|
|
|
|
|
implementation_execution_cache_location: str = str(
|
2024-06-27 09:39:17 +01:00
|
|
|
(Path().cwd() / "git_ignore_folder" / "factor_implementation_execution_cache").absolute(),
|
2024-05-21 22:48:41 +08:00
|
|
|
)
|
|
|
|
|
enable_execution_cache: bool = True # whether to enable the execution cache
|
|
|
|
|
|
|
|
|
|
# TODO: the factor implement specific settings should not appear in this settings
|
|
|
|
|
# Evolving should have a method specific settings
|
|
|
|
|
# evolving related config
|
|
|
|
|
fail_task_trial_limit: int = 20
|
|
|
|
|
|
|
|
|
|
v1_query_former_trace_limit: int = 5
|
|
|
|
|
v1_query_similar_success_limit: int = 5
|
|
|
|
|
|
|
|
|
|
v2_query_component_limit: int = 1
|
|
|
|
|
v2_query_error_limit: int = 1
|
|
|
|
|
v2_query_former_trace_limit: int = 1
|
|
|
|
|
v2_error_summary: bool = False
|
|
|
|
|
v2_knowledge_sampler: float = 1.0
|
|
|
|
|
|
|
|
|
|
evo_multi_proc_n: int = 16 # how many processes to use for evolving (including eval & generation)
|
|
|
|
|
|
|
|
|
|
file_based_execution_timeout: int = 120 # seconds for each factor implementation execution
|
|
|
|
|
|
2024-06-14 12:59:44 +08:00
|
|
|
select_method: SELECT_METHOD = "random"
|
|
|
|
|
select_ratio: float = 0.5
|
|
|
|
|
|
|
|
|
|
max_loop: int = 10
|
|
|
|
|
|
|
|
|
|
knowledge_base_path: Union[str, None] = None
|
|
|
|
|
new_knowledge_base_path: Union[str, None] = None
|
|
|
|
|
|
2024-05-21 22:48:41 +08:00
|
|
|
|
2024-06-18 11:50:03 +08:00
|
|
|
FACTOR_IMPLEMENT_SETTINGS = FactorImplementSettings()
|