Skip to content

100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.

feat: Enhance multimodal AI agent with improved API key handling and model updates

Shubhamsaboo074320081e11
diff --git a/starter_ai_agents/multimodal_ai_agent/README.md b/starter_ai_agents/multimodal_ai_agent/README.md
index 1cb9b4da..718ee919 100644
--- a/starter_ai_agents/multimodal_ai_agent/README.md
+++ b/starter_ai_agents/multimodal_ai_agent/README.md
@@ -1,10 +1,10 @@
## 🧬 Multimodal AI Agent
-A Streamlit application that combines video analysis and web search capabilities using Google's Gemini 2.0 model. This agent can analyze uploaded videos and answer questions by combining visual understanding with web-search.
+A Streamlit application that combines video analysis and web search capabilities using Google's Gemini 2.5 model. This agent can analyze uploaded videos and answer questions by combining visual understanding with web-search.
### Features
-- Video analysis using Gemini 2.0 Flash
+- Video analysis using Gemini 2.5 Flash/Pro
- Web research integration via DuckDuckGo
- Support for multiple video formats (MP4, MOV, AVI)
- Real-time video processing
diff --git a/starter_ai_agents/multimodal_ai_agent/multimodal_reasoning_agent.py b/starter_ai_agents/multimodal_ai_agent/multimodal_reasoning_agent.py
index 428805a5..5c7487a3 100644
--- a/starter_ai_agents/multimodal_ai_agent/multimodal_reasoning_agent.py
+++ b/starter_ai_agents/multimodal_ai_agent/multimodal_reasoning_agent.py
@@ -1,25 +1,40 @@
import streamlit as st
from agno.agent import Agent
+from agno.run.agent import RunOutput
+from agno.media import Image
from agno.models.google import Gemini
import tempfile
import os
def main():
- # Set up the reasoning agent
- agent = Agent(
- model=Gemini(id="gemini-2.0-flash-thinking-exp-1219"),
- markdown=True
- )
-
# Streamlit app title
st.title("Multimodal Reasoning AI Agent 🧠")
+ # Get Gemini API key from user in sidebar
+ with st.sidebar:
+ st.header("πŸ”‘ Configuration")
+ gemini_api_key = st.text_input("Enter your Gemini API Key", type="password")
+ st.caption(
+ "Get your API key from [Google AI Studio]"
+ "(https://aistudio.google.com/apikey) πŸ”‘"
+ )
+
# Instruction
st.write(
"Upload an image and provide a reasoning-based task for the AI Agent. "
"The AI Agent will analyze the image and respond based on your input."
)
+ if not gemini_api_key:
+ st.warning("Please enter your Gemini API key in the sidebar to continue.")
+ return
+
+ # Set up the reasoning agent
+ agent = Agent(
+ model=Gemini(id="gemini-2.5-pro", api_key=gemini_api_key),
+ markdown=True
+ )
+
# File uploader for image
uploaded_file = st.file_uploader("Upload Image", type=["jpg", "jpeg", "png"])
@@ -43,7 +58,7 @@ def main():
with st.spinner("AI is thinking... πŸ€–"):
try:
# Call the agent with the dynamic task and image path
- response = agent.run(task_input, images=[temp_path])
+ response: RunOutput = agent.run(task_input, images=[Image(filepath=temp_path)])
# Display the response from the model
st.markdown("### AI Response:")
diff --git a/starter_ai_agents/multimodal_ai_agent/mutimodal_agent.py b/starter_ai_agents/multimodal_ai_agent/mutimodal_agent.py
index 23b77c1b..d25fd605 100644
--- a/starter_ai_agents/multimodal_ai_agent/mutimodal_agent.py
+++ b/starter_ai_agents/multimodal_ai_agent/mutimodal_agent.py
@@ -1,5 +1,6 @@
import streamlit as st
from agno.agent import Agent
+from agno.run.agent import RunOutput
from agno.models.google import Gemini
from agno.media import Video
import time
@@ -14,15 +15,21 @@ st.set_page_config(
st.title("Multimodal AI Agent 🧬")
-# Get Gemini API key from user
-gemini_api_key = st.text_input("Enter your Gemini API Key", type="password")
+# Get Gemini API key from user in sidebar
+with st.sidebar:
+ st.header("πŸ”‘ Configuration")
+ gemini_api_key = st.text_input("Enter your Gemini API Key", type="password")
+ st.caption(
+ "Get your API key from [Google AI Studio]"
+ "(https://aistudio.google.com/apikey) πŸ”‘"
+ )
# Initialize single agent with both capabilities
@st.cache_resource
def initialize_agent(api_key):
return Agent(
name="Multimodal Analyst",
- model=Gemini(id="gemini-2.0-flash", api_key=api_key),
+ model=Gemini(id="gemini-2.5-flash", api_key=api_key),
markdown=True,
)
@@ -60,7 +67,7 @@ if gemini_api_key:
Provide a comprehensive response focusing on practical, actionable information.
"""
- result = agent.run(prompt, videos=[video])
+ result: RunOutput = agent.run(prompt, videos=[video])
st.subheader("Result")
st.markdown(result.content)
diff --git a/starter_ai_agents/multimodal_ai_agent/requirements.txt b/starter_ai_agents/multimodal_ai_agent/requirements.txt
index fad806f6..0be70a43 100644
--- a/starter_ai_agents/multimodal_ai_agent/requirements.txt
+++ b/starter_ai_agents/multimodal_ai_agent/requirements.txt
@@ -1,3 +1,3 @@
-agno
+agno>=2.2.10
google-generativeai==0.8.3
streamlit==1.40.2
\ No newline at end of file