feat: Add YFinanceTool component for interacting with Yahoo Finance News (#2759)

* feat: add yfinance dependency to pyproject.toml

* feat: Add YFinanceTool component for interacting with Yahoo Finance News

* refactor: update YfinanceToolComponent to use type casting for Tool return value
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-07-17 13:18:00 -03:00 • committed by GitHub
commit 50a64b0e0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 150 additions and 6 deletions

View file

@ -0,0 +1,20 @@
from typing import cast
from langchain_community.tools.yahoo_finance_news import YahooFinanceNewsTool
from langflow.custom import Component
from langflow.field_typing import Tool
from langflow.io import Output
class YfinanceToolComponent(Component):
display_name = "Yahoo Finance News Tool"
description = "Tool for interacting with Yahoo Finance News."
name = "YFinanceTool"
outputs = [
Output(display_name="Tool", name="tool", method="build_tool"),
]
def build_tool(self) -> Tool:
return cast(Tool, YahooFinanceNewsTool())