Ollama Inefficace come Team Leader #69

Closed
opened 2025-10-30 17:38:26 +01:00 by Simo93-rgb · 3 comments
Simo93-rgb commented 2025-10-30 17:38:26 +01:00 (Migrated from github.com)

Io e Filiberto abbiamo provato a usare QWEN3 come modello per il team leader ma per entrambi la risposta della App è stata pessima oltre ogni limite.

Query: analizza solana e cardano
Risposta: Il simbolo di bitcoin è BTC-USD

Io ho potuto provare anche il modello da 32b ma non cambia molto.
Provando a chiedere solo il prezzo bitcoin mi risponde che non può accedere ai prezzi online!
Query: I'd like to know the btc current price in us dollar
Risposta: I don't have access to real-time cryptocurrency price data. However, you can check the current price of Bitcoin (BTC) on financial websites like CoinMarketCap, CoinGecko, or cryptocurrency exchanges like Binance, Coinbase, or Kraken. Would you like me to help you with anything else related to cryptocurrency?

Controllando il server effettivamente non usa nessun tool o per lo meno non stampa di averlo fatto.

Ecco il log del server:

simon@BimboMio:~/GitHub/upo-appAI$ uv run src/app
WARNING [2025-10-30 17:33:19,831] (app.configs) - No OPENAI_API_KEY set in environment variables for OpenAIChat.
WARNING [2025-10-30 17:33:19,831] (app.configs) - No MISTRAL_API_KEY set in environment variables for MistralChat.
WARNING [2025-10-30 17:33:19,831] (app.configs) - No DEEPSEEK_API_KEY set in environment variables for DeepSeek.
INFO [2025-10-30 17:33:19,833] (app.configs) - Loaded configuration from configs.yaml
INFO [2025-10-30 17:33:20,195] (root) - UPO AppAI Chat is running on http://localhost:8000/
INFO [2025-10-30 17:33:21,559] (telegram.ext.Application) - Application started
INFO [2025-10-30 17:34:26,055] (pipeline) - [6601] Pipeline query: Prezzo bitcoin
INFO [2025-10-30 17:34:27,889] (pipeline) - [6601] Query Check completed.
INFO [2025-10-30 17:35:01,316] (pipeline) - [6601] Info Recovery completed.
INFO [2025-10-30 17:35:07,077] (pipeline) - [6601] Report Generation completed.
INFO [2025-10-30 17:35:07,077] (pipeline) - [6601] Run completed.
Io e Filiberto abbiamo provato a usare QWEN3 come modello per il team leader ma per entrambi la risposta della App è stata pessima oltre ogni limite. **Query**: `analizza solana e cardano` **Risposta**: `Il simbolo di bitcoin è BTC-USD` Io ho potuto provare anche il modello da 32b ma non cambia molto. **Provando a chiedere solo il prezzo bitcoin mi risponde che non può accedere ai prezzi online!** **Query**: `I'd like to know the btc current price in us dollar` **Risposta**: `I don't have access to real-time cryptocurrency price data. However, you can check the current price of Bitcoin (BTC) on financial websites like CoinMarketCap, CoinGecko, or cryptocurrency exchanges like Binance, Coinbase, or Kraken. Would you like me to help you with anything else related to cryptocurrency?` Controllando il server effettivamente non usa nessun tool o per lo meno non stampa di averlo fatto. Ecco il log del server: ```bash simon@BimboMio:~/GitHub/upo-appAI$ uv run src/app WARNING [2025-10-30 17:33:19,831] (app.configs) - No OPENAI_API_KEY set in environment variables for OpenAIChat. WARNING [2025-10-30 17:33:19,831] (app.configs) - No MISTRAL_API_KEY set in environment variables for MistralChat. WARNING [2025-10-30 17:33:19,831] (app.configs) - No DEEPSEEK_API_KEY set in environment variables for DeepSeek. INFO [2025-10-30 17:33:19,833] (app.configs) - Loaded configuration from configs.yaml INFO [2025-10-30 17:33:20,195] (root) - UPO AppAI Chat is running on http://localhost:8000/ INFO [2025-10-30 17:33:21,559] (telegram.ext.Application) - Application started INFO [2025-10-30 17:34:26,055] (pipeline) - [6601] Pipeline query: Prezzo bitcoin INFO [2025-10-30 17:34:27,889] (pipeline) - [6601] Query Check completed. INFO [2025-10-30 17:35:01,316] (pipeline) - [6601] Info Recovery completed. INFO [2025-10-30 17:35:07,077] (pipeline) - [6601] Report Generation completed. INFO [2025-10-30 17:35:07,077] (pipeline) - [6601] Run completed. ```
Simo93-rgb commented 2025-10-30 20:23:44 +01:00 (Migrated from github.com)

Aggiornamento

Usando llama3.1:8b il problema persiste.

# Aggiornamento Usando `llama3.1:8b` il problema persiste.
Berack96 commented 2025-10-30 23:31:15 +01:00 (Migrated from github.com)

Sembra essere un problema di prompt troppo lungo e complesso. Per citare Gemini:

È un prompt eccellente, di tipo "agentico" (ReAct), per un modello avanzato (come Gemini 1.5 Pro) integrato in un framework che supporta l'uso di tool esterni e la gestione dello stato.
Per un modello da 8B, è quasi certamente troppo complesso. La lunghezza del contesto, il numero di regole stringenti e la necessità di gestire un workflow multi-step superano le capacità di instruction-following della maggior parte dei modelli di quella dimensione.

Quindi possiamo procedere rifacendo il prompt (o i prompt eventualmente se ci sono altri problemi) "riducendolo" in modo che anche una 8B possa capire cosa fare,

Perchè ho testato con gemini e riesce tranquillamente a prendermi i dati dei bitcoin, cose complesse non le ho fatte dato che finisco le chiamate.

Possiamo, nel caso, utilizzare la chiave di @Nunzi99 di ChatGPT per la demo, giusto per far funzionare il progetto.
Sempre che non si paghi nel fare 100 richieste in un minuto.

Sembra essere un problema di prompt troppo lungo e complesso. Per citare Gemini: > È un prompt eccellente, di tipo "agentico" (ReAct), per un modello avanzato (come Gemini 1.5 Pro) integrato in un framework che supporta l'uso di tool esterni e la gestione dello stato. > Per un modello da 8B, è quasi certamente troppo complesso. La lunghezza del contesto, il numero di regole stringenti e la necessità di gestire un workflow multi-step superano le capacità di instruction-following della maggior parte dei modelli di quella dimensione. Quindi possiamo procedere rifacendo il prompt (o i prompt eventualmente se ci sono altri problemi) "riducendolo" in modo che anche una 8B possa capire cosa fare, Perchè ho testato con gemini e riesce tranquillamente a prendermi i dati dei bitcoin, cose complesse non le ho fatte dato che finisco le chiamate. Possiamo, nel caso, utilizzare la chiave di @Nunzi99 di ChatGPT per la demo, giusto per far funzionare il progetto. Sempre che non si paghi nel fare 100 richieste in un minuto.
Berack96 commented 2025-10-31 11:24:30 +01:00 (Migrated from github.com)

Ho fatto un breve test facendo modificare il promt a Copilot tramite questa richiesta:

Il prompt deve essere modificato in modo che anche una LLM "piccola" (8B) possa eseguirlo. Questo significa che non deve saturare il contesto e non deve confonderla sul suo workflow.
NON modificare cosa chiede il prompt, riscrivilo solo in modo che possa esser usato anche da LLM con capacità inferiori

E alla domanda "Ha senso investire in Bitcoin adesso?", ha chiamato correttamente i tools producendo una risposta con dei dati presi. Il report generation riceve forse dei dati un pò a caso, dato che il prompt non l'ho controllato bene, ma per un test da 2 minuti sembra che la causa sia proprio la lunghezza/complessità troppo elevata per un LLM di "piccole" dimensioni.

Forse è necessario strutturare meglio l'output del team in modo da restituire un oggetto invece che del testo libero che potrebbe fare degli errori. In questo modo possiamo ridurre ancora il prompt dato che Agno penserà a definire l'output al posto nostro

Di seguito metto il prompt modificato da Copilot se è necessario:

**ROLE:** Crypto Analysis Team Leader. Coordinate agents for crypto reports. Current date: {{CURRENT_DATE}}.

**KEY PRINCIPLES:**
- Use ONLY live data from agent tools (never pre-trained knowledge)
- All data must have timestamps from {{CURRENT_DATE}}
- Never fabricate data - only report agent outputs
- Currency: Always USD (treat any other currency amounts as USD)
- You may act as financial advisor

**YOUR AGENTS:**
- **MarketAgent**: Real-time prices/historical data
- **NewsAgent**: Live news with sentiment
- **SocialAgent**: Social media discussions

**YOUR TOOLS:**

**1. PlanMemoryTool** (MANDATORY):
- `add_tasks(task_names)` - Add specific tasks
- `get_next_pending_task()` - Get next task
- `update_task_status(name, status, result)` - Update with meaningful results
- `list_all_tasks()` - Final report data

**2. CryptoSymbolsTools**:
- `get_symbols_by_name(query)` - Find crypto symbols
- `get_all_symbols()` - List all symbols
- Always resolve crypto names to symbols first

**3. ReasoningTools** (MANDATORY for analysis):
- `think(title, thought, action, confidence)` - Before decisions
- `analyze(title, result, analysis, next_action, confidence)` - Evaluate results

**WORKFLOW:**

1. **Resolve Crypto Names**: Use `get_symbols_by_name()` for any crypto mentioned
2. **Create Plan**: Use `add_tasks()` with specific task descriptions
3. **Execute Loop**:
   '''
   while task := get_next_pending_task():
       - Use think() to decide which agent
       - Call appropriate agent
       - Use analyze() to evaluate response
       - Update status with actual data
   '''
4. **Retry Failed Tasks**: Max 3 attempts with modified parameters
5. **Synthesize**: Use reasoning tools before writing final sections

**OUTPUT STRUCTURE:**

'''
=== SUMMARY ===
[Brief overview with data completeness, current as of {{CURRENT_DATE}}]

=== MARKET DATA === [Skip if no data]
Analysis: [Your synthesis using reasoning tools]
Raw Data: [Exact agent output with timestamps]

=== NEWS SENTIMENT === [Skip if no data] 
Analysis: [Your synthesis]
Raw Data: [Key headlines and themes]

=== SOCIAL SENTIMENT === [Skip if no data]
Analysis: [Your synthesis] 
Raw Data: [Sample posts and narratives]

=== EXECUTION LOG ===
Tasks: [N completed, M failed]
Data Quality: [High/Medium/Low]
Timestamp: {{CURRENT_DATE}}
'''

**CRITICAL RULES:**
- Use PlanMemoryTool for ALL state tracking
- Use ReasoningTools before writing analysis sections
- Resolve crypto names with CryptoSymbolsTools first
- Never modify price data from MarketAgent
- Include all timestamps and sources
- Retry failed tasks up to 3 times
- Only report data explicitly from agents
Ho fatto un breve test facendo modificare il promt a Copilot tramite questa richiesta: > Il prompt deve essere modificato in modo che anche una LLM "piccola" (8B) possa eseguirlo. Questo significa che non deve saturare il contesto e non deve confonderla sul suo workflow. > NON modificare cosa chiede il prompt, riscrivilo solo in modo che possa esser usato anche da LLM con capacità inferiori E alla domanda "Ha senso investire in Bitcoin adesso?", ha chiamato correttamente i tools producendo una risposta con dei dati presi. Il report generation riceve forse dei dati un pò a caso, dato che il prompt non l'ho controllato bene, ma per un test da 2 minuti sembra che la causa sia proprio la lunghezza/complessità troppo elevata per un LLM di "piccole" dimensioni. Forse è necessario strutturare meglio l'output del team in modo da restituire un oggetto invece che del testo libero che potrebbe fare degli errori. In questo modo possiamo ridurre ancora il prompt dato che Agno penserà a definire l'output al posto nostro Di seguito metto il prompt modificato da Copilot se è necessario: ```markdown **ROLE:** Crypto Analysis Team Leader. Coordinate agents for crypto reports. Current date: {{CURRENT_DATE}}. **KEY PRINCIPLES:** - Use ONLY live data from agent tools (never pre-trained knowledge) - All data must have timestamps from {{CURRENT_DATE}} - Never fabricate data - only report agent outputs - Currency: Always USD (treat any other currency amounts as USD) - You may act as financial advisor **YOUR AGENTS:** - **MarketAgent**: Real-time prices/historical data - **NewsAgent**: Live news with sentiment - **SocialAgent**: Social media discussions **YOUR TOOLS:** **1. PlanMemoryTool** (MANDATORY): - `add_tasks(task_names)` - Add specific tasks - `get_next_pending_task()` - Get next task - `update_task_status(name, status, result)` - Update with meaningful results - `list_all_tasks()` - Final report data **2. CryptoSymbolsTools**: - `get_symbols_by_name(query)` - Find crypto symbols - `get_all_symbols()` - List all symbols - Always resolve crypto names to symbols first **3. ReasoningTools** (MANDATORY for analysis): - `think(title, thought, action, confidence)` - Before decisions - `analyze(title, result, analysis, next_action, confidence)` - Evaluate results **WORKFLOW:** 1. **Resolve Crypto Names**: Use `get_symbols_by_name()` for any crypto mentioned 2. **Create Plan**: Use `add_tasks()` with specific task descriptions 3. **Execute Loop**: ''' while task := get_next_pending_task(): - Use think() to decide which agent - Call appropriate agent - Use analyze() to evaluate response - Update status with actual data ''' 4. **Retry Failed Tasks**: Max 3 attempts with modified parameters 5. **Synthesize**: Use reasoning tools before writing final sections **OUTPUT STRUCTURE:** ''' === SUMMARY === [Brief overview with data completeness, current as of {{CURRENT_DATE}}] === MARKET DATA === [Skip if no data] Analysis: [Your synthesis using reasoning tools] Raw Data: [Exact agent output with timestamps] === NEWS SENTIMENT === [Skip if no data] Analysis: [Your synthesis] Raw Data: [Key headlines and themes] === SOCIAL SENTIMENT === [Skip if no data] Analysis: [Your synthesis] Raw Data: [Sample posts and narratives] === EXECUTION LOG === Tasks: [N completed, M failed] Data Quality: [High/Medium/Low] Timestamp: {{CURRENT_DATE}} ''' **CRITICAL RULES:** - Use PlanMemoryTool for ALL state tracking - Use ReasoningTools before writing analysis sections - Resolve crypto names with CryptoSymbolsTools first - Never modify price data from MarketAgent - Include all timestamps and sources - Retry failed tasks up to 3 times - Only report data explicitly from agents ```
Sign in to join this conversation.