feat(devpulse_ai): switch to Gemini API preference

This commit is contained in:
STiFLeR7
2026-02-09 11:21:17 +05:30
parent 6819ee0f9b
commit f26a05d2a7
7 changed files with 23 additions and 21 deletions

View File

@@ -69,10 +69,10 @@ cd advanced_ai_agents/multi_agent_apps/devpulse_ai
pip install -r requirements.txt
```
1. Set your OpenAI API key (optional for live mode)
1. Set your Gemini API key (optional for live mode)
```bash
export OPENAI_API_KEY=your_api_key
export GOOGLE_API_KEY=your_api_key
```
1. Run the verification script (no API key needed)
@@ -97,8 +97,8 @@ A modern, interactive dashboard is included to visualize the multi-agent pipelin
streamlit run streamlit_app.py
```
2. Configure sources and signal counts in the sidebar.
2. Provide an OpenAI API key (optional) to use full LLM intelligence.
1. Configure sources and signal counts in the sidebar.
2. Provide a Gemini API key (optional) to use full LLM intelligence.
3. View real-time progress as agents collaborate.
> **Note**: The default configuration is optimized for fast demo runs.
@@ -163,5 +163,5 @@ devpulse_ai/
### Built With
- [Agno](https://github.com/agno-agi/agno) - Multi-agent framework
- [OpenAI GPT-4o-mini](https://openai.com/) - LLM backbone
- [Google Gemini 1.5 Flash](https://ai.google.dev/) - LLM backbone
- [httpx](https://www.python-httpx.org/) - Async HTTP client

View File

@@ -7,7 +7,7 @@ based on its relevance to AI/ML developers and engineers.
from typing import Dict, Any, Optional
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.models.google import Gemini
class RelevanceAgent:
@@ -20,17 +20,17 @@ class RelevanceAgent:
- Prioritize actionable, timely content
"""
def __init__(self, model_id: str = "gpt-4o-mini"):
def __init__(self, model_id: str = "gemini-1.5-flash"):
"""
Initialize the Relevance Agent.
Args:
model_id: OpenAI model to use for scoring.
model_id: Model ID to use for scoring.
"""
self.model_id = model_id
self.agent = Agent(
name="Relevance Scorer",
model=OpenAIChat(id=model_id),
model=Gemini(id=model_id),
role="Scores technical signals based on developer relevance",
instructions=[
"Score each signal from 0-100 based on relevance.",

View File

@@ -9,7 +9,7 @@ This agent analyzes signals for potential risks including:
from typing import Dict, Any, List
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.models.google import Gemini
class RiskAgent:
@@ -25,17 +25,17 @@ class RiskAgent:
RISK_LEVELS = ["LOW", "MEDIUM", "HIGH", "CRITICAL"]
def __init__(self, model_id: str = "gpt-4o-mini"):
def __init__(self, model_id: str = "gemini-1.5-flash"):
"""
Initialize the Risk Agent.
Args:
model_id: OpenAI model to use for risk assessment.
model_id: Model ID to use for risk assessment.
"""
self.model_id = model_id
self.agent = Agent(
name="Risk Assessor",
model=OpenAIChat(id=model_id),
model=Gemini(id=model_id),
role="Assesses security and breaking change risks in technical signals",
instructions=[
"Analyze signals for security vulnerabilities.",

View File

@@ -7,7 +7,7 @@ a comprehensive, actionable intelligence summary for developers.
from typing import Dict, Any, List
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.models.google import Gemini
class SynthesisAgent:
@@ -21,17 +21,17 @@ class SynthesisAgent:
- Produce actionable recommendations
"""
def __init__(self, model_id: str = "gpt-4o-mini"):
def __init__(self, model_id: str = "gemini-1.5-flash"):
"""
Initialize the Synthesis Agent.
Args:
model_id: OpenAI model to use for synthesis.
model_id: Model ID to use for synthesis.
"""
self.model_id = model_id
self.agent = Agent(
name="Intelligence Synthesizer",
model=OpenAIChat(id=model_id),
model=Gemini(id=model_id),
role="Synthesizes technical signals into actionable intelligence digests",
instructions=[
"Combine relevance scores and risk assessments.",

View File

@@ -84,8 +84,8 @@ def run_pipeline():
print("=" * 60)
# Check for API key
if not os.environ.get("OPENAI_API_KEY"):
print("\n⚠️ Warning: OPENAI_API_KEY not set.")
if not os.environ.get("GOOGLE_API_KEY") and not os.environ.get("GEMINI_API_KEY"):
print("\n⚠️ Warning: GOOGLE_API_KEY not set.")
print(" LLM-based agents will use fallback heuristics.\n")
# Stage 1: Collection

View File

@@ -3,3 +3,4 @@ httpx
openai
feedparser
streamlit>=1.30
google-generativeai

View File

@@ -73,9 +73,10 @@ scores them for relevance, identifies potential risks, and synthesizes a final i
st.sidebar.header("⚙️ Pipeline Configuration")
# API Key
api_key = st.sidebar.text_input("OpenAI API Key (optional)", type="password", help="If not provided, agents will use fallback heuristic logic.")
api_key = st.sidebar.text_input("Gemini API Key (optional)", type="password", help="Provide a Google Gemini API key. If not provided, agents will use fallback heuristic logic.")
if api_key:
os.environ["OPENAI_API_KEY"] = api_key
# Agno's GoogleGemini looks for GOOGLE_API_KEY
os.environ["GOOGLE_API_KEY"] = api_key
# Source Selection
sources = st.sidebar.multiselect(