AI聊天笔记本工具

一个结合AI模型(Ollama)和实时工具/数据的Jupyter笔记本单元,支持交互式聊天和自动工具调用。

  • by martianspaceships
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 martianspaceships/Gradio_MCP_AI_Chat_Notebook

使用说明

📡🧠 Gradio MCP AI聊天笔记本

一个Jupyter笔记本就绪单元格,结合了 人工智能模型(Ollama) 随着 实时工具/数据 通过Gradio MCP服务器。
与人工智能聊天,让它自动调用工具,并获得智能答案——所有这些都来自一个笔记本电脑。

受以下MCP CLient的启发:https://medium.com/@jonigl/build-an-mcp-client in minutes-local-ai-agents-just-got-real a10e186a560f


✨ 特性

  • 单细胞交互回路:键入问题,获取答案,键入 quit 停止
  • 工具调用支持:人工智能可以决定运行真实的工具(例如天气、数据库)
  • 清洁输出:带格式的答案 rich
  • 重试并优雅退出:对连接问题具有鲁棒性
  • 易于解释和演示:适用于Jupyter/VSCode笔记本

🚀 快速启动

🐍 请确保您已安装Python 3.8+。

1.️⃣ 安装依赖项

pip install ollama mcp rich nest_asyncio

2️⃣ Ensure servers are running
Ollama server (with your chosen model downloaded, e.g., llama3.1:8b)
Gradio MCP server, e.g., http://localhost:7860/gradio_api/mcp/sse
3️⃣ Open the notebook
Copy the big code cell provided.
4️⃣ Run it & chat

Initially prompted: What would you like to know? (or type 'quit' to exit): 

Type questions → get answers!
Type quit to stop.

📦 Requirements
Python 3.8+
ollama Python client
mcp Python client
rich
nest_asyncio

🧰 Why use this?
Combines static AI knowledge with live data
Great demo for non-developers and teams
Clean, notebook-friendly workflow
Easy base for building custom AI agents

📝 License
This project is licensed under the MIT License.

🤝 Contributing
Contributions, feedback, and issues welcome!
If you extend the notebook (more tools, richer UI, etc.), feel free to open a PR.

⭐️ If you find this useful, please star the repo!