AGAZO_Final_Assignment / npb_tool.py
Alexandre Gazola
fix
718426b
raw
history blame
1.37 kB
from tavily import TavilyClient
from utils import clean_text
from langchain_core.tools import tool
import os
from constants import TAVILY_KEY
from langchain.tools import tool
from npb_agent import NpbAgent
from typing import Optional
# Assuming your NpbAgent class is defined as shown
npb_agent = NpbAgent()
@tool
def npb_players(question: str) -> str:
"""
Use this tool to answer questions about Nippon Professional Baseball (NPB) players,
such as their team, jersey number, stats, or other biographical info.
"""
return npb_agent(question)
@tool
def list_npb_players(player: str, season: str) -> str:
"""
Retrieves a list of Nippon Professional Baseball (NPB) players for a specific team and season.
Each entry includes:
- Full name
- Jersey number
- Position/role (e.g., pitcher, catcher)
- Team name
Parameters:
- team (str): The name of the NPB team to query (e.g., "Hanshin Tigers").
- season (str): The target season/year (e.g., "2024").
Returns:
- str: A formatted list of player information, or an error message if no data is found.
"""
prompt = f"""
I need a list containing the players for the same team of play {player} and season {season} in the NPB. Each entry must contain full name, jersey number, role and team name.
"""
return npb_agent(prompt)