Spaces:
Runtime error
Runtime error
more again
Browse files
app.py
CHANGED
@@ -183,7 +183,7 @@ info_emails_players = VectorStoreInfo(
|
|
183 |
name="from_to",
|
184 |
type="str",
|
185 |
description="""
|
186 |
-
email sent by a player of
|
187 |
"""
|
188 |
),
|
189 |
]
|
@@ -191,25 +191,27 @@ email sent by a player of [Stephen Curry, Andrew Wiggins, 'Draymond Green', 'Kla
|
|
191 |
|
192 |
strategy1 = Document(
|
193 |
text="Against the Phoenix Suns, we'll focus on ball movement and three-point shooting. Our starting five will consist of Stephen Curry, Klay Thompson, Andrew Wiggins, Draymond Green, and James Wiseman. We'll exploit their defense with our perimeter shooting while Draymond Green handles the playmaking and defense in the paint.",
|
194 |
-
metadata={'game_strategy': 'against Phoenix Suns'}
|
195 |
)
|
196 |
strategy2 = Document(
|
197 |
text="Facing the Lakers, we'll emphasize defensive intensity and fast-break opportunities. Our starting lineup will feature Stephen Curry, Klay Thompson, Andrew Wiggins, Draymond Green, and Kevon Looney. We need to limit LeBron's impact and push the pace on offense to tire their older roster.",
|
198 |
-
metadata={'game_strategy': 'against Lakers'}
|
199 |
)
|
200 |
strategy3 = Document(
|
201 |
text="Against the Denver Nuggets, our strategy is to control the boards and exploit their interior defense. Starting with Stephen Curry, Klay Thompson, Andrew Wiggins, Draymond Green, and James Wiseman, we aim to dominate the paint on both ends. We'll also look for opportunities to run in transition.",
|
202 |
-
metadata={'game_strategy': 'against Denver Nuggets'}
|
203 |
)
|
204 |
strategy4 = Document(
|
205 |
text="Facing the Milwaukee Bucks, we'll prioritize perimeter defense and transition play. Our starting five will consist of Stephen Curry, Klay Thompson, Andrew Wiggins, Draymond Green, and Kevon Looney. We must limit Giannis' drives to the basket and exploit their defense with quick ball movement.",
|
206 |
-
metadata={'game_strategy': 'against Milwaukee Bucks'}
|
207 |
)
|
208 |
strategy5 = Document(
|
209 |
text="In the matchup against the Brooklyn Nets, we'll focus on high-scoring games and exploiting defensive weaknesses. Our starting lineup will include Stephen Curry, Klay Thompson, Andrew Wiggins, Draymond Green, and Kevon Looney. We'll aim to outshoot and outpace them in a high-octane offensive battle.",
|
210 |
metadata={'game_strategy': 'against Brooklyn Nets'}
|
211 |
)
|
212 |
-
|
|
|
|
|
213 |
vector_store_strategy = ChromaVectorStore(chroma_collection=chroma_collection)
|
214 |
storage_context_strategy = StorageContext.from_defaults(vector_store=vector_store_strategy)
|
215 |
vector_index_strategy = VectorStoreIndex([], storage_context=storage_context_strategy, service_context=service_context)
|
@@ -219,13 +221,13 @@ vector_index_strategy.insert_nodes([strategy1, strategy2, strategy3, strategy4,
|
|
219 |
# setting up metadata
|
220 |
top_k = 1
|
221 |
info_strategy = VectorStoreInfo(
|
222 |
-
content_info="Game strategy against other NBA teams.",
|
223 |
metadata_info=[
|
224 |
MetadataInfo(
|
225 |
name="game_strategy",
|
226 |
type="str",
|
227 |
description="""
|
228 |
-
Game strategy for
|
229 |
"""
|
230 |
),
|
231 |
]
|
@@ -242,7 +244,7 @@ def main():
|
|
242 |
sql_nba_tool = QueryEngineTool.from_defaults(
|
243 |
query_engine=sql_query_engine, #
|
244 |
name='sql_nba_tool',
|
245 |
-
description=("""Do not use this tool for queries realated to
|
246 |
Use this tool for translating a natural language query into a SQL query over tables containing:
|
247 |
1. teams, containing historical information about NBA teams
|
248 |
2. players, containing information about the team that each player plays for
|
@@ -253,7 +255,7 @@ def main():
|
|
253 |
)
|
254 |
|
255 |
description_emails = f"""\
|
256 |
-
Use this tool to look up emails betweed NBA players
|
257 |
The vector database schema is given below:
|
258 |
{info_emails_players.json()}
|
259 |
"""
|
@@ -265,7 +267,7 @@ def main():
|
|
265 |
)
|
266 |
|
267 |
description_strategy = f"""\
|
268 |
-
Use this tool to look up information about the game strategy
|
269 |
The vector database schema is given below:
|
270 |
{info_strategy.json()}
|
271 |
"""
|
|
|
183 |
name="from_to",
|
184 |
type="str",
|
185 |
description="""
|
186 |
+
email sent by a Golden States Warriors player, one of [Stephen Curry, Andrew Wiggins, 'Draymond Green', 'Klay Thompson'], to any other NBA player
|
187 |
"""
|
188 |
),
|
189 |
]
|
|
|
191 |
|
192 |
strategy1 = Document(
|
193 |
text="Against the Phoenix Suns, we'll focus on ball movement and three-point shooting. Our starting five will consist of Stephen Curry, Klay Thompson, Andrew Wiggins, Draymond Green, and James Wiseman. We'll exploit their defense with our perimeter shooting while Draymond Green handles the playmaking and defense in the paint.",
|
194 |
+
metadata={'game_strategy': 'Golden States Warriors against Phoenix Suns'}
|
195 |
)
|
196 |
strategy2 = Document(
|
197 |
text="Facing the Lakers, we'll emphasize defensive intensity and fast-break opportunities. Our starting lineup will feature Stephen Curry, Klay Thompson, Andrew Wiggins, Draymond Green, and Kevon Looney. We need to limit LeBron's impact and push the pace on offense to tire their older roster.",
|
198 |
+
metadata={'game_strategy': 'Golden States Warriors against Lakers'}
|
199 |
)
|
200 |
strategy3 = Document(
|
201 |
text="Against the Denver Nuggets, our strategy is to control the boards and exploit their interior defense. Starting with Stephen Curry, Klay Thompson, Andrew Wiggins, Draymond Green, and James Wiseman, we aim to dominate the paint on both ends. We'll also look for opportunities to run in transition.",
|
202 |
+
metadata={'game_strategy': 'Golden States Warriors against Denver Nuggets'}
|
203 |
)
|
204 |
strategy4 = Document(
|
205 |
text="Facing the Milwaukee Bucks, we'll prioritize perimeter defense and transition play. Our starting five will consist of Stephen Curry, Klay Thompson, Andrew Wiggins, Draymond Green, and Kevon Looney. We must limit Giannis' drives to the basket and exploit their defense with quick ball movement.",
|
206 |
+
metadata={'game_strategy': 'Golden States Warriors against Milwaukee Bucks'}
|
207 |
)
|
208 |
strategy5 = Document(
|
209 |
text="In the matchup against the Brooklyn Nets, we'll focus on high-scoring games and exploiting defensive weaknesses. Our starting lineup will include Stephen Curry, Klay Thompson, Andrew Wiggins, Draymond Green, and Kevon Looney. We'll aim to outshoot and outpace them in a high-octane offensive battle.",
|
210 |
metadata={'game_strategy': 'against Brooklyn Nets'}
|
211 |
)
|
212 |
+
|
213 |
+
chroma_client_strategy = chromadb.Client()
|
214 |
+
chroma_collection = chroma_client_strategy.create_collection("coach_data")
|
215 |
vector_store_strategy = ChromaVectorStore(chroma_collection=chroma_collection)
|
216 |
storage_context_strategy = StorageContext.from_defaults(vector_store=vector_store_strategy)
|
217 |
vector_index_strategy = VectorStoreIndex([], storage_context=storage_context_strategy, service_context=service_context)
|
|
|
221 |
# setting up metadata
|
222 |
top_k = 1
|
223 |
info_strategy = VectorStoreInfo(
|
224 |
+
content_info="Game strategy by Steve Kerr for the Golden States Warriors against other NBA teams.",
|
225 |
metadata_info=[
|
226 |
MetadataInfo(
|
227 |
name="game_strategy",
|
228 |
type="str",
|
229 |
description="""
|
230 |
+
Game strategy for Golden State Warriors against other NBA teams, one of [Phoenix Suns, Lakers, Nuggets, Milwaukee Buck, Brooklyn Nets].
|
231 |
"""
|
232 |
),
|
233 |
]
|
|
|
244 |
sql_nba_tool = QueryEngineTool.from_defaults(
|
245 |
query_engine=sql_query_engine, #
|
246 |
name='sql_nba_tool',
|
247 |
+
description=("""Do not use this tool for queries realated to emails or game strategy.
|
248 |
Use this tool for translating a natural language query into a SQL query over tables containing:
|
249 |
1. teams, containing historical information about NBA teams
|
250 |
2. players, containing information about the team that each player plays for
|
|
|
255 |
)
|
256 |
|
257 |
description_emails = f"""\
|
258 |
+
Use this tool to look up emails betweed NBA players.
|
259 |
The vector database schema is given below:
|
260 |
{info_emails_players.json()}
|
261 |
"""
|
|
|
267 |
)
|
268 |
|
269 |
description_strategy = f"""\
|
270 |
+
Use this tool to look up information about the game strategy.
|
271 |
The vector database schema is given below:
|
272 |
{info_strategy.json()}
|
273 |
"""
|