Fixed Docker
- Update Dockerfile, docker-compose - fixed app instructions not working - fixed json ouput sanification - added tests for predictor
This commit is contained in:
@@ -19,4 +19,5 @@ COPY LICENSE .
|
|||||||
COPY src ./src
|
COPY src ./src
|
||||||
|
|
||||||
# Comando di default all'avvio dell'applicazione
|
# Comando di default all'avvio dell'applicazione
|
||||||
CMD ["python", "src/app.py"]
|
CMD ["echo", "Benvenuto in UPO AppAI!"]
|
||||||
|
CMD ["uv", "run", "src/app.py"]
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -101,17 +101,13 @@ Usando la libreria ``gradio`` è stata creata un'interfaccia web semplice per in
|
|||||||
- **Multiple provider**: Supporta sia Coinbase (trading) che CryptoCompare (market data)
|
- **Multiple provider**: Supporta sia Coinbase (trading) che CryptoCompare (market data)
|
||||||
- **Interfaccia unificata**: Un'unica API per accedere a tutti i provider
|
- **Interfaccia unificata**: Un'unica API per accedere a tutti i provider
|
||||||
|
|
||||||
### Problemi con i modelli LLM:
|
|
||||||
1. **Ollama gpt-oss**: il modello `gpt-oss` funziona ma non riesce a seguire le istruzioni.
|
|
||||||
2. **Ollama-gwen**: il modello `gwen` funziona più veloce di `gpt-oss` ma comunque non segue le istruzioni.
|
|
||||||
|
|
||||||
### ToDo
|
### ToDo
|
||||||
1. [X] Per lo scraping online bisogna iscriversi e recuperare le chiavi API
|
- [X] Per lo scraping online bisogna iscriversi e recuperare le chiavi API
|
||||||
2. [X] **Market Agent**: [CryptoCompare](https://www.cryptocompare.com/cryptopian/api-keys)
|
- [X] **Market Agent**: [CryptoCompare](https://www.cryptocompare.com/cryptopian/api-keys)
|
||||||
3. [X] **Market Agent**: [Coinbase](https://www.coinbase.com/cloud/discover/api-keys)
|
- [X] **Market Agent**: [Coinbase](https://www.coinbase.com/cloud/discover/api-keys)
|
||||||
4. [] **News Agent**: [CryptoPanic](https://cryptopanic.com/)
|
- [] **News Agent**: [CryptoPanic](https://cryptopanic.com/)
|
||||||
5. [] **Social Agent**: [post più hot da r/CryptoCurrency (Reddit)](https://www.reddit.com/)
|
- [] **Social Agent**: [post più hot da r/CryptoCurrency (Reddit)](https://www.reddit.com/)
|
||||||
6. [] Capire come `gpt-oss` parsifica la risposta e per questioni "estetiche" si può pensare di visualizzare lo stream dei token. Vedere il sorgente `src/ollama_demo.py` per risolvere il problema.
|
- [] Capire come `gpt-oss` parsifica la risposta e per questioni "estetiche" si può pensare di visualizzare lo stream dei token. Vedere il sorgente `src/ollama_demo.py` per risolvere il problema.
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
|
|||||||
@@ -8,30 +8,13 @@ services:
|
|||||||
- .:/app
|
- .:/app
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
# Aggiunte chiave:
|
|
||||||
environment:
|
environment:
|
||||||
# Questa variabile dice alla tua app dove trovare il servizio Ollama
|
# Modelli supportati
|
||||||
- OLLAMA_HOST=http://ollama:11434
|
- OLLAMA_HOST=http://host.docker.internal:11434
|
||||||
# Le tue API keys esistenti
|
|
||||||
- GOOGLE_API_KEY=${GOOGLE_API_KEY}
|
- GOOGLE_API_KEY=${GOOGLE_API_KEY}
|
||||||
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
# Chiavi per le crypto API
|
||||||
- DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY}
|
- CDP_API_KEY_NAME=${CDP_API_KEY_NAME}
|
||||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
- CDP_API_PRIVATE_KEY=${CDP_API_PRIVATE_KEY}
|
||||||
# Assicura che ollama parta prima della tua app
|
- CRYPTOCOMPARE_API_KEY=${CRYPTOCOMPARE_API_KEY}
|
||||||
depends_on:
|
- BINANCE_API_KEY=${BINANCE_API_KEY}
|
||||||
- ollama
|
- BINANCE_API_SECRET=${BINANCE_API_SECRET}
|
||||||
|
|
||||||
# Nuovo servizio per Ollama
|
|
||||||
ollama:
|
|
||||||
image: ollama/ollama
|
|
||||||
container_name: ollama
|
|
||||||
# Aggiungi il runtime NVIDIA per GPU support
|
|
||||||
runtime: nvidia
|
|
||||||
environment:
|
|
||||||
- NVIDIA_VISIBLE_DEVICES=all
|
|
||||||
ports:
|
|
||||||
- "11434:11434"
|
|
||||||
volumes:
|
|
||||||
# Mappa la cartella dei modelli del tuo PC a quella interna del container
|
|
||||||
# ${OLLAMA_MODELS_PATH} sarà letto dal file .env
|
|
||||||
- ${OLLAMA_MODELS_PATH}:/root/.ollama
|
|
||||||
|
|||||||
@@ -48,4 +48,4 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
analyze_btn = gr.Button("🔎 Analizza")
|
analyze_btn = gr.Button("🔎 Analizza")
|
||||||
analyze_btn.click(fn=tool_agent.interact, inputs=[user_input, style], outputs=output)
|
analyze_btn.click(fn=tool_agent.interact, inputs=[user_input, style], outputs=output)
|
||||||
demo.launch()
|
demo.launch(server_name="0.0.0.0", server_port=8000)
|
||||||
|
|||||||
@@ -16,52 +16,68 @@ def prepare_inputs(data: list[ProductInfo], style: PredictorStyle, sentiment: st
|
|||||||
|
|
||||||
def instructions() -> str:
|
def instructions() -> str:
|
||||||
return """
|
return """
|
||||||
Sei un **Consulente Finanziario Algoritmico (CFA) Specializzato in Criptovalute**. Il tuo compito è agire come un sistema esperto di gestione del rischio e allocazione di portafoglio.
|
You are an **Allocation Algorithm (Crypto-Algo)**. Your sole objective is to process the input data and generate a strictly structured output, as specified. **You must not provide any explanations, conclusions, introductions, preambles, or comments that are not strictly required by the final format.**
|
||||||
|
|
||||||
**Istruzione Principale:** Analizza l'Input fornito in formato JSON. La tua strategia deve essere **logica, misurabile e basata esclusivamente sui dati e sullo stile di rischio/rendimento richiesto**.
|
**CRITICAL INSTRUCTION: The final output MUST be a valid JSON object written entirely in Italian, following the structure below.**
|
||||||
|
|
||||||
## Input Dati (Formato JSON)
|
## Processing Instructions (Absolute Rule)
|
||||||
Ti sarà passato un singolo blocco JSON contenente i seguenti campi obbligatori:
|
|
||||||
|
|
||||||
1. **"data":** *Array di tuple (stringa)*. Rappresenta i dati di mercato in tempo reale o recenti. Ogni tupla è `[Nome_Asset, Prezzo_Corrente]`. **Esempio:** `[["BTC", "60000.00"], ["ETH", "3500.00"]]`.
|
Analyze the Input provided in JSON format and generate the Output in two distinct sections. Your allocation strategy must be **derived exclusively from the "Logic Rule" corresponding to the requested *style*** and the *data* provided. **DO NOT** use external knowledge.
|
||||||
2. **"style":** *Stringa ENUM (solo "conservativo" o "aggressivo")*. Definisce l'approccio alla volatilità e all'allocazione.
|
|
||||||
3. **"sentiment":** *Stringa descrittiva*. Riassume il sentiment di mercato estratto da fonti sociali e notizie. **Esempio:** `"Sentiment estremamente positivo, alta FOMO per le altcoin."`.
|
|
||||||
|
|
||||||
## Regole di Logica dello Stile di Investimento
|
## Data Input (JSON Format)
|
||||||
|
The input will be a single JSON block containing the following mandatory fields:
|
||||||
|
|
||||||
- **Stile "Aggressivo":**
|
1. **"data":** *Array of Arrays*. Market data. Format: `[[Asset_Name: String, Current_Price: String], ...]`
|
||||||
- **Obiettivo:** Massimizzazione del rendimento, accettando Volatilità Massima.
|
* *Example:* `[["BTC", "60000.00"], ["ETH", "3500.00"], ["SOL", "150.00"]]`
|
||||||
- **Allocazione:** Maggiore focus su **Asset a Media/Bassa Capitalizzazione (Altcoin)** o su criptovalute che mostrano un'elevata Momentum di crescita, anche se il rischio di ribasso è superiore. L'allocazione su BTC/ETH deve rimanere una base (ancoraggio) ma non dominare il portafoglio.
|
2. **"style":** *ENUM String (only "conservativo" or "aggressivo")*. Defines the risk approach.
|
||||||
- **Correlazione Sentiment:** Sfrutta il sentiment positivo per allocazioni ad alto beta (più reattive ai cambiamenti di mercato).
|
3. **"sentiment":** *Descriptive String*. Summarizes market sentiment.
|
||||||
|
|
||||||
- **Stile "Conservativo":**
|
## Allocation Logic Rules
|
||||||
- **Obiettivo:** Preservazione del capitale, minimizzazione della Volatilità.
|
|
||||||
- **Allocazione:** Maggioranza del capitale allocata in **Asset a Larga Capitalizzazione (Blue Chip: BTC e/o ETH)**. Eventuali allocazioni su Altcoin devono essere minime e su progetti con utilità comprovata e rischio regolatorio basso.
|
|
||||||
- **Correlazione Sentiment:** Utilizza il sentiment positivo come conferma per un'esposizione maggiore, ma ignora segnali eccessivi di "FOMO" (Fear Of Missing Out) per evitare asset speculativi.
|
|
||||||
|
|
||||||
## Requisiti di Formato dell'Output
|
### "Aggressivo" Style (Aggressive)
|
||||||
|
* **Priority:** Maximum return (High Volatility accepted).
|
||||||
|
* **Focus:** Higher allocation to **non-BTC/ETH assets** with high momentum potential (Altcoins, mid/low-cap assets).
|
||||||
|
* **BTC/ETH:** Must form a base (anchor), but their allocation **must not exceed 50%** of the total portfolio.
|
||||||
|
* **Sentiment:** Use positive sentiment to increase allocation to high-risk assets.
|
||||||
|
|
||||||
L'output deve essere formattato in modo rigoroso, composto da **due sezioni distinte**: la Strategia e il Dettaglio del Portafoglio.
|
### "Conservativo" Style (Conservative)
|
||||||
|
* **Priority:** Capital preservation (Volatility minimized).
|
||||||
|
* **Focus:** Major allocation to **BTC and/or ETH (Large-Cap Assets)**.
|
||||||
|
* **BTC/ETH:** Their allocation **must be at least 70%** of the total portfolio.
|
||||||
|
* **Altcoins:** Any allocations to non-BTC/ETH assets must be minimal (max 30% combined) and for assets that minimize speculative risk.
|
||||||
|
* **Sentiment:** Use positive sentiment only as confirmation for exposure, avoiding reactions to excessive "FOMO" signals.
|
||||||
|
|
||||||
### 1. Strategia Sintetica
|
## Output Format Requirements (Strict JSON)
|
||||||
Fornisci una **descrizione operativa** della strategia. Deve essere:
|
|
||||||
- Estremamente concisa.
|
|
||||||
- Contenuta in un **massimo di 5 frasi totali**.
|
|
||||||
|
|
||||||
### 2. Dettaglio del Portafoglio
|
The Output **must be a single JSON object** with two keys: `"strategia"` and `"portafoglio"`.
|
||||||
Presenta l'allocazione del portafoglio come una **lista puntata**.
|
|
||||||
- La somma delle percentuali deve essere **esattamente 100%**.
|
|
||||||
- Per **ogni Asset allocato**, devi fornire:
|
|
||||||
- **Nome dell'Asset** (es. BTC, ETH, SOL, ecc.)
|
|
||||||
- **Percentuale di Allocazione** (X%)
|
|
||||||
- **Motivazione Tecnica/Sintetica** (Massimo 1 frase chiara) che giustifichi l'allocazione in base ai *Dati di Mercato*, allo *Style* e al *Sentiment*.
|
|
||||||
|
|
||||||
**Formato Esempio di Output (da seguire fedelmente):**
|
1. **"strategia":** *Stringa (massimo 5 frasi in Italiano)*. Una descrizione operativa concisa.
|
||||||
|
2. **"portafoglio":** *Array di Oggetti JSON*. La somma delle percentuali deve essere **esattamente 100%**. Ogni oggetto nell'array deve avere i seguenti campi (valori in Italiano):
|
||||||
|
* `"asset"`: Nome dell'Asset (es. "BTC").
|
||||||
|
* `"percentuale"`: Percentuale di Allocazione (come numero intero o decimale, es. 45.0).
|
||||||
|
* `"motivazione"`: Stringa (massimo una frase) che giustifica l'allocazione.
|
||||||
|
|
||||||
[Strategia sintetico-operativa in massimo 5 frasi...]
|
**THE OUTPUT MUST BE GENERATED BY FAITHFULLY COPYING THE FOLLOWING STRUCTURAL TEMPLATE (IN ITALIAN CONTENT, JSON FORMAT):**
|
||||||
|
|
||||||
- **Asset_A:** X% (Motivazione: [Massimo una frase che collega dati, stile e allocazione])
|
```json
|
||||||
- **Asset_B:** Y% (Motivazione: [Massimo una frase che collega dati, stile e allocazione])
|
{
|
||||||
- **Asset_C:** Z% (Motivazione: [Massimo una frase che collega dati, stile e allocazione])
|
"strategia": "[Strategia sintetico-operativa in massimo 5 frasi...]",
|
||||||
...
|
"portafoglio": [
|
||||||
"""
|
{
|
||||||
|
"asset": "Asset_1",
|
||||||
|
"percentuale": X,
|
||||||
|
"motivazione": "[Massimo una frase chiara in Italiano]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"asset": "Asset_2",
|
||||||
|
"percentuale": Y,
|
||||||
|
"motivazione": "[Massimo una frase chiara in Italiano]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"asset": "Asset_3",
|
||||||
|
"percentuale": Z,
|
||||||
|
"motivazione": "[Massimo una frase chiara in Italiano]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"""
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import requests
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from agno.agent import Agent
|
from agno.agent import Agent
|
||||||
from agno.models.base import BaseModel
|
from agno.models.base import BaseModel
|
||||||
@@ -14,10 +15,10 @@ class Models(Enum):
|
|||||||
"""
|
"""
|
||||||
GEMINI = "gemini-2.0-flash" # API online
|
GEMINI = "gemini-2.0-flash" # API online
|
||||||
GEMINI_PRO = "gemini-2.0-pro" # API online, più costoso ma migliore
|
GEMINI_PRO = "gemini-2.0-pro" # API online, più costoso ma migliore
|
||||||
OLLAMA = "llama3.1" # + fast (7b) - very very bad
|
OLLAMA_GPT = "gpt-oss:latest" # + good - slow (13b)
|
||||||
OLLAMA_GPT = "gpt-oss" # + good - slow (13b) - doesn't follow instructions
|
OLLAMA_QWEN = "qwen3:latest" # + good + fast (8b)
|
||||||
OLLAMA_QWEN = "qwen3:8b" # + good + fast (8b), - doesn't follow instructions
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def availables() -> list['Models']:
|
def availables() -> list['Models']:
|
||||||
"""
|
"""
|
||||||
Controlla quali provider di modelli LLM hanno le loro API keys disponibili
|
Controlla quali provider di modelli LLM hanno le loro API keys disponibili
|
||||||
@@ -30,14 +31,40 @@ class Models(Enum):
|
|||||||
if os.getenv("GOOGLE_API_KEY"):
|
if os.getenv("GOOGLE_API_KEY"):
|
||||||
availables.append(Models.GEMINI)
|
availables.append(Models.GEMINI)
|
||||||
availables.append(Models.GEMINI_PRO)
|
availables.append(Models.GEMINI_PRO)
|
||||||
if os.getenv("OLLAMA_MODELS_PATH"):
|
|
||||||
availables.append(Models.OLLAMA)
|
ollama_host = os.getenv("OLLAMA_HOST", "http://localhost:11434")
|
||||||
availables.append(Models.OLLAMA_GPT)
|
result = requests.get(f"{ollama_host}/api/tags")
|
||||||
availables.append(Models.OLLAMA_QWEN)
|
print(result)
|
||||||
|
if result.status_code == 200:
|
||||||
|
result = result.text
|
||||||
|
if Models.OLLAMA_GPT.value in result:
|
||||||
|
availables.append(Models.OLLAMA_GPT)
|
||||||
|
if Models.OLLAMA_QWEN.value in result:
|
||||||
|
availables.append(Models.OLLAMA_QWEN)
|
||||||
|
|
||||||
assert availables, "No valid model API keys set in environment variables."
|
assert availables, "No valid model API keys set in environment variables."
|
||||||
return availables
|
return availables
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def extract_json_str_from_response(response: str) -> str:
|
||||||
|
"""
|
||||||
|
Estrae il JSON dalla risposta del modello.
|
||||||
|
response: risposta del modello (stringa).
|
||||||
|
Ritorna la parte JSON della risposta come stringa.
|
||||||
|
Se non viene trovato nessun JSON, ritorna una stringa vuota.
|
||||||
|
ATTENZIONE: questa funzione è molto semplice e potrebbe non funzionare
|
||||||
|
in tutti i casi. Si assume che il JSON sia ben formato e che inizi con
|
||||||
|
'{' e finisca con '}'. Quindi anche solo un json array farà fallire questa funzione.
|
||||||
|
"""
|
||||||
|
start = response.find("{")
|
||||||
|
assert start != -1, "No JSON found in the response."
|
||||||
|
|
||||||
|
end = response.rfind("}")
|
||||||
|
assert end != -1, "No JSON found in the response."
|
||||||
|
|
||||||
|
return response[start:end + 1].strip()
|
||||||
|
|
||||||
|
|
||||||
def get_model(self, instructions:str) -> BaseModel:
|
def get_model(self, instructions:str) -> BaseModel:
|
||||||
"""
|
"""
|
||||||
Restituisce un'istanza del modello specificato.
|
Restituisce un'istanza del modello specificato.
|
||||||
@@ -47,21 +74,22 @@ class Models(Enum):
|
|||||||
"""
|
"""
|
||||||
name = self.value
|
name = self.value
|
||||||
if self in {Models.GEMINI, Models.GEMINI_PRO}:
|
if self in {Models.GEMINI, Models.GEMINI_PRO}:
|
||||||
return Gemini(name, instructions=instructions)
|
return Gemini(name, instructions=[instructions])
|
||||||
elif self in {Models.OLLAMA, Models.OLLAMA_GPT, Models.OLLAMA_QWEN}:
|
elif self in {Models.OLLAMA_GPT, Models.OLLAMA_QWEN}:
|
||||||
return Ollama(name, instructions=instructions)
|
return Ollama(name, instructions=[instructions])
|
||||||
|
|
||||||
raise ValueError(f"Modello non supportato: {self}")
|
raise ValueError(f"Modello non supportato: {self}")
|
||||||
|
|
||||||
def get_agent(self, instructions: str) -> Agent:
|
def get_agent(self, instructions: str, name: str = "") -> Agent:
|
||||||
"""
|
"""
|
||||||
Costruisce un agente con il modello e le istruzioni specificate.
|
Costruisce un agente con il modello e le istruzioni specificate.
|
||||||
instructions: istruzioni da passare al modello (system prompt).
|
instructions: istruzioni da passare al modello (system prompt).
|
||||||
Ritorna un'istanza di Agent.
|
Ritorna un'istanza di Agent.
|
||||||
"""
|
"""
|
||||||
return Agent(
|
return Agent(
|
||||||
model=self.get_model(instructions=instructions),
|
model=self.get_model(instructions),
|
||||||
instructions=instructions,
|
name=name,
|
||||||
|
use_json_mode=True,
|
||||||
# TODO Eventuali altri parametri da mettere all'agente
|
# TODO Eventuali altri parametri da mettere all'agente
|
||||||
# anche se si possono comunque assegnare dopo la creazione
|
# anche se si possono comunque assegnare dopo la creazione
|
||||||
# Esempio:
|
# Esempio:
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ class ToolAgent:
|
|||||||
)
|
)
|
||||||
|
|
||||||
prediction = self.predictor.run(inputs)
|
prediction = self.predictor.run(inputs)
|
||||||
#output = prediction.content.split("</think>")[-1] # remove thinking steps and reasoning from the final output
|
output = Models.extract_json_str_from_response(prediction.content)
|
||||||
output = prediction.content
|
|
||||||
|
|
||||||
market_data = "\n".join([f"{product.symbol}: {product.price}" for product in market_data])
|
market_data = "\n".join([f"{product.symbol}: {product.price}" for product in market_data])
|
||||||
return f"{market_data}\n{sentiment}\n\n📈 Consiglio finale:\n{output}"
|
return f"{market_data}\n{sentiment}\n\n📈 Consiglio finale:\n{output}"
|
||||||
|
|||||||
43
tests/agents/test_predictor.py
Normal file
43
tests/agents/test_predictor.py
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import json
|
||||||
|
import pytest
|
||||||
|
from app.agents import predictor
|
||||||
|
from app.models import Models
|
||||||
|
|
||||||
|
def unified_checks(model: Models, input):
|
||||||
|
llm = model.get_agent(predictor.instructions())
|
||||||
|
result = llm.run(input)
|
||||||
|
|
||||||
|
print(result.content)
|
||||||
|
potential_json = Models.extract_json_str_from_response(result.content)
|
||||||
|
content = json.loads(potential_json) # Verifica che l'output sia un JSON valido
|
||||||
|
|
||||||
|
assert content['strategia'] is not None
|
||||||
|
assert isinstance(content['portafoglio'], list)
|
||||||
|
assert abs(sum(item['percentuale'] for item in content['portafoglio']) - 100) < 0.01 # La somma deve essere esattamente 100
|
||||||
|
|
||||||
|
class TestPredictor:
|
||||||
|
|
||||||
|
@pytest.fixture(scope="class")
|
||||||
|
def inputs(self):
|
||||||
|
data = []
|
||||||
|
for symbol, price in [("BTC", 60000.00), ("ETH", 3500.00), ("SOL", 150.00)]:
|
||||||
|
product_info = predictor.ProductInfo()
|
||||||
|
product_info.symbol = symbol
|
||||||
|
product_info.price = price
|
||||||
|
data.append(product_info)
|
||||||
|
|
||||||
|
return predictor.prepare_inputs(
|
||||||
|
data=data,
|
||||||
|
style=predictor.PredictorStyle.AGGRESSIVE,
|
||||||
|
sentiment="positivo"
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_gemini_model_output(self, inputs):
|
||||||
|
unified_checks(Models.GEMINI, inputs)
|
||||||
|
|
||||||
|
@pytest.mark.slow
|
||||||
|
def test_ollama_gpt_oss_model_output(self, inputs):
|
||||||
|
unified_checks(Models.OLLAMA_GPT, inputs)
|
||||||
|
|
||||||
|
def test_ollama_qwen_model_output(self, inputs):
|
||||||
|
unified_checks(Models.OLLAMA_QWEN, inputs)
|
||||||
@@ -30,6 +30,15 @@ def pytest_configure(config):
|
|||||||
config.addinivalue_line(
|
config.addinivalue_line(
|
||||||
"markers", "cryptocompare: marks tests that require CryptoCompare credentials"
|
"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"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def pytest_collection_modifyitems(config, items):
|
def pytest_collection_modifyitems(config, items):
|
||||||
@@ -42,3 +51,10 @@ def pytest_collection_modifyitems(config, items):
|
|||||||
# Aggiungi marker 'slow' ai test che potrebbero essere lenti
|
# Aggiungi marker 'slow' ai test che potrebbero essere lenti
|
||||||
if "overview" in item.name.lower() or "analysis" in item.name.lower():
|
if "overview" in item.name.lower() or "analysis" in item.name.lower():
|
||||||
item.add_marker(pytest.mark.slow)
|
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