Spaces:
Sleeping
Sleeping
File size: 1,374 Bytes
991089b 718426b 991089b 718426b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
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)
|