使用说明
MCP服务器
你的人工智能助手可以帮助用户根据偏好规划旅行,例如:预算旅行日期兴趣(自然、历史、食物)免签证国家(可选)该助手使用OpenAI的GPT模型进行响应,但通过MCP保持上下文,使对话多回合和个性化。
🧠 使用Meta Calame 3(Groq)的LLM聊天API
一个轻量级Flask API,使用Groq的blazing-fast推理后端连接到Meta的LLaMA 3-70B模型。专为希望有一个简单的本地端点与LLM聊天的开发人员而构建。
🚀 特性
- 🦙 Meta Calma 3-70b通过Groq
- ⚡ 超快速响应时间
- 🧪 带烧瓶的REST API
- 🔐 API密钥管理
.env - 🧰 与Postman或curl兼容
📦 需求
- Python 3.9+
- Groq API密钥来自 https://console.groq.com
📁 项目结构
llm聊天api/ ├── app.py ├── .env ——.gitignore ├── 需求.txt └── README.md
格式 复制 编辑
🛠 设置
# Clone repo
git clone https://github.com/your-username/llm-chat-api.git
cd llm-chat-api
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
🔐 Add your Groq API key
Create a .env file:
ini
Copy
Edit
GROQ_API_KEY=your-groq-api-key-here
▶️ Run the API
bash
Copy
Edit
python app.py
Visit: http://127.0.0.1:5000
🧪 Usage
Endpoint
http
Copy
Edit
POST /chat
Content-Type: application/json
Example Request
json
Copy
Edit
{
"session_id": "user-123",
"message": "Hello!"
}
Example Response
json
Copy
Edit
{
"reply": "Hello! How can I assist you today?"
}
🧪 curl Test
bash
Copy
Edit
curl -X POST http://127.0.0.1:5000/chat \
-H "Content-Type: application/json" \
-d '{"session_id":"user-123","message":"Hello"}'
📄 .gitignore
gitignore
Copy
Edit
.env
venv/
__pycache__/
*.pyc
📄 requirements.txt
txt
Copy
Edit
flask
python-dotenv
openai
📘 License
MIT License
🙌 Credits
Meta LLaMA 3
Groq API
yaml
Copy
Edit
---
Let me know if you want to add badges, Docker setup, or GitHub Actions next
