Spaces:
Sleeping
Sleeping
Update npb_agent.py
Browse files- npb_agent.py +4 -14
npb_agent.py
CHANGED
@@ -8,23 +8,12 @@ from langchain_core.messages import SystemMessage
|
|
8 |
|
9 |
# --- Custom Tools ---
|
10 |
from internet_search_tool import internet_search
|
|
|
|
|
11 |
|
12 |
PROMPT = """
|
13 |
-
|
14 |
You are an agent specialized in answering questions related to Nippon Professional Baseball players. Report your thoughts, and
|
15 |
finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].
|
16 |
-
|
17 |
-
When you search the internet, consider the results of this site as the main reference: https://npb.jp.
|
18 |
-
|
19 |
-
The first thing you have to do is to find out the player number and team. To that end, search the web using the player name and
|
20 |
-
"ippon Professional Baseball". One of the results will have the prefix https://npb.jp/bis/eng/players. Go to that page and extract
|
21 |
-
the player number and player team. They are contained in the html markups with id "pc_v_no" (the number) and "pc_v_team" (the team) of
|
22 |
-
the returned page.
|
23 |
-
|
24 |
-
Then you can search the web by using the team name and the year of the season you're interested. You will get a page like
|
25 |
-
this one: https://npb.jp/bis/eng/{year}. Go to that page and extract the names of the players. Then search each player for their numbers.
|
26 |
-
|
27 |
-
|
28 |
"""
|
29 |
|
30 |
class NpbAgent:
|
@@ -36,7 +25,8 @@ class NpbAgent:
|
|
36 |
timeout=20)
|
37 |
|
38 |
tools = [
|
39 |
-
|
|
|
40 |
]
|
41 |
|
42 |
prompt = ChatPromptTemplate.from_messages([
|
|
|
8 |
|
9 |
# --- Custom Tools ---
|
10 |
from internet_search_tool import internet_search
|
11 |
+
from nb_tool import get_team_players_by_season
|
12 |
+
from nb_tool import get_npb_player_info
|
13 |
|
14 |
PROMPT = """
|
|
|
15 |
You are an agent specialized in answering questions related to Nippon Professional Baseball players. Report your thoughts, and
|
16 |
finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
"""
|
18 |
|
19 |
class NpbAgent:
|
|
|
25 |
timeout=20)
|
26 |
|
27 |
tools = [
|
28 |
+
get_npb_player_info,
|
29 |
+
get_team_players_by_season
|
30 |
]
|
31 |
|
32 |
prompt = ChatPromptTemplate.from_messages([
|