Refactor pytest configuration:
- streamline marker addition - remove unused OLLAMA_MODELS_PATH (OLLAMA_HOST should be enough even for Docker)
This commit is contained in:
@@ -5,12 +5,6 @@
|
|||||||
# Alcune API sono a pagamento, altre hanno un piano gratuito con limiti di utilizzo
|
# Alcune API sono a pagamento, altre hanno un piano gratuito con limiti di utilizzo
|
||||||
# Vedi https://docs.agno.com/examples/models per vedere tutti i modelli supportati
|
# Vedi https://docs.agno.com/examples/models per vedere tutti i modelli supportati
|
||||||
GOOGLE_API_KEY=
|
GOOGLE_API_KEY=
|
||||||
# Dipende dal sistema operativo
|
|
||||||
# windows: C:\Users\<user>\.ollama
|
|
||||||
# mac: /Users/<user>/.ollama
|
|
||||||
# linux: /home/<user>/.ollama
|
|
||||||
# wsl: /usr/share/ollama/.ollama
|
|
||||||
OLLAMA_MODELS_PATH=
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Configurazioni per gli agenti di mercato
|
# Configurazioni per gli agenti di mercato
|
||||||
|
|||||||
27
README.md
27
README.md
@@ -90,16 +90,19 @@ Il file `.env` verrà automaticamente caricato nel container grazie alla configu
|
|||||||
***L'applicazione è attualmente in fase di sviluppo.***
|
***L'applicazione è attualmente in fase di sviluppo.***
|
||||||
|
|
||||||
Usando la libreria ``gradio`` è stata creata un'interfaccia web semplice per interagire con l'agente principale. Gli agenti secondari si trovano nella cartella `src/app/agents` e sono:
|
Usando la libreria ``gradio`` è stata creata un'interfaccia web semplice per interagire con l'agente principale. Gli agenti secondari si trovano nella cartella `src/app/agents` e sono:
|
||||||
- **Market Agent**: ~~Agente unificato che supporta multiple fonti di dati (Coinbase + CryptoCompare) con auto-configurazione~~ (non proprio un agente per ora)
|
- **Market Agent**: Agente unificato che supporta multiple fonti di dati (Coinbase + CryptoCompare) con auto-configurazione
|
||||||
- **News Agent**: Recupera le notizie finanziarie più recenti utilizzando. ***MOCK***
|
- **News Agent**: Recupera le notizie finanziarie più recenti utilizzando.
|
||||||
- **Social Agent**: Analizza i sentimenti sui social media utilizzando. ***MOCK***
|
- **Social Agent**: Analizza i sentimenti sui social media utilizzando.
|
||||||
- **Predictor Agent**: Utilizza i dati raccolti dagli altri agenti per fare previsioni.
|
- **Predictor Agent**: Utilizza i dati raccolti dagli altri agenti per fare previsioni.
|
||||||
|
|
||||||
## Ultimo Aggiornamento
|
## Ultimo Aggiornamento
|
||||||
### Market Agent Features:
|
|
||||||
- **Auto-configurazione**: Configura automaticamente i provider disponibili basandosi sulle env vars
|
### Cose non funzionanti
|
||||||
- **Multiple provider**: Supporta sia Coinbase (trading) che CryptoCompare (market data)
|
- **Market Agent**: Non è un vero agente dato che non usa LLM per ragionare ma prende solo i dati
|
||||||
- **Interfaccia unificata**: Un'unica API per accedere a tutti i provider
|
- **market_aggregator.py**: Non è usato per ora
|
||||||
|
- **News Agent**: Non funziona lo scraping online, per ora usa dati mock
|
||||||
|
- **Social Agent**: Non funziona lo scraping online, per ora usa dati mock
|
||||||
|
- **Demos**: Le demos nella cartella [demos](demos) non sono aggiornate e non funzionano per ora
|
||||||
|
|
||||||
### ToDo
|
### ToDo
|
||||||
- [X] Per lo scraping online bisogna iscriversi e recuperare le chiavi API
|
- [X] Per lo scraping online bisogna iscriversi e recuperare le chiavi API
|
||||||
@@ -114,4 +117,12 @@ Usando la libreria ``gradio`` è stata creata un'interfaccia web semplice per in
|
|||||||
Per eseguire i test, assicurati di aver configurato correttamente le variabili d'ambiente nel file `.env` come descritto sopra. Poi esegui il comando:
|
Per eseguire i test, assicurati di aver configurato correttamente le variabili d'ambiente nel file `.env` come descritto sopra. Poi esegui il comando:
|
||||||
```sh
|
```sh
|
||||||
uv run pytest -v
|
uv run pytest -v
|
||||||
```
|
|
||||||
|
# Oppure per test specifici
|
||||||
|
uv run pytest -v tests/agents/test_market.py
|
||||||
|
uv run pytest -v tests/agents/test_predictor.py
|
||||||
|
|
||||||
|
# Oppure usando i markers
|
||||||
|
uv run pytest -v -m api
|
||||||
|
uv run pytest -v -m "api and not slow"
|
||||||
|
```
|
||||||
|
|||||||
@@ -15,46 +15,38 @@ from dotenv import load_dotenv
|
|||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config:pytest.Config):
|
||||||
"""Configurazione pytest"""
|
"""Configurazione pytest con marker personalizzati"""
|
||||||
# Aggiungi marker personalizzati
|
|
||||||
config.addinivalue_line(
|
|
||||||
"markers", "slow: marks tests as slow (deselect with '-m \"not slow\"')"
|
|
||||||
)
|
|
||||||
config.addinivalue_line(
|
|
||||||
"markers", "api: marks tests that require API access"
|
|
||||||
)
|
|
||||||
config.addinivalue_line(
|
|
||||||
"markers", "coinbase: marks tests that require Coinbase credentials"
|
|
||||||
)
|
|
||||||
config.addinivalue_line(
|
|
||||||
"markers", "cryptocompare: marks tests that require CryptoCompare credentials"
|
|
||||||
)
|
|
||||||
config.addinivalue_line(
|
|
||||||
"markers", "gemini: marks tests that use Gemini model"
|
|
||||||
)
|
|
||||||
config.addinivalue_line(
|
|
||||||
"markers", "ollama_gpt: marks tests that use Ollama GPT model"
|
|
||||||
)
|
|
||||||
config.addinivalue_line(
|
|
||||||
"markers", "ollama_qwen: marks tests that use Ollama Qwen model"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
markers = [
|
||||||
|
("slow", "marks tests as slow (deselect with '-m \"not slow\"')"),
|
||||||
|
("api", "marks tests that require API access"),
|
||||||
|
("coinbase", "marks tests that require Coinbase credentials"),
|
||||||
|
("cryptocompare", "marks tests that require CryptoCompare credentials"),
|
||||||
|
("gemini", "marks tests that use Gemini model"),
|
||||||
|
("ollama_gpt", "marks tests that use Ollama GPT model"),
|
||||||
|
("ollama_qwen", "marks tests that use Ollama Qwen model"),
|
||||||
|
]
|
||||||
|
for marker in markers:
|
||||||
|
line = f"{marker[0]}: {marker[1]}"
|
||||||
|
config.addinivalue_line("markers", line)
|
||||||
|
|
||||||
def pytest_collection_modifyitems(config, items):
|
def pytest_collection_modifyitems(config, items):
|
||||||
"""Modifica automaticamente gli item di test"""
|
"""Modifica automaticamente gli item di test aggiungendogli marker basati sul nome"""
|
||||||
# Aggiungi marker 'api' a tutti i test che richiedono API
|
|
||||||
|
markers_to_add = {
|
||||||
|
"api": pytest.mark.api,
|
||||||
|
"coinbase": pytest.mark.api,
|
||||||
|
"cryptocompare": pytest.mark.api,
|
||||||
|
"overview": pytest.mark.slow,
|
||||||
|
"analysis": pytest.mark.slow,
|
||||||
|
"gemini": pytest.mark.gemini,
|
||||||
|
"ollama_gpt": pytest.mark.ollama_gpt,
|
||||||
|
"ollama_qwen": pytest.mark.ollama_qwen,
|
||||||
|
}
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
if "api" in item.name.lower() or "coinbase" in item.name.lower() or "cryptocompare" in item.name.lower():
|
name = item.name.lower()
|
||||||
item.add_marker(pytest.mark.api)
|
for key, marker in markers_to_add.items():
|
||||||
|
if key in name:
|
||||||
# Aggiungi marker 'slow' ai test che potrebbero essere lenti
|
item.add_marker(marker)
|
||||||
if "overview" in item.name.lower() or "analysis" in item.name.lower():
|
|
||||||
item.add_marker(pytest.mark.slow)
|
|
||||||
|
|
||||||
if "gemini" in item.name.lower():
|
|
||||||
item.add_marker(pytest.mark.gemini)
|
|
||||||
if "ollama_gpt" in item.name.lower():
|
|
||||||
item.add_marker(pytest.mark.ollama_gpt)
|
|
||||||
if "ollama_qwen" in item.name.lower():
|
|
||||||
item.add_marker(pytest.mark.ollama_qwen)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user