Spaces:
Runtime error
Runtime error
Hugo Bui
commited on
fix
Browse files
tools/country_info_tool.py
CHANGED
@@ -153,7 +153,7 @@ class CountryInfoTool(Tool):
|
|
153 |
except Exception as e:
|
154 |
return f"❌ Error retrieving information: {str(e)}"
|
155 |
|
156 |
-
def _normalize_country_name(self, country: str)
|
157 |
"""Normalise le nom du pays"""
|
158 |
country_lower = country.lower().strip()
|
159 |
|
@@ -178,7 +178,7 @@ class CountryInfoTool(Tool):
|
|
178 |
|
179 |
return None
|
180 |
|
181 |
-
def _validate_country_via_api(self, country: str)
|
182 |
"""Valide et normalise le nom du pays via l'API REST Countries"""
|
183 |
try:
|
184 |
# Essayer d'abord avec le nom exact
|
@@ -207,7 +207,7 @@ class CountryInfoTool(Tool):
|
|
207 |
# En cas d'erreur, retourner le nom avec la première lettre en majuscule
|
208 |
return country.title() if len(country) > 2 else None
|
209 |
|
210 |
-
def _get_country_code_from_api(self, country: str)
|
211 |
"""Récupère le code ISO du pays via l'API REST Countries"""
|
212 |
try:
|
213 |
url = f"https://restcountries.com/v3.1/name/{country}"
|
@@ -421,7 +421,7 @@ class CountryInfoTool(Tool):
|
|
421 |
except Exception:
|
422 |
return ("⚪", "Analysis impossible", "❓ Consult official sources")
|
423 |
|
424 |
-
def _llm_security_analysis(self, country: str, news_content: str, risk_level: str = "UNKNOWN")
|
425 |
"""Utilise Claude pour analyser la sécurité du pays"""
|
426 |
try:
|
427 |
if not self.claude_client:
|
|
|
153 |
except Exception as e:
|
154 |
return f"❌ Error retrieving information: {str(e)}"
|
155 |
|
156 |
+
def _normalize_country_name(self, country: str):
|
157 |
"""Normalise le nom du pays"""
|
158 |
country_lower = country.lower().strip()
|
159 |
|
|
|
178 |
|
179 |
return None
|
180 |
|
181 |
+
def _validate_country_via_api(self, country: str):
|
182 |
"""Valide et normalise le nom du pays via l'API REST Countries"""
|
183 |
try:
|
184 |
# Essayer d'abord avec le nom exact
|
|
|
207 |
# En cas d'erreur, retourner le nom avec la première lettre en majuscule
|
208 |
return country.title() if len(country) > 2 else None
|
209 |
|
210 |
+
def _get_country_code_from_api(self, country: str):
|
211 |
"""Récupère le code ISO du pays via l'API REST Countries"""
|
212 |
try:
|
213 |
url = f"https://restcountries.com/v3.1/name/{country}"
|
|
|
421 |
except Exception:
|
422 |
return ("⚪", "Analysis impossible", "❓ Consult official sources")
|
423 |
|
424 |
+
def _llm_security_analysis(self, country: str, news_content: str, risk_level: str = "UNKNOWN"):
|
425 |
"""Utilise Claude pour analyser la sécurité du pays"""
|
426 |
try:
|
427 |
if not self.claude_client:
|