🚀 Spring AI HunYuan 是基于 Spring AI 框架的腾讯云混元大模型集成库,为 Java 开发者提供简单易用的 AI 应用开发体验。
- 🎯 开箱即用 - 基于 Spring Boot 自动配置,零配置快速集成
- 💬 多模态对话 - 支持文本对话、图片理解、流式响应
- 🧠 智能嵌入 - 提供高质量的文本向量化服务
- 🔧 函数调用 - 支持工具函数调用,构建智能应用
- ⚡ 高性能 - 基于 Spring AI 框架,性能优异
- 🛡️ 企业级 - 支持重试、监控、安全认证等企业特性
| 功能 | 状态 | 说明 |
|---|---|---|
| 💬 Chat 对话 | ✅ | 支持 HunYuan 模型,流式和非流式响应 |
| 🖼️ 图片理解 | ✅ | 支持本地图片和网络图片分析 |
| 🧠 Embedding | ✅ | 文本向量化,支持批量处理 |
| 🔧 函数调用 | ✅ | 支持工具函数调用和结构化输出 |
| 🧩 Chain of Thought | ✅ | 思考链模式,提升推理能力 |
| 📊 使用统计 | ✅ | 完整的 Token 使用量统计 |
- JDK: 17 或更高版本
- Maven: 3.8 或更高版本
- Spring Boot: 3.3.3 或更高版本
- 腾讯云账号: 需要开通 HunYuan 服务并获取 API 密钥
在你的 Spring Boot 项目的 pom.xml 中添加以下依赖:
<dependency>
<groupId>io.github.studiousxiaoyu</groupId>
<artifactId>spring-ai-starter-model-hunyuan</artifactId>
<version>1.0.0.2</version>
</dependency>在 application.yml 或 application.properties 中配置 HunYuan 参数:
application.yml:
spring:
ai:
hunyuan:
secret-id: 你的-secret-id
secret-key: 你的-secret-key
chat:
options:
model: hunyuan-pro
temperature: 0.7
max-tokens: 2048
embedding:
options:
model: hunyuan-embedding
dimensions: 1024application.properties:
spring.ai.hunyuan.secret-id=你的-secret-id
spring.ai.hunyuan.secret-key=你的-secret-key
spring.ai.hunyuan.chat.options.model=hunyuan-pro
spring.ai.hunyuan.chat.options.temperature=0.7
spring.ai.hunyuan.chat.options.max-tokens=2048
spring.ai.hunyuan.embedding.options.model=hunyuan-embedding
spring.ai.hunyuan.embedding.options.dimensions=1024| 配置项 | 默认值 | 说明 |
|---|---|---|
spring.ai.hunyuan.secret-id |
- | 腾讯云 Secret ID(必填) |
spring.ai.hunyuan.secret-key |
- | 腾讯云 Secret Key(必填) |
spring.ai.hunyuan.chat.options.model |
hunyuan-pro |
使用的聊天模型 |
spring.ai.hunyuan.chat.options.temperature |
0.7 |
温度参数,控制输出随机性 |
spring.ai.hunyuan.chat.options.max-tokens |
2048 |
最大输出 token 数 |
spring.ai.hunyuan.chat.options.top-p |
0.8 |
Top-p 采样参数 |
| 配置项 | 默认值 | 说明 |
|---|---|---|
spring.ai.hunyuan.embedding.options.model |
hunyuan-embedding |
使用的嵌入模型 |
spring.ai.hunyuan.embedding.options.dimensions |
1024 |
嵌入向量维度 |
spring-ai-hunyuan/
├── spring-ai-hunyuan-core/ # 核心实现
│ ├── api/ # API 接口定义
│ ├── chat/ # 聊天功能
│ ├── metadata/ # 元数据
│ └── aot/ # AOT 支持
├── spring-ai-autoconfigure-model-hunyuan/ # 自动配置
└── spring-ai-starter-model-hunyuan/ # Starter 模块
我们欢迎所有形式的贡献!请遵循以下步骤:
git clone https://github.com/你的用户名/spring-ai-hunyuan.git
cd spring-ai-hunyuangit checkout -b feature/你的功能名称git commit -m "feat: 添加新功能"git push origin feature/你的功能名称- 遵循 Spring 代码风格
- 添加必要的单元测试
- 更新相关文档
- 确保所有测试通过
本项目基于 Apache License 2.0 开源协议。
- 作者: JunYu Guo
- 邮箱: 1316356098@qq.com
- GitHub: @StudiousXiaoYu
- 项目地址: https://github.com/StudiousXiaoYu/spring-ai-hunyuan
⭐ 如果这个项目对你有帮助,请给我们一个 Star!
Made with ❤️ by StudiousXiaoYu