Alexandre Gazola commited on
Commit
718426b
·
1 Parent(s): 81534f2
Files changed (2) hide show
  1. langchain_agent.py +2 -2
  2. npb_tool.py +26 -0
langchain_agent.py CHANGED
@@ -18,7 +18,7 @@ from convert_chessboard_image_to_fen_tool import convert_chessboard_image_to_fen
18
  from chess_image_to_fen_tool import chess_image_to_fen
19
  from audio_to_text_tool import audio_to_text,audio_to_text_from_youtube
20
  from alphabetizer_tool import alphabetizer
21
- from npb_tool import npb_players
22
 
23
  class LangChainAgent:
24
  def __init__(self):
@@ -40,7 +40,7 @@ class LangChainAgent:
40
  audio_to_text,
41
  audio_to_text_from_youtube,
42
  alphabetizer,
43
- npb_players
44
  ]
45
 
46
  prompt = ChatPromptTemplate.from_messages([
 
18
  from chess_image_to_fen_tool import chess_image_to_fen
19
  from audio_to_text_tool import audio_to_text,audio_to_text_from_youtube
20
  from alphabetizer_tool import alphabetizer
21
+ from npb_tool import npb_players,list_npb_players
22
 
23
  class LangChainAgent:
24
  def __init__(self):
 
40
  audio_to_text,
41
  audio_to_text_from_youtube,
42
  alphabetizer,
43
+ list_npb_players
44
  ]
45
 
46
  prompt = ChatPromptTemplate.from_messages([
npb_tool.py CHANGED
@@ -5,6 +5,7 @@ import os
5
  from constants import TAVILY_KEY
6
  from langchain.tools import tool
7
  from npb_agent import NpbAgent
 
8
 
9
  # Assuming your NpbAgent class is defined as shown
10
  npb_agent = NpbAgent()
@@ -16,3 +17,28 @@ def npb_players(question: str) -> str:
16
  such as their team, jersey number, stats, or other biographical info.
17
  """
18
  return npb_agent(question)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  from constants import TAVILY_KEY
6
  from langchain.tools import tool
7
  from npb_agent import NpbAgent
8
+ from typing import Optional
9
 
10
  # Assuming your NpbAgent class is defined as shown
11
  npb_agent = NpbAgent()
 
17
  such as their team, jersey number, stats, or other biographical info.
18
  """
19
  return npb_agent(question)
20
+
21
+
22
+ @tool
23
+ def list_npb_players(player: str, season: str) -> str:
24
+ """
25
+ Retrieves a list of Nippon Professional Baseball (NPB) players for a specific team and season.
26
+ Each entry includes:
27
+ - Full name
28
+ - Jersey number
29
+ - Position/role (e.g., pitcher, catcher)
30
+ - Team name
31
+
32
+ Parameters:
33
+ - team (str): The name of the NPB team to query (e.g., "Hanshin Tigers").
34
+ - season (str): The target season/year (e.g., "2024").
35
+
36
+ Returns:
37
+ - str: A formatted list of player information, or an error message if no data is found.
38
+ """
39
+
40
+ prompt = f"""
41
+ 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.
42
+ """
43
+
44
+ return npb_agent(prompt)