Boost AI Agents with Spring AI Alibaba: 20+ RAG Sources & Tool‑Calling Integrations
This article explains how Spring AI Alibaba enables AI agents to leverage Retrieval‑Augmented Generation and Tool Calling by providing over twenty ready‑made RAG data source connectors and more than twenty function‑calling interfaces, along with practical code examples for integrating document readers and weather services.
Why RAG and Tool Calling Matter for AI Agents
RAG (Retrieval‑Augmented Generation) lets agents retrieve up‑to‑date information from external data sources, extending beyond the model's pre‑trained knowledge, while Tool Calling allows agents to invoke external services such as weather, maps, or translation APIs, dramatically widening their real‑world capabilities.
Built‑in RAG Data Sources
The open‑source community now ships more than 20 ready‑to‑use RAG data source connectors, including:
PDF files – automatic text extraction.
Yuque – enterprise document management.
Feishu – retrieve information from the Feishu communication platform.
Cloud OSS – read objects from major cloud storage services.
Web crawler – fetch and parse live web pages.
Supported Function‑Calling Examples
Function Calling covers a wide range of utilities, for example:
Weather forecast – precise meteorological data via a weather API.
Map navigation – location queries and route planning.
DingTalk – enterprise messaging and scheduling.
Financial data – real‑time stock and exchange rates.
Computation tools – complex mathematical operations.
Document Reader Implementations
Spring AI Alibaba defines a DocumentReader abstraction. The community provides dozens of concrete readers, such as arxiv-document-reader, github-document-reader, tencent-cos-document-reader, yuque-document-reader, feishu-document-reader, and many more, covering academic papers, code repositories, cloud storage, and enterprise knowledge bases.
Document Parsers
Various parsers handle different file formats: document-parser-apache-pdfbox – PDF text extraction. document-parser-bshtml – BSHTML documents. document-parser-pdf-tables – table extraction from PDFs. document-parser-bibtex – BibTeX references. document-parser-markdown – Markdown files. document-parser-tika – multi‑format parser supporting PDF, images (OCR), TXT, Markdown, HTML, Word, Excel, PPT, EML/MSG, etc.
Usage Example – Integrating Yuque with RAG
Add the Yuque document reader dependency:
<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>yuque-document-reader</artifactId>
<version>1.0.0-M5.1</version>
</dependency>Configure the token and resource path, then load documents with Tika parsing:
YuQueResource source = YuQueResource.builder()
.yuQueToken(YU_QUE_TOKEN)
.resourcePath(RESOURCE_PATH)
.build();
YuQueDocumentReader reader = new YuQueDocumentReader(source, new TikaDocumentParser());
List<Document> documents = reader.get();Write the documents to a vector store and perform similarity search:
// Write documents to vector store
vectorStore.write(new TokenTextSplitter().transform(documents));
// Retrieve similar documents
vectorStore.similaritySearch("请给我讲一下 Spring AI 开发智能体的优势。")
.forEach(doc -> logger.info("Similar Document: {}", doc.getContent()));Usage Example – Adding a Weather Forecast Plugin
Add the weather function‑calling starter:
<dependency>
<groupId>com.alibaba.cloud.ai</groupId>
<artifactId>spring-ai-alibaba-starter-function-calling-weather</artifactId>
<version>1.0.0-M5.1</version>
</dependency>Invoke the plugin from a ChatClient:
String ans = chatClient.prompt()
.functions("getWeatherServiceFunction")
.user(text)
.call()
.content();Note that the registration name must be exactly getWeatherServiceFunction; any deviation will cause the call to fail.
Conclusion
With more than 20 RAG data source connectors and over 20 tool‑calling interfaces, Spring AI Alibaba lets developers quickly assemble powerful, flexible AI agents without reinventing low‑level integration code, enabling rapid deployment across diverse enterprise scenarios.
Alibaba Cloud Native
We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
