Content
# Len AI Agent - AI Super Intelligence
An intelligent AI interaction system built based on Spring AI and LangChain4j, supporting multiple large model access, knowledge base Q&A, and tool calling capabilities.
## Project Overview
Len AI Agent is an intelligent agent project centered around AI development, aiming to provide powerful AI interaction capabilities, including:
- Multi-turn dialogue and contextual memory
- Knowledge base Q&A (RAG)
- Tool calls and intelligent planning
- MCP service integration
- Multi-modal application support
The project integrates mainstream AI large models, such as Alibaba Cloud DashScope's Tongyi Qianwen, Ollama local deployment models, etc., and supports multiple AI frameworks, enabling developers to quickly build intelligent applications.
## Technical Stack
- **Basic Framework**: Java 21 + Spring Boot 3.4.5
- **AI Framework**: Spring AI + LangChain4j
- **AI Model Access**:
- Alibaba Cloud DashScope (Tongyi Qianwen)
- Ollama (local deployment model)
- **Tools and Libraries**:
- Knife4j (API documentation)
- Hutool (tool class library)
- Lombok (code simplification)
- **Service Configuration**: Supports multi-environment configuration (local, dev, prod)
## Core Features
### 1. Multiple Ways to Call AI Large Models
- Spring AI framework integration
- LangChain4j chain call
- Native SDK call
- Custom HTTP call
### 2. Knowledge Base Q&A (RAG)
- Supports access to local knowledge base
- Supports vector database retrieval
- Provides context-enhanced query
### 3. Intelligent Tool Calls
- File operation
- Internet search
- Webpage crawling
- Resource download
- PDF generation
### 4. MCP Service Capability
- Custom MCP service development
- Image search service
- Supports multiple call methods
### 5. Intelligent Agent Planning Capability
- Autonomous planning based on ReAct mode
- Multi-step task execution
- Task status tracking
## Project Structure
```
len-ai-agent/
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── lenyan/
│ │ │ └── lenaiagent/
│ │ │ ├── controller/ # Interface controller
│ │ │ ├── demo/ # Sample code
│ │ │ │ └── invoke/ # Different call method examples
│ │ │ ├── config/ # Configuration class
│ │ │ ├── service/ # Service implementation
│ │ │ ├── model/ # Data model
│ │ │ └── LenAiAgentApplication.java # Startup class
│ │ └── resources/
│ │ ├── application.yml # General configuration
│ │ └── application-local.yml # Local environment configuration
│ └── test/ # Test code
└── pom.xml # Project dependency
```
## Quick Start
### Environment Requirements
- JDK 21+
- Maven 3.8+
- IDE: IntelliJ IDEA (recommended)
### Local Run
1. **Clone Project**
```bash
git clone https://github.com/yourusername/len-ai-agent.git
cd len-ai-agent
```
2. **Configure API Key**
Modify the API key in the `src/main/resources/application-local.yml` file:
```yaml
spring:
ai:
dashscope:
api-key: Your DashScope API Key
```
3. **Local Large Model Deployment (Optional)**
If you need to use a local large model, install and start Ollama:
```bash
# Install Ollama and pull the model
ollama pull deepseek-r1:7b
# Start the service (default port 11434)
ollama serve
```
4. **Start the Application**
```bash
mvn spring-boot:run -Dspring-boot.run.profiles=local
```
5. **Access API Documentation**
Open the browser and visit [http://localhost:8102/api/swagger-ui.html](http://localhost:8102/api/swagger-ui.html)
## Sample Code
### Spring AI Framework Call
```java
@Resource
private ChatModel dashscopeChatModel;
public String chat(String input) {
AssistantMessage response = dashscopeChatModel.call(new Prompt(input))
.getResult()
.getOutput();
return response.getText();
}
```
### LangChain4j Call
```java
ChatLanguageModel model = QwenChatModel.builder()
.apiKey("your-api-key")
.modelName("qwen-max")
.build();
String answer = model.chat("Hello, I'd like to know more about AI Agent");
```
## Extended Features
- Dialogue memory persistence
- Structured output
- Multi-modal support
- Knowledge base extension
- Custom tool development
- Intelligent agent enhancement
## License
This project uses the [MIT License](LICENSE)
## Contribution Guide
Feel free to submit issues or pull requests!
1. Fork this repository
2. Create a feature branch (`git checkout -b feature/your-feature`)
3. Commit changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin feature/your-feature`)
5. Create a pull request
## Contact
- Project maintainer: [lenyan](https://blog.csdn.net/jgk666666)
- Project discussion group: [xxx xxx]
*This project is an implementation of the "lenAI Super Intelligence" series, aiming to help developers quickly master AI development technology and build intelligent applications.*
Connection Info
You Might Also Like
everything-claude-code
Complete Claude Code configuration collection - agents, skills, hooks,...
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
servers
Model Context Protocol Servers
ai
WordPress AI Experiments plugin for enhancing site functionality with AI.
osint-tools-mcp-server
An MCP Server providing OSINT tools for AI-assisted reconnaissance.
SharpToolsMCP
SharpToolsMCP is an AI-powered service for analyzing and modifying C# code...