Spaces:
Sleeping
Sleeping
Update nb_tool.py
Browse files- nb_tool.py +3 -9
nb_tool.py
CHANGED
@@ -5,18 +5,13 @@ from typing import Optional
|
|
5 |
import re
|
6 |
import sys
|
7 |
from constants import TAVILY_KEY
|
8 |
-
|
9 |
-
|
10 |
-
TAVILY_API_KEY = "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"
|
11 |
import os
|
12 |
-
import requests
|
13 |
-
import re
|
14 |
-
from bs4 import BeautifulSoup
|
15 |
from tavily import TavilyClient
|
16 |
|
17 |
# Initialize Tavily client (set your API key as an environment variable)
|
18 |
-
tavily = TavilyClient(
|
19 |
|
|
|
20 |
def get_npb_player_info(player_name: str) -> str:
|
21 |
"""
|
22 |
Finds a Nippon Professional Baseball (NPB) player's jersey number and team name using Tavily search.
|
@@ -61,8 +56,7 @@ def get_npb_player_info(player_name: str) -> str:
|
|
61 |
#if __name__ == "__main__":
|
62 |
# print(get_npb_player_info("Taisho Tamai"))
|
63 |
|
64 |
-
|
65 |
-
|
66 |
def get_team_players_by_season(team_name: str, year: int) -> list[str]:
|
67 |
"""
|
68 |
Given a team name and year, returns the list of player names for that NPB season.
|
|
|
5 |
import re
|
6 |
import sys
|
7 |
from constants import TAVILY_KEY
|
|
|
|
|
|
|
8 |
import os
|
|
|
|
|
|
|
9 |
from tavily import TavilyClient
|
10 |
|
11 |
# Initialize Tavily client (set your API key as an environment variable)
|
12 |
+
tavily = TavilyClient(TAVILY_KEY)
|
13 |
|
14 |
+
@tool
|
15 |
def get_npb_player_info(player_name: str) -> str:
|
16 |
"""
|
17 |
Finds a Nippon Professional Baseball (NPB) player's jersey number and team name using Tavily search.
|
|
|
56 |
#if __name__ == "__main__":
|
57 |
# print(get_npb_player_info("Taisho Tamai"))
|
58 |
|
59 |
+
@tool
|
|
|
60 |
def get_team_players_by_season(team_name: str, year: int) -> list[str]:
|
61 |
"""
|
62 |
Given a team name and year, returns the list of player names for that NPB season.
|