Skip to content

Commit

Permalink
feat: add entry for rdagent. (#187)
Browse files Browse the repository at this point in the history
* Add entries

* update entry for rdagent

* lint

* fix typo
  • Loading branch information
you-n-g authored Aug 8, 2024
1 parent 18c0501 commit 121b6d9
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,4 @@ Making contributions is not a hard thing. Solving an issue(maybe just answering
<a href="https://github.com/microsoft/RD-Agent/graphs/contributors"><img src="https://contrib.rocks/image?repo=microsoft/RD-Agent&max=240&columns=18" /></a>

# 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.
2 changes: 1 addition & 1 deletion docs/scens/data_agent_fin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/scens/data_copilot_fin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/scens/model_agent_fin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~~~~~~~~~~~~~~~~~
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
31 changes: 31 additions & 0 deletions rdagent/app/cli.py
Original file line number Diff line number Diff line change
@@ -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,
}
)
2 changes: 2 additions & 0 deletions rdagent/app/data_mining/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions rdagent/app/general_model/general_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# %%
from dotenv import load_dotenv

from rdagent.scenarios.general_model.scenario import GeneralModelScenario
Expand All @@ -17,11 +16,11 @@
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ def running(self, prev_out: dict[str, Any]):

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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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,
Expand Down Expand Up @@ -142,11 +142,13 @@ def exp_gen(self, prev_out: dict[str, Any]):

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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 121b6d9

Please sign in to comment.