Skip to content

Commit

Permalink
refine the script to factor extraction and implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
peteryangms committed Jun 17, 2024
1 parent 617ab92 commit c48ec03
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,34 @@
from rdagent.document_process.document_reader import load_and_process_pdfs_by_langchain
from rdagent.factor_implementation.share_modules.factor_implementation_utils import load_data_from_dict
from rdagent.factor_implementation.CoSTEER import CoSTEERFG
import pickle
from dotenv import load_dotenv

assert load_dotenv()

def extract_factors_and_implement(report_file_path: str) -> None:
assert load_dotenv()

def extract_factors(report_file_path: str) -> None:
docs_dict = load_and_process_pdfs_by_langchain(Path(report_file_path))

selected_report_dict = classify_report_from_dict(report_dict=docs_dict, vote_time=1)
file_to_factor_result = extract_factors_from_report_dict(docs_dict, selected_report_dict)
factor_dict = merge_file_to_factor_dict_to_factor_dict(file_to_factor_result)

factor_viability = check_factor_viability(factor_dict)

factor_dict, duplication_names_list = deduplicate_factors_by_llm(factor_dict, factor_viability)
return factor_dict

factor_tasks = load_data_from_dict(factor_dict)

def implement_factors(factor_dict: dict) -> None:
factor_tasks = load_data_from_dict(factor_dict)
factor_generate_method = CoSTEERFG()
implementation_result = factor_generate_method.generate(factor_tasks)
return implementation_result

result = factor_generate_method.generate(factor_tasks)

return result
def extract_factors_and_implement(report_file_path: str) -> None:
factor_tasks = extract_factors(report_file_path)
implementation_result = implement_factors(factor_tasks)


if __name__ == "__main__":
extract_factors_and_implement("/home/xuyang1/workspace/report.pdf")
# test_implement()
4 changes: 2 additions & 2 deletions rdagent/core/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
load_dotenv(verbose=True, override=True)

from pydantic_settings import BaseSettings
from rdagent.core.utils import SingletonBaseClass, SingletonMeta


class RDAgentSettings(BaseSettings):
Expand Down Expand Up @@ -94,4 +93,5 @@ class RDAgentSettings(BaseSettings):
max_input_duplicate_factor_group: int = 600
max_output_duplicate_factor_group: int = 20

RD_Agent_Settings = RDAgentSettings()

RD_Agent_Settings = RDAgentSettings()

0 comments on commit c48ec03

Please sign in to comment.