llm-apps-java-spring-ai
llm-apps-java-spring-ai copied to clipboard
Samples showing how to build Java applications powered by Generative AI and LLMs using Spring AI and Spring Boot.
LLM Applications with Java and Spring AI
Samples showing how to build Java applications powered by Generative AI and LLMs using Spring AI.
Pre-Requisites
- Java 21
- Docker/Podman
- Mistral AI API Key (optional)
- OpenAI API Key (optional)
- Ollama (optional)
Content
0. Use Cases
| Project | Description |
|---|---|
| question-answering-with-documents | Question answering with documents using LLMs via Ollama. |
1. Chat Completion Models
| Project | Description |
|---|---|
| chat-models-mistral-ai | Text generation with LLMs via Mistral AI. |
| chat-models-ollama | Text generation with LLMs via Ollama. |
| chat-models-openai | Text generation with LLMs via OpenAI. |
2. Prompts, Templates and Multimodality
| Project | Description |
|---|---|
| prompts-basics-ollama | Prompting using simple text with LLMs via Ollama. |
| prompts-basics-openai | Prompting using simple text with LLMs via OpenAI. |
| prompts-messages-ollama | Prompting using structured messages and roles with LLMs via Ollama. |
| prompts-messages-openai | Prompting using structured messages and roles with LLMs via OpenAI. |
| prompts-multimodality-ollama | Multimodality to include various media in a prompt with LLMs via Ollama. |
| prompts-multimodality-openai | Multimodality to include various media in a prompt with LLMs via OpenAI. |
| prompts-templates-ollama | Prompting using templates with LLMs via Ollama. |
| prompts-templates-openai | Prompting using templates with LLMs via OpenAI. |
3. Output Converters
| Project | Description |
|---|---|
| output-converters-ollama | Converting the LLM output to structured objects (Beans, Map, List) via Ollama. |
| output-converters-openai | Converting the LLM output to structured objects (Beans, Map, List) via Open AI. |
4. Embedding Models
| Project | Description |
|---|---|
| embedding-models-mistral-ai | Vector transformation (embeddings) with LLMs via Mistral AI. |
| embedding-models-ollama | Vector transformation (embeddings) with LLMs via Ollama. |
| embedding-models-openai | Vector transformation (embeddings) with LLMs via OpenAI. |
| embedding-models-transformers | Vector transformation (embeddings) with LLMs via ONNX Sentence Transformers. |
5. Document ETL Pipeline
| Project | Description |
|---|---|
| document-readers-json-ollama | Reading and vectorizing JSON documents with LLMs via Ollama. |
| document-readers-pdf-ollama | Reading and vectorizing PDF documents with LLMs via Ollama. |
| document-readers-text-ollama | Reading and vectorizing text documents with LLMs via Ollama. |
| document-transformers-metadata-ollama | Enrich documents with keywords and summary metadata for enhanced retrieval via Ollama. |
| document-transformers-splitters-ollama | Divide documents into chunks to fit the LLM context window via Ollama. |
6. Vector Stores
Coming soon
7. Function Calling
| Project | Description |
|---|---|
| function-calling-mistral-ai | Function calling with LLMs via Mistral AI. |
| function-calling-openai | Function calling with LLMs via OpenAI. |
8. Image Models
| Project | Description |
|---|---|
| image-models-openai | Image generation with LLMs via OpenAI. |
9. Audio Models
| Project | Description |
|---|---|
| audio-models-speech-openai | Speech generation with LLMs via OpenAI. |
| audio-models-transcription-openai | Speech transcription with LLMs via OpenAI. |
References and Additional Resources
Videos
- Building Intelligent Applications With Spring AI by Dan Vega (JetBrains Live Stream)
- Making your @Beans Intelligent by Mark Pollack (Devoxx Belgium 2023)
- Spring AI Series by Dan Vega
- Spring AI Series by Craig Walls
- Spring Tips: Spring AI by Josh Long