Refactor Predictor and market data handling

- Added Predictor class with input preparation and instructions for financial strategy generation.
- Removed PredictorAgent class and integrated its functionality into the new Predictor module.
- Created a base market API wrapper and specific implementations for Coinbase and CryptoCompare.
- Introduced PublicBinanceAgent for fetching public prices from Binance.
- Refactored ToolAgent to utilize the new Predictor and market API wrappers for improved data handling and predictions.
- Updated models to streamline the selection of available LLM providers.
- Removed deprecated signer classes for Coinbase and CryptoCompare.
This commit is contained in:
2025-09-26 03:43:31 +02:00
parent 48502fc6c7
commit 148bff7cfd
18 changed files with 362 additions and 2324 deletions

View File

@@ -3,6 +3,7 @@ import gradio as gr
from dotenv import load_dotenv
from app.tool import ToolAgent
from app.models import Models
from app.agents.predictor import PredictorStyle
########################################
# MAIN APP & GRADIO INTERFACE
@@ -16,21 +17,29 @@ if __name__ == "__main__":
load_dotenv()
######################################
list_models = Models.available()
tool_agent = ToolAgent()
models = Models.availables()
styles = list(PredictorStyle)
models_names = [model.name for model in models]
styles_names = [style.value for style in styles]
print("✅ Modelli disponibili:", models_names)
print("✅ Stili disponibili:", styles_names)
tool_agent = ToolAgent(models, styles)
with gr.Blocks() as demo:
gr.Markdown("# 🤖 Agente di Analisi e Consulenza Crypto")
with gr.Row():
provider = gr.Dropdown(
choices=list_models,
value=list_models[0],
choices=models_names,
type="index",
label="Modello da usare"
)
provider.change(fn=tool_agent.choose_provider, inputs=provider, outputs=None)
style = gr.Dropdown(
choices=["conservative", "aggressive"],
value="conservative",
choices=styles_names,
type="index",
label="Stile di investimento"
)
@@ -38,7 +47,5 @@ if __name__ == "__main__":
output = gr.Textbox(label="Risultato analisi", lines=12)
analyze_btn = gr.Button("🔎 Analizza")
analyze_btn.click(fn=tool_agent.interact, inputs=[user_input, provider, style], outputs=output)
if __name__ == "__main__":
demo.launch()
analyze_btn.click(fn=tool_agent.interact, inputs=[user_input, style], outputs=output)
demo.launch()