更新 SpringAI/0_Java语言接入AGI基础篇.md

This commit is contained in:
8ga 2025-03-15 21:37:38 +08:00
parent f972811a69
commit 6cb26e3116

View File

@ -26,10 +26,53 @@ ollama run hf-mirror.com/deepseek-ai/deepseek-r1:7b
## 什么是SpringAI
官方文档地址https://spring.io/projects/spring-ai 我这里直接贴上官方的定位:
- 官方文档地址https://spring.io/projects/spring-ai
- Github仓库地址https://github.com/spring-projects/spring-ai
官方的定位:
> Spring AI is an application framework for AI engineering. Its goal is to apply to the AI domain Spring ecosystem design principles such as portability and modular design and promote using POJOs as the building blocks of an application to the AI domain.
翻译Spring AI 是一个用于 AI 工程的应用程序框架。 其目标是将 Spring 生态系统设计原则(如可移植性和模块化设计)应用于 AI 领域,并将使用 POJO 构建应用程序推广到 AI 领域。
<img src='https://images.ctfassets.net/mnrwi97vnhts/4mda205vy509Dx3vGkMwFr/af520e66dc79fb80cd1bc129a11d6d23/spring-ai-integration-diagram-3.svg'>
Spring AI 的核心是解决企业如何集成 AI 模型。
## Spring AI的功能
- 对 AI 模型供应商的支持例如DeepSeek、QwenAlibaba、qianfanBaidu、Anthropic、OpenAI、Microsoft、Amazon、Google、Ollama。支持的模型类型有
+ [Chat Completion](https://docs.spring.io/spring-ai/reference/api/chatmodel.html):聊天模型
+ [Embedding](https://docs.spring.io/spring-ai/reference/api/embeddings.html):嵌入模型
+ [Text to Image](https://docs.spring.io/spring-ai/reference/api/imageclient.html):文生图
+ [Audio Transcription](https://docs.spring.io/spring-ai/reference/api/audio/transcriptions.html):音频转换
+ [Text to Speech](https://docs.spring.io/spring-ai/reference/api/audio/speech.html):文字转语音
+ [Moderation](https://docs.spring.io/spring-ai/reference/api/index.html#api/moderation):内容审核
- [结构化输出](https://docs.spring.io/spring-ai/reference/api/structured-output-converter.html)就像是传统应用的ORM一样把AI模型的输出内容映射到POJO。
- 对向量数据库的支持以及跨向量存储的便携式API包括一种新颖的类似SQL的 Metadata Filter API对向量数据库的支持包括
+ Apache Cassandra
+ Azure Cosmos DB
+ Azure Vector Search
+ Chroma
+ Elasticsearch
+ GemFire
+ MariaDB
+ Milvus
+ MongoDB Atlas
+ Neo4j
+ OpenSearch
+ Oracle
+ PostgreSQL/PGVector
+ PineCone
+ Qdrant
+ Redis
+ SAP Hana
+ Typesense
+ Weaviate
- [Tools/Function Calling}(https://docs.spring.io/spring-ai/reference/api/functions.html):允许模型请求执行客户端工具和函数,从而按需访问必要的实时信息。
- [Observability](https://docs.spring.io/spring-ai/reference/observability/index.html)提供对AI相关操作的可观测性。
- 用于数据工程的文档注入 [ETL 框架](https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html)
- [AI 模型评估](https://docs.spring.io/spring-ai/reference/api/testing.html):帮助评估生成的内容并防止幻觉响应的实用程序。
- [ChatClient](https://docs.spring.io/spring-ai/reference/api/chatclient.html):用于与 AI 聊天模型通信的链式调用API类似于 WebClient 和 RestClient。
- [Advisors](https://docs.spring.io/spring-ai/reference/api/advisors.html)封装了常见的生成式AI使用模式能够转换发送至语言模型LLMs及从模型接收的数据并确保在不同模型和应用场景间的兼容性和可移植性。
- 支持 Chat Conversation Memory and Retrieval Augmented Generation RAG