This repository contains a Spring Boot application that demonstrates the integration of multiple Large Language Models (LLMs) including OpenAI, Anthropic, and Ollama, using the Spring AI library. The project also includes a React-based UI for comparing responses from different models.
SpringAIDemo/
├── src/
│ ├── main/
│ │ ├── java/ # backend code
│ │ ├── resources/ # Application properties and static resources
│ │ └── llm-comparison-ui/ # React frontend application
└── ...
- Integration with multiple LLM providers:
- OpenAI (GPT models)
- Anthropic (Claude models)
- Ollama (Local models)
- REST API endpoints for interacting with each LLM
- React-based user interface for comparing model responses side-by-side
- Configurable prompts and model parameters
- Java 17 or higher
- Maven 3.6 or higher
- Node.js and npm (for the React UI)
- API keys for OpenAI and Anthropic
- Ollama installed locally
-
Clone the repository.
-
Configure your API keys in
application.propertiesor via environment variables:spring.ai.openai.api-key=your_openai_key spring.ai.anthropic.api-key=your_anthropic_key # Other configuration properties...
-
Build the Spring Boot application:
mvn clean package -DskipTests
-
Navigate to the React UI directory:
cd src/main/llm-comparison-ui -
Install dependencies:
npm install
-
Build the UI:
npm run dev