Refactor and update structure #20
@@ -14,7 +14,7 @@ try:
|
|||||||
instructions="Use tables to display data.",
|
instructions="Use tables to display data.",
|
||||||
markdown=True,
|
markdown=True,
|
||||||
)
|
)
|
||||||
result = reasoning_agent.run("Scrivi una poesia su un gatto. Sii breve.")
|
result = reasoning_agent.run("Scrivi una poesia su un gatto. Sii breve.") # type: ignore
|
||||||
print(result.content)
|
print(result.content)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Si è verificato un errore: {e}")
|
print(f"Si è verificato un errore: {e}")
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from app.markets import (
|
|||||||
CryptoCompareWrapper,
|
CryptoCompareWrapper,
|
||||||
BinanceWrapper,
|
BinanceWrapper,
|
||||||
YFinanceWrapper,
|
YFinanceWrapper,
|
||||||
BaseWrapper
|
MarketWrapper
|
||||||
)
|
)
|
||||||
|
|
||||||
# Carica variabili d'ambiente
|
# Carica variabili d'ambiente
|
||||||
@@ -133,9 +133,9 @@ class ProviderTester:
|
|||||||
self.formatter = DemoFormatter()
|
self.formatter = DemoFormatter()
|
||||||
self.test_symbols = ["BTC", "ETH", "ADA"]
|
self.test_symbols = ["BTC", "ETH", "ADA"]
|
||||||
|
|
||||||
def test_provider(self, wrapper: BaseWrapper, provider_name: str) -> Dict[str, Any]:
|
def test_provider(self, wrapper: MarketWrapper, provider_name: str) -> Dict[str, Any]:
|
||||||
"""Testa un provider specifico con tutti i metodi disponibili."""
|
"""Testa un provider specifico con tutti i metodi disponibili."""
|
||||||
results = {
|
results: Dict[str, Any] = {
|
||||||
"provider_name": provider_name,
|
"provider_name": provider_name,
|
||||||
"tests": {},
|
"tests": {},
|
||||||
"overall_status": "SUCCESS"
|
"overall_status": "SUCCESS"
|
||||||
@@ -153,7 +153,7 @@ class ProviderTester:
|
|||||||
)
|
)
|
||||||
if product:
|
if product:
|
||||||
print(f"📦 Product: {product.symbol} (ID: {product.id})")
|
print(f"📦 Product: {product.symbol} (ID: {product.id})")
|
||||||
print(f" Price: ${product.price:.2f}, Quote: {product.quote_currency}")
|
print(f" Price: ${product.price:.2f}, Quote: {product.currency}")
|
||||||
print(f" Volume 24h: {product.volume_24h:,.2f}")
|
print(f" Volume 24h: {product.volume_24h:,.2f}")
|
||||||
else:
|
else:
|
||||||
print(f"📦 Product: Nessun prodotto trovato per {symbol}")
|
print(f"📦 Product: Nessun prodotto trovato per {symbol}")
|
||||||
@@ -217,9 +217,9 @@ def check_environment_variables() -> Dict[str, bool]:
|
|||||||
}
|
}
|
||||||
return env_vars
|
return env_vars
|
||||||
|
|
||||||
def initialize_providers() -> Dict[str, BaseWrapper]:
|
def initialize_providers() -> Dict[str, MarketWrapper]:
|
||||||
"""Inizializza tutti i provider disponibili."""
|
"""Inizializza tutti i provider disponibili."""
|
||||||
providers = {}
|
providers: Dict[str, MarketWrapper] = {}
|
||||||
env_vars = check_environment_variables()
|
env_vars = check_environment_variables()
|
||||||
|
|
||||||
# CryptoCompareWrapper
|
# CryptoCompareWrapper
|
||||||
@@ -316,7 +316,7 @@ def main():
|
|||||||
formatter.print_header("🧪 ESECUZIONE TEST PROVIDER", "=", 80)
|
formatter.print_header("🧪 ESECUZIONE TEST PROVIDER", "=", 80)
|
||||||
|
|
||||||
tester = ProviderTester()
|
tester = ProviderTester()
|
||||||
all_results = []
|
all_results: List[Dict[str, Any]] = []
|
||||||
|
|
||||||
for provider_name, wrapper in providers.items():
|
for provider_name, wrapper in providers.items():
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ from app.news import NewsApiWrapper
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
api = NewsApiWrapper()
|
api = NewsApiWrapper()
|
||||||
|
articles = api.get_latest_news(query="bitcoin", limit=5)
|
||||||
|
assert len(articles) > 0
|
||||||
print("ok")
|
print("ok")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
import requests
|
import ollama
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from agno.agent import Agent
|
from agno.agent import Agent
|
||||||
from agno.models.base import Model
|
from agno.models.base import Model
|
||||||
@@ -30,19 +30,15 @@ class AppModels(Enum):
|
|||||||
Controlla quali provider di modelli LLM locali sono disponibili.
|
Controlla quali provider di modelli LLM locali sono disponibili.
|
||||||
Ritorna una lista di provider disponibili.
|
Ritorna una lista di provider disponibili.
|
||||||
"""
|
"""
|
||||||
ollama_host = os.getenv("OLLAMA_HOST", "http://localhost:11434")
|
try:
|
||||||
result = requests.get(f"{ollama_host}/api/tags")
|
models_list = ollama.list()
|
||||||
if result.status_code != 200:
|
availables = [model['model'] for model in models_list['models']]
|
||||||
log_warning(f"Ollama is not running or not reachable {result}")
|
app_models = [model for model in AppModels if model.name.startswith("OLLAMA")]
|
||||||
|
return [model for model in app_models if model.value in availables]
|
||||||
|
except Exception as e:
|
||||||
|
log_warning(f"Ollama is not running or not reachable: {e}")
|
||||||
return []
|
return []
|
||||||
|
|
||||||
availables: list[AppModels] = []
|
|
||||||
result = result.text
|
|
||||||
for model in [model for model in AppModels if model.name.startswith("OLLAMA")]:
|
|
||||||
if model.value in result:
|
|
||||||
availables.append(model)
|
|
||||||
return availables
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def availables_online() -> list['AppModels']:
|
def availables_online() -> list['AppModels']:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ def create_team_with(models: AppModels, coordinator: AppModels | None = None) ->
|
|||||||
members=[market_agent, news_agent, social_agent],
|
members=[market_agent, news_agent, social_agent],
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: migliorare le istruzioni del team
|
|
||||||
COORDINATOR_INSTRUCTIONS = """
|
COORDINATOR_INSTRUCTIONS = """
|
||||||
You are the expert coordinator of a financial analysis team specializing in cryptocurrencies.
|
You are the expert coordinator of a financial analysis team specializing in cryptocurrencies.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user