助理蜘蛛侠
语音驱动的人工智能助手,配备Gemini-ADK风格的工具、基于MCP的存储系统和模块化代理架构。作为Kaggle代理强化课程的顶点项目而构建。
🕷️ 助理蜘蛛侠——语音驱动的人工智能代理(双子座-ADK启发,MCP记忆)
助理蜘蛛侠是 语音控制AI代理 为\ Kaggle代理商密集型Capstone项目.
它结合了:
- 🎤 语音识别
- 🤖 LLM Agent Brain(Gemini/OpenAI风格推理)
- 🧰 工具系统(如Gemini ADK)
- 💾 内存引擎(MCP式长期内存)
- 🗣 文本到语音响应
- 🖥 桌面应用控制
- 🌐 实时数据工具(天气、网络搜索、维基百科)
- 🔊 使用WAV音频文件进行Kaggle友好模拟
此仓库包含运行和修改Assistant Spidey的完整源代码、演示文件和文档。
______________________________________________________________________
🚀 特性
✅ 语音命令
蜘蛛侠会听你的声音并执行以下命令:
- “孟买的天气怎么样?”
- “钢铁侠是谁?”
- “打开Chrome浏览器。”
- “记住,我的名字是阿布舍克。”
- “我叫什么名字?”
- “搜索复仇者联盟的发布日期。”
✅ Gemini ADK灵感工具系统
模块化 工具 (Python函数),代理可以调用:
- 🌤 天气工具
- 🌐 网络搜索工具
- 📚 维基百科工具
- 🖥 应用启动器工具
- 📝 内存添加工具
- 🔍 内存检索工具
✅ MCP风格存储器
蜘蛛侠可以 *记住* 长期的事情:
- 名字
- 偏好设置
- 备注
- 个人事实
- 对话历史记录(最近5条消息)
内存存储在 memory.json.
✅ Agent Brain(LLM驱动)
蜘蛛侠使用LLM来:
- 解释命令
- 选择正确的工具
- 总结信息
- 管理上下文
- 进行回退聊天
适用于 双子座, OpenAI, 羊驼或任何LLM API。
✅ Kaggle兼容演示
自从Kaggle *无麦克风接入*,笔记本使用:
- 样品
.wav音频命令 - 模拟STT处理
- 代理+工具执行
- 内存演示更新
✅ 桌面执行
在本地运行时,它使用:
- 麦克风输入
- 应用程序启动
- 文本转语音输出
- 实时交互
______________________________________________________________________
📁 项目结构
助理_皮迪/ │ ├── main.py#主条目:语音循环/文本循环 ├── agent.py#LLM代理大脑+工具路由 ├── tools.py#所有工具(天气、维基、搜索等) ├── memory.py#类似MCP的内存存储和检索 ├── config.py#(可选)环境密钥加载器 │ ├── memory.json#长期记忆 ├── 需求.txt │ ├── samples/#Kaggle的wav音频文件样本 │ ├── 天气.wav │ ├── who_is_iron_man.wav │ └── 记住名字.wav │ └── demo/ ├── demo.mp4 └── demo.gif
______________________________________________________________________
🧠 架构图
🎤 语音输入(麦克风或WAV) ↓ 🗣 语音转文本(语音识别/Vosk) ↓ 🤖 LLM Agent Brain(Gemini/OpenAI) ↓ 🧰 工具路由器(Gemini ADK风格) ├── 天气工具 ├── 搜索工具 ├── 维基百科工具 ├── 应用启动器 ├── 内存添加 └── 内存获取 ↓ 📄 最终回复文本 ↓ 🔊 文本转语音(pyttsx3)
______________________________________________________________________
🛠 安装
1.️⃣ 克隆项目
git clone https://github.com//assistant-spidey.git
cd assistant-spidey
2️⃣ Create virtual environment
python -m venv venv
source venv/bin/activate # macOS / Linux
venv\Scripts\activate # Windows
3️⃣ Install dependencies
pip install -r requirements.txt
4️⃣ Create .env for API keys
WEATHER_API_KEY=xxxxx
GEMINI_API_KEY=xxxxx
OPENAI_API_KEY=xxxxx
▶️ Usage
🔹 Run locally (voice)
python main.py
Say commands like:
“Spidey, what’s the weather?”
“Open Chrome.”
“Remember that my name is Abhishek.”
🔹 Run in Kaggle Notebook (audio simulation)
Replace microphone input with:
text = listen_file("samples/weather.wav")
🤖 LLM Integration
Replace placeholder inside call_llm():
Gemini
import google.generativeai as genai
genai.configure(api_key=GEMINI_API_KEY)
response = genai.GenerativeModel("gemini-1.5-pro").generate_content(prompt)
OpenAI
from openai import OpenAI
client = OpenAI(api_key=OPENAI_API_KEY)
response = client.chat.completions.create(...)
🔧 Adding New Tools
Every tool is just a Python function inside tools.py.
Example:
def tool_joke():
return "Why did the computer freeze? Because it left its Windows open!"
Add to router in agent.py:
if tool == "joke":
return tool_joke()
🧪 Sample Commands (for WAV files)
Use these for Kaggle demo:
“What is the weather in Mumbai?”
“Who is Iron Man?”
“Remember my name is Abhishek.”
“What is my name?”
“Open Chrome.”
“Search for Spider-Man movie release date.”
🤝 Contributing
Fork the repo
Create a branch:
git checkout -b feature/new-tool
Commit:
git commit -m "Added Wikipedia detail tool"
Push:
git push origin feature/new-tool
Open Pull Request
💬 Team Collaboration
Use the GitHub:
Issues tab → track tasks
Projects Board → workflow
Pull Requests → peer review
Wiki → documentation
Branch Protection → secure main branch
📄 License
MIT License — feel free to modify, reuse, contribute.
🌐 Links
Kaggle Notebook: (add link)
Demo Video: (add link)
GitHub Repo: (add link)