Spaces:
Running
Running
fredcaixeta commited on
Commit ·
79a4707
1
Parent(s): 2812187
- main_agent.py +4 -4
main_agent.py
CHANGED
|
@@ -91,7 +91,7 @@ one_player_agent = Agent(
|
|
| 91 |
)
|
| 92 |
|
| 93 |
# ========================= TOOLS DIRETAS no one_player_agent =========================
|
| 94 |
-
@one_player_agent.
|
| 95 |
async def execute_sql_query(query: str, limit: int = 100) -> str:
|
| 96 |
"""Executa query SQL READ-ONLY."""
|
| 97 |
query_upper = query.upper().strip()
|
|
@@ -114,7 +114,7 @@ async def execute_sql_query(query: str, limit: int = 100) -> str:
|
|
| 114 |
except Exception as e:
|
| 115 |
return f"❌ Erro: {str(e)}"
|
| 116 |
|
| 117 |
-
@one_player_agent.
|
| 118 |
async def get_player_match_history(player_name: str, limit: int = 10) -> str:
|
| 119 |
query = """
|
| 120 |
SELECT match_date, opponent, home_away, minutes_played, goals, assists, shots, xg, pass_completion_pct, player_nickname
|
|
@@ -132,7 +132,7 @@ async def get_player_match_history(player_name: str, limit: int = 10) -> str:
|
|
| 132 |
except Exception as e:
|
| 133 |
return f"❌ Erro: {str(e)}"
|
| 134 |
|
| 135 |
-
@one_player_agent.
|
| 136 |
async def get_match_performances(match_date: Optional[str] = None, opponent: Optional[str] = None, limit: int = 15) -> str:
|
| 137 |
if not match_date and not opponent: return "❌ Forneça match_date OU opponent"
|
| 138 |
where_clauses, params = [], []
|
|
@@ -159,7 +159,7 @@ async def get_match_performances(match_date: Optional[str] = None, opponent: Opt
|
|
| 159 |
except Exception as e:
|
| 160 |
return f"❌ Erro: {str(e)}"
|
| 161 |
|
| 162 |
-
@one_player_agent.
|
| 163 |
async def get_top_performances(metric: str = "goals", limit: int = 10) -> str:
|
| 164 |
valid = {"goals": ("goals", "Gols"), "assists": ("assists", "Assistências"), "contributions": ("goals + assists", "Contribuições"), "xg": ("xg", "xG"), "shots": ("shots", "Finalizações")}
|
| 165 |
if metric not in valid: return f"❌ Métricas: {', '.join(valid)}"
|
|
|
|
| 91 |
)
|
| 92 |
|
| 93 |
# ========================= TOOLS DIRETAS no one_player_agent =========================
|
| 94 |
+
@one_player_agent.tool_plain()
|
| 95 |
async def execute_sql_query(query: str, limit: int = 100) -> str:
|
| 96 |
"""Executa query SQL READ-ONLY."""
|
| 97 |
query_upper = query.upper().strip()
|
|
|
|
| 114 |
except Exception as e:
|
| 115 |
return f"❌ Erro: {str(e)}"
|
| 116 |
|
| 117 |
+
@one_player_agent.tool_plain()
|
| 118 |
async def get_player_match_history(player_name: str, limit: int = 10) -> str:
|
| 119 |
query = """
|
| 120 |
SELECT match_date, opponent, home_away, minutes_played, goals, assists, shots, xg, pass_completion_pct, player_nickname
|
|
|
|
| 132 |
except Exception as e:
|
| 133 |
return f"❌ Erro: {str(e)}"
|
| 134 |
|
| 135 |
+
@one_player_agent.tool_plain()
|
| 136 |
async def get_match_performances(match_date: Optional[str] = None, opponent: Optional[str] = None, limit: int = 15) -> str:
|
| 137 |
if not match_date and not opponent: return "❌ Forneça match_date OU opponent"
|
| 138 |
where_clauses, params = [], []
|
|
|
|
| 159 |
except Exception as e:
|
| 160 |
return f"❌ Erro: {str(e)}"
|
| 161 |
|
| 162 |
+
@one_player_agent.tool_plain()()
|
| 163 |
async def get_top_performances(metric: str = "goals", limit: int = 10) -> str:
|
| 164 |
valid = {"goals": ("goals", "Gols"), "assists": ("assists", "Assistências"), "contributions": ("goals + assists", "Contribuições"), "xg": ("xg", "xG"), "shots": ("shots", "Finalizações")}
|
| 165 |
if metric not in valid: return f"❌ Métricas: {', '.join(valid)}"
|