专栏名称: GitHubStore
分享有意思的开源项目
目录
相关文章推荐
玩物志  ·  最便宜的 AI iPhone ... ·  2 天前  
刀法研究所  ·  “美国足力健”,反向激起中国年轻人的购买欲 ·  2 天前  
架构师之路  ·  想要提升deepseek回复质量,会这一招就 ... ·  4 天前  
51好读  ›  专栏  ›  GitHubStore

FinRobot:开源金融智能体平台

GitHubStore  · 公众号  ·  · 2024-06-13 08:29

正文

项目简介

FinRobot是一个超越FinGPT范围的人工智能代理平台,代表着专为金融应用精心设计的综合解决方案。它集成了多种人工智能技术,超越了单纯的语言模型。这一广阔的愿景凸显了该平台的多功能性和适应性,可满足金融行业的多方面需求。

AI Agent的概念:AI Age nt是一个智能实体,它使用大型语言模型作为大脑来感知环境、做出决策和执行行动。与传统人工智能不同,人工智能代理具有独立思考和利用工具逐步实现既定目标的能力。

FinRobot生态系统

FinRobot 的整体框架分为四个不同的层,每个层都旨在解决金融人工智能处理和应用的特定方面:

  1. 金融AI代理层:金融AI代理层现包含金融思维链(CoT)提示,增强复杂分析和决策能力。市场预测代理、文档分析代理和交易策略代理利用 CoT 将金融挑战分解为逻辑步骤,将其先进的算法和领域专业知识与金融市场不断变化的动态相结合,以获得精确、可操作的见解。

  2. 金融LLMs算法层:金融LLMs算 法层配置和利用针对特定领域和全球市场分析专门调整的模型。

  3. LLMOps 和 DataOps 层:LLMOps 层实施多源集成策略,利用一系列最先进的模型为特定财务任务选择最合适的 LLMs。

  4. 多源LLM基础模型层:该基础层支持各种通用和专用LLMs的即插即用功能。


FinRobot:代理工作流程

  1. 感知:该模块捕获并解释来自市场反馈、新闻和经济指标的多模式金融数据,使用复杂的技术构建数据以进行彻底分析。

  2. 大脑:作为核心处理单元,该模块通过LLMs感知来自感知模块的数据,并利用金融思想链(CoT)流程生成结构化指令。

  3. 行动:该模块执行来自大脑模块的指令,应用工具将分析见解转化为可行的结果。行动包括交易、投资组合调整、生成报告或发送警报,从而积极影响金融环境。


FinRobot:智能调度程序

智能调度程序对于确保模型多样性以及优化集成和选择最适合每项任务的 LLM 至关重要。

  • 主管代理:该组件协调任务分配过程,确保根据代理的性能指标和对特定任务的适用性将任务分配给代理。

  • 代理注册:管理注册并跟踪系统内代理的可用性,促进高效的任务分配过程。

  • 代理适配器:根据特定任务定制代理功能,增强其性能以及在整个系统中的集成。

  • 任务管理器:管理和存储针对各种财务任务量身定制的不同常规和微调的基于 LLMs 的代理,并定期更新以确保相关性和有效性。


文件结构

主文件夹 finrobot 具有三个子文件夹agents、data_source、function。

FinRobot├── finrobot (main folder)│   ├── agents│     ├── agent_library.py│     └── workflow.py│   ├── data_source│     ├── finnhub_utils.py│     ├── finnlp_utils.py│     ├── fmp_utils.py│     ├── sec_utils.py│     └── yfinance_utils.py│   ├── functional│     ├── analyzer.py│     ├── charting.py│     ├── coding.py│     ├── quantitative.py│     ├── reportlab.py│     └── text.py│   ├── toolkits.py│   └── utils.py├── configs├── experiments├── tutorials_beginner (hands-on tutorial)│   ├── agent_fingpt_forecaster.ipynb│   └── agent_annual_report.ipynb ├── tutorials_advanced (advanced tutorials for potential finrobot developers)│   ├── agent_trade_strategist.ipynb│   ├── agent_fingpt_forecaster.ipynb│   ├── agent_annual_report.ipynb │   ├── lmm_agent_mplfinance.ipynb│   └── lmm_agent_opt_smacross.ipynb├── setup.py├── OAI_CONFIG_LIST_sample├── config_api_keys_sample├── requirements.txt└── README.md


演示

1. 市场预测代理(预测股票走势方向)

以公司的股票代码、近期基本财务状况和市场新闻作为输入并预测其股票走势。

  1. 导入

import autogenfrom finrobot.utils import get_current_date, register_keys_from_jsonfrom finrobot.agents.workflow import SingleAssistant
  1. 配置

# Read OpenAI API keys from a JSON filellm_config = {    "config_list": autogen.config_list_from_json(        "../OAI_CONFIG_LIST",        filter_dict={"model": ["gpt-4-0125-preview"]},    ),    "timeout": 120,    "temperature": 0,}
# Register FINNHUB API keysregister_keys_from_json("../config_api_keys")
  1. 运行

    company = "NVDA"
    assitant = SingleAssistant( "Market_Analyst", llm_config, # set to "ALWAYS" if you want to chat instead of simply receiving the prediciton human_input_mode="NEVER",)assitant.chat( f"Use all the tools provided to retrieve information available for {company} upon {get_current_date()}. Analyze the positive developments and potential concerns of {company} " "with 2-4 most important factors respectively and keep them concise. Most factors should be inferred from company related news. " f"Then make a rough prediction (e.g. up/down by 2-3%) of the {company} stock price movement for next week. Provide a summary analysis to support your prediction.")
  2. 结果

2. 金融分析师代理报告撰写(股票研究报告)

以公司的10-k表、财务数据和市场数据作为输入并输出股权研究报告

  1. 导入

import osimport autogenfrom textwrap import dedentfrom finrobot.utils import register_keys_from_jsonfrom finrobot.agents.workflow import SingleAssistantShadow
  1. 配置

llm_config = {    "config_list": autogen.config_list_from_json(        "../OAI_CONFIG_LIST",        filter_dict={            "model": ["gpt-4-0125-preview"],        },    ),    "timeout": 120,    "temperature": 0.5,}register_keys_from_json("../config_api_keys")
# Intermediate strategy modules will be saved in this directorywork_dir = "../report"os.makedirs(work_dir, exist_ok=True)
assistant = SingleAssistantShadow( "Expert_Investor", llm_config,






请到「今天看啥」查看全文