# spring-ai-sample **Repository Path**: ai-sample/spring-ai-sample ## Basic Information - **Project Name**: spring-ai-sample - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-28 - **Last Updated**: 2025-10-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Spring AI 示例项目 本项目是一个基于 Spring AI 的示例项目,展示了如何使用 Spring AI 进行各种任务。 ## 功能特性 - 使用 Model Context Protocol (MCP) 实现客户端和服务器端通信 - 支持多种 AI 模型,包括 Ollama 和 OpenAI - 提供向量存储功能,支持 Elasticsearch、Milvus、Neo4j 和 Redis - 实现了文本到 SQL 的转换功能 - 包含一个简单的 12306 系统示例 ## 项目结构 ``` spring-ai-sample/ ├── spring-ai-mcp # MCP 相关功能实现 ├── spring-ai-model # AI 模型相关功能 ├── spring-ai-other # 其他功能模块 └── spring-ai-vectorstore # 向量存储实现 ``` ## 安装与运行 1. 确保已安装 Java 17 或更高版本 2. 克隆项目:`git clone https://gitee.com/ai-sample/spring-ai-sample` 3. 进入项目目录:`cd spring-ai-sample` 4. 构建项目:`mvn clean install` 5. 运行具体模块,例如运行 Ollama 示例:`cd spring-ai-model/ollama && mvn spring-boot:run` ## 使用示例 - 运行 Ollama 示例应用: ```java cd spring-ai-model/ollama mvn spring-boot:run ``` 访问 `http://localhost:8080/chat/generate?message=你好` 获取 AI 生成的回复 - 运行文本到 SQL 示例: ```java cd spring-ai-other/spring-ai-text2sql mvn spring-boot:run ``` 发送 POST 请求到 `http://localhost:8080/query`,请求体为 `{"question": "查询所有用户"}` ## 贡献指南 欢迎贡献代码!请遵循以下步骤: 1. Fork 本仓库 2. 创建新分支 (`git checkout -b feature/your-feature`) 3. 提交更改 (`git commit -am 'Add some feature'`) 4. 推送至分支 (`git push origin feature/your-feature`) 5. 创建 Pull Request ## 许可证 本项目使用 Apache-2.0 许可证。详情请查看 LICENSE 文件。