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-07-17 15:00:13 +08:00
|
|
|
class Config:
|
|
|
|
|
env_prefix = "FACTOR_CODER_" # Use FACTOR_CODER_ as prefix for environment variables
|
|
|
|
|
|
|
|
|
|
coder_use_cache: bool = False
|
|
|
|
|
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
|
|
|
)
|
2024-07-17 15:00:13 +08:00
|
|
|
data_folder_debug: str = str(
|
2024-07-15 10:23:32 +00:00
|
|
|
(Path().cwd() / "git_ignore_folder" / "factor_implementation_source_data_debug").absolute(),
|
|
|
|
|
)
|
2024-07-17 15:00:13 +08:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
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"
|
2024-08-02 15:04:49 +08:00
|
|
|
select_threshold: int = 10
|
2024-06-14 12:59:44 +08:00
|
|
|
|
|
|
|
|
max_loop: int = 10
|
|
|
|
|
|
|
|
|
|
knowledge_base_path: Union[str, None] = None
|
2024-08-02 14:41:17 +08:00
|
|
|
new_knowledge_base_path: Union[str, None] = knowledge_base_path
|
2024-06-14 12:59:44 +08:00
|
|
|
|
2024-07-17 15:00:13 +08:00
|
|
|
python_bin: str = "python"
|
|
|
|
|
|
2024-05-21 22:48:41 +08:00
|
|
|
|
2024-06-18 11:50:03 +08:00
|
|
|
FACTOR_IMPLEMENT_SETTINGS = FactorImplementSettings()
|