diff --git a/README.md b/README.md index 8eb72dd6..773dccda 100644 --- a/README.md +++ b/README.md @@ -202,4 +202,4 @@ Making contributions is not a hard thing. Solving an issue(maybe just answering # Disclaimer -**The RD-agent is provided β€œas is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. The RD-agent is aimed to facilitate research and development process in the financial industry and not ready-to-use for any financial investment or advice. Users shall independently assess and test the risks of the RD-agent in a specific use scenario, ensure the responsible use of AI technology, including but not limited to developing and integrating risk mitigation measures, and comply with all applicable laws and regulations in all applicable jurisdictions. The RD-agent does not provide financial opinions or reflect the opinions of Microsoft, nor is it designed to replace the role of qualified financial professionals in formulating, assessing, and approving finance products. The inputs and outputs of the RD-agent belong to the users and users shall assume all liability under any theory of liability, whether in contract, torts, regulatory, negligence, products liability, or otherwise, associated with use of the RD-agent and any inputs and outputs thereof.** +The RD-agent is provided β€œas is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. The RD-agent is aimed to facilitate research and development process in the financial industry and not ready-to-use for any financial investment or advice. Users shall independently assess and test the risks of the RD-agent in a specific use scenario, ensure the responsible use of AI technology, including but not limited to developing and integrating risk mitigation measures, and comply with all applicable laws and regulations in all applicable jurisdictions. The RD-agent does not provide financial opinions or reflect the opinions of Microsoft, nor is it designed to replace the role of qualified financial professionals in formulating, assessing, and approving finance products. The inputs and outputs of the RD-agent belong to the users and users shall assume all liability under any theory of liability, whether in contract, torts, regulatory, negligence, products liability, or otherwise, associated with use of the RD-agent and any inputs and outputs thereof. diff --git a/docs/scens/data_agent_fin.rst b/docs/scens/data_agent_fin.rst index 8e4a3ee5..fd222a49 100644 --- a/docs/scens/data_agent_fin.rst +++ b/docs/scens/data_agent_fin.rst @@ -121,7 +121,7 @@ You can try our demo by running the following command: - πŸš€ Run the Application .. code-block:: sh - python rdagent/app/qlib_rd_loop/factor_w_sc.py + rdagent fin_factor πŸ› οΈ Usage of modules diff --git a/docs/scens/data_copilot_fin.rst b/docs/scens/data_copilot_fin.rst index d276ea26..6c14afd1 100644 --- a/docs/scens/data_copilot_fin.rst +++ b/docs/scens/data_copilot_fin.rst @@ -121,7 +121,7 @@ You can try our demo by running the following command: - πŸš€ Run the Application .. code-block:: sh - python rdagent/app/qlib_rd_loop/factor_from_report_w_sc.py + rdagent fin_factor_report diff --git a/docs/scens/model_agent_fin.rst b/docs/scens/model_agent_fin.rst index 30c16622..1a3c103f 100644 --- a/docs/scens/model_agent_fin.rst +++ b/docs/scens/model_agent_fin.rst @@ -112,7 +112,7 @@ You can try our demo by running the following command: - πŸš€ Run the Application .. code-block:: sh - python rdagent/app/qlib_rd_loop/model_w_sc.py + rdagent fin_model πŸ› οΈ Usage of modules ~~~~~~~~~~~~~~~~~~~~~ diff --git a/pyproject.toml b/pyproject.toml index e2bf5d2c..5a3fbdb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,9 @@ name = "rdagent" readme = "README.md" requires-python = ">=3.10" +[project.scripts] +rdagent = "rdagent.app.cli:app" + [project.urls] homepage = "https://github.com/microsoft/RD-Agent/" issue = "https://github.com/microsoft/RD-Agent/issues" diff --git a/rdagent/app/cli.py b/rdagent/app/cli.py new file mode 100644 index 00000000..b2d642ca --- /dev/null +++ b/rdagent/app/cli.py @@ -0,0 +1,31 @@ +""" +CLI entrance for all rdagent application. + +This will +- make rdagent a nice entry and +- autoamtically load dotenv +""" +import fire +from dotenv import load_dotenv + +from rdagent.app.data_mining.model import main as med_model +from rdagent.app.general_model.general_model import ( + extract_models_and_implement as general_model, +) +from rdagent.app.qlib_rd_loop.factor import main as fin_factor +from rdagent.app.qlib_rd_loop.factor_from_report import main as fin_factor_report +from rdagent.app.qlib_rd_loop.model import main as fin_model + +load_dotenv() + + +def app(): + fire.Fire( + { + "fin_factor": fin_factor, + "fin_factor_report": fin_factor_report, + "fin_model": fin_model, + "med_model": med_model, + "general_model": general_model, + } + ) diff --git a/rdagent/app/data_mining/model.py b/rdagent/app/data_mining/model.py index 1fb56db3..c6e996bd 100644 --- a/rdagent/app/data_mining/model.py +++ b/rdagent/app/data_mining/model.py @@ -11,6 +11,8 @@ class ModelRDLoop(RDLoop): def main(path=None, step_n=None): """ + Auto R&D Evolving loop for models in a medical scenario. + You can continue running session by .. code-block:: python diff --git a/rdagent/app/general_model/general_model.py b/rdagent/app/general_model/general_model.py index 4c4d7b47..cb05dd50 100644 --- a/rdagent/app/general_model/general_model.py +++ b/rdagent/app/general_model/general_model.py @@ -1,4 +1,3 @@ -# %% from dotenv import load_dotenv from rdagent.scenarios.general_model.scenario import GeneralModelScenario @@ -17,11 +16,11 @@ from rdagent.log import rdagent_logger as logger from rdagent.scenarios.qlib.developer.model_coder import QlibModelCoSTEER -def extract_models_and_implement( - report_file_path: str, -) -> None: +def extract_models_and_implement(report_file_path: str) -> None: """ - Extracts models from a given PDF report file and implements the necessary operations. + This is a research copilot to automatically implement models from a report file or paper. + + It extracts models from a given PDF report file and implements the necessary operations. Parameters: report_file_path (str): The path to the report file. The file must be a PDF file. diff --git a/rdagent/app/qlib_rd_loop/factor_w_sc.py b/rdagent/app/qlib_rd_loop/factor.py similarity index 84% rename from rdagent/app/qlib_rd_loop/factor_w_sc.py rename to rdagent/app/qlib_rd_loop/factor.py index d6fde5fe..8379b0f0 100755 --- a/rdagent/app/qlib_rd_loop/factor_w_sc.py +++ b/rdagent/app/qlib_rd_loop/factor.py @@ -27,11 +27,13 @@ class FactorRDLoop(RDLoop): def main(path=None, step_n=None): """ + Auto R&D Evolving loop for fintech factors. + You can continue running session by .. code-block:: python - dotenv run -- python rdagent/app/qlib_rd_loop/factor_w_sc.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional paramter + dotenv run -- python rdagent/app/qlib_rd_loop/factor.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional paramter """ if path is None: diff --git a/rdagent/app/qlib_rd_loop/factor_from_report_w_sc.py b/rdagent/app/qlib_rd_loop/factor_from_report.py similarity index 96% rename from rdagent/app/qlib_rd_loop/factor_from_report_w_sc.py rename to rdagent/app/qlib_rd_loop/factor_from_report.py index a9999478..b5d2c5a6 100644 --- a/rdagent/app/qlib_rd_loop/factor_from_report_w_sc.py +++ b/rdagent/app/qlib_rd_loop/factor_from_report.py @@ -6,7 +6,7 @@ import fire from jinja2 import Environment, StrictUndefined from rdagent.app.qlib_rd_loop.conf import FACTOR_FROM_REPORT_PROP_SETTING -from rdagent.app.qlib_rd_loop.factor_w_sc import FactorRDLoop +from rdagent.app.qlib_rd_loop.factor import FactorRDLoop from rdagent.components.document_reader.document_reader import ( extract_first_page_screenshot_from_pdf, load_and_process_pdfs_by_langchain, @@ -142,11 +142,13 @@ class FactorReportLoop(FactorRDLoop, metaclass=LoopMeta): def main(path=None, step_n=None): """ + Auto R&D Evolving loop for fintech factors (the factors are extracted from finance report). + You can continue running session by .. code-block:: python - dotenv run -- python rdagent/app/qlib_rd_loop/factor_from_report_w_sc.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional parameter + dotenv run -- python rdagent/app/qlib_rd_loop/factor_from_report.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional parameter """ if path is None: diff --git a/rdagent/app/qlib_rd_loop/model_w_sc.py b/rdagent/app/qlib_rd_loop/model.py similarity index 76% rename from rdagent/app/qlib_rd_loop/model_w_sc.py rename to rdagent/app/qlib_rd_loop/model.py index 59e89b67..7a6dba56 100644 --- a/rdagent/app/qlib_rd_loop/model_w_sc.py +++ b/rdagent/app/qlib_rd_loop/model.py @@ -15,11 +15,13 @@ class ModelRDLoop(RDLoop): def main(path=None, step_n=None): """ + Auto R&D Evolving loop for fintech models + You can continue running session by .. code-block:: python - dotenv run -- python rdagent/app/qlib_rd_loop/model_w_sc.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional paramter + dotenv run -- python rdagent/app/qlib_rd_loop/model.py $LOG_PATH/__session__/1/0_propose --step_n 1 # `step_n` is a optional paramter """ if path is None: diff --git a/rdagent/scenarios/qlib/factor_experiment_loader/pdf_loader.py b/rdagent/scenarios/qlib/factor_experiment_loader/pdf_loader.py index 71e7b312..be3e54f8 100644 --- a/rdagent/scenarios/qlib/factor_experiment_loader/pdf_loader.py +++ b/rdagent/scenarios/qlib/factor_experiment_loader/pdf_loader.py @@ -12,6 +12,7 @@ from jinja2 import Environment, StrictUndefined from sklearn.cluster import KMeans from sklearn.metrics.pairwise import cosine_similarity from sklearn.preprocessing import normalize +from tqdm.auto import tqdm from rdagent.components.document_reader.document_reader import ( load_and_process_pdfs_by_langchain, @@ -62,7 +63,7 @@ def classify_report_from_dict( res_dict = {} classify_prompt = document_process_prompts["classify_system"] - for key, value in report_dict.items(): + for key, value in tqdm(report_dict.items()): if not key.endswith(".pdf"): continue file_name = key