Skip to content

Commit 6d5a3da

Browse files
authored
Recipe for Vector Similarity Search with Redis OM Spring (#74)
* feat: adding roms-vss-movies recipe
1 parent 7016cb1 commit 6d5a3da

File tree

11 files changed

+643
-243
lines changed

11 files changed

+643
-243
lines changed

java-recipes/README.md

Lines changed: 18 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div align="center">
2-
<div><img src="../assets/redis-logo.svg" style="width: 130px"> </div>
2+
<div><img src="../../assets/redis-logo.svg" style="width: 130px"> </div>
33
<h1>Redis AI Java Resources</h1>
44
<div align="center">
55

@@ -15,127 +15,25 @@
1515
<div></div>
1616
<br>
1717

18-
[**Setup**](#setup) | [**Running the Project**](#running-the-project) | [**Notebooks**](#notebooks) | [**Project Structure**](#project-structure) | [**Implementation Details**](#implementation-details)
18+
[**Notebooks**](#notebooks) | [**Applications**](#applications) | [**Example Applications**](#example-applications)
1919

2020
</div>
2121
<br>
2222

23-
## Setup
24-
25-
This project uses Docker Compose to set up a complete environment for running Java-based AI applications with Redis. The environment includes:
26-
27-
- A Jupyter Notebook server with Java kernel support
28-
- Redis Stack (includes Redis and RedisInsight)
29-
- Pre-installed dependencies for AI/ML workloads
30-
31-
### Prerequisites
32-
33-
- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/)
34-
- OpenAI API key (for notebooks that use OpenAI services)
35-
36-
### Environment Configuration
37-
38-
1. Create a `.env` file in the project root with your OpenAI API key:
39-
40-
```bash
41-
OPENAI_API_KEY=your_openai_api_key_here
42-
```
43-
44-
## Running the Project
45-
46-
1. Clone the repository (if you haven't already):
47-
48-
```bash
49-
git clone https://github.com/redis-developer/redis-ai-resources.git
50-
cd redis-ai-resources/java-resources
51-
```
52-
53-
2. Start the Docker containers:
54-
55-
```bash
56-
docker-compose up -d
57-
```
58-
59-
3. Access the Jupyter environment:
60-
- Open your browser and navigate to [http://localhost:8888](http://localhost:8888)
61-
- The token is usually shown in the docker-compose logs. You can view them with:
62-
63-
```bash
64-
docker-compose logs jupyter
65-
```
66-
67-
4. Access RedisInsight:
68-
- Open your browser and navigate to [http://localhost:8001](http://localhost:8001)
69-
- Connect to Redis using the following details:
70-
- Host: redis-java
71-
- Port: 6379
72-
- No password (unless configured)
73-
74-
5. When finished, stop the containers:
75-
76-
```bash
77-
docker-compose down
78-
```
79-
8023
## Notebooks
8124

82-
| Notebook | Description |
83-
| --- | --- |
84-
| [RAG/spring_ai_redis_rag.ipynb](./RAG/spring_ai_redis_rag.ipynb) | Demonstrates building a RAG-based beer recommendation chatbot using Spring AI and Redis as the vector store |
85-
86-
## Project Structure
87-
88-
```bash
89-
java-recipes/
90-
├── .env # Environment variables (create this)
91-
├── docker-compose.yml # Docker Compose configuration
92-
├── jupyter/ # Jupyter configuration files
93-
│ ├── Dockerfile # Dockerfile for Jupyter with Java kernel
94-
│ ├── environment.yml # Conda environment specification
95-
│ ├── install.py # JJava kernel installation script
96-
│ ├── kernel.json # Kernel specification
97-
│ └── java/ # Java dependencies and configuration
98-
│ └── pom.xml # Maven project file with dependencies
99-
└── resources/ # Data files for notebooks
100-
└── beers.json.gz # Compressed beer dataset
101-
```
102-
103-
## Implementation Details
104-
105-
### Java Jupyter Kernel
106-
107-
The project uses [JJava](https://github.com/dflib/jjava), a Jupyter kernel for Java based on JShell. This allows for interactive Java development in Jupyter notebooks.
108-
109-
Key components:
25+
| Notebook | Description |
26+
|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|
27+
| [notebooks/RAG/spring_ai_redis_rag.ipynb](./notebooks/RAG/spring_ai_redis_rag.ipynb) | Demonstrates building a RAG-ba sed beer recommendation chatbot using Spring AI and Redis as the vector store |
11028

111-
- Java 21 for modern Java features
112-
- Maven for dependency management
113-
- JJava kernel for Jupyter integration
29+
## Applications
11430

115-
### Spring AI Integration
31+
| Application | Description |
32+
|-----------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
33+
| [applications/vector-similarity-search/spring_boot](./applications/vector-similarity-search/spring_boot_redis_om_spring.md) | Demonstrates building a vector similarity search application using Spring Boot and Redis OM Spring |
11634

117-
The Spring AI notebooks showcase how to use Spring's AI capabilities with Redis:
11835

119-
- **Spring AI**: Framework for building AI-powered applications
120-
- **Redis Vector Store**: Used for storing and querying vector embeddings
121-
- **Transformer Models**: For generating embeddings locally
122-
- **RAG Pattern**: Demonstrates the Retrieval Augmented Generation pattern
123-
124-
### Docker Configuration
125-
126-
The Docker setup includes:
127-
128-
1. **Jupyter Container**:
129-
- Based on minimal Jupyter notebook image
130-
- Adds Java 21, Maven, and the JJava kernel
131-
- Includes Python environment with PyTorch and other ML libraries
132-
133-
2. **Redis Container**:
134-
- Uses Redis Stack image with Vector Search capabilities
135-
- Persists data using Docker volumes
136-
- Exposes Redis on port 6379 and RedisInsight on port 8001
137-
138-
## Example Applications
36+
## Example Notebooks & Applications
13937

14038
### Beer Recommendation Chatbot
14139

@@ -146,3 +44,11 @@ The `spring-ai-rag.ipynb` notebook demonstrates:
14644
- Connecting to OpenAI for LLM capabilities
14745
- Building a RAG pipeline to answer beer-related queries
14846
- Semantic search over beer properties and descriptions
47+
48+
### Vector Similarity Search with Redis OM Spring and Spring Boot
49+
50+
The `spring_boot_redis_om_spring` directory contains a Spring Boot application that demonstrates how to use Redis OM Spring for vector similarity search. The application allows you to:
51+
- Add movies to the Redis database
52+
- Search for movies based on semantic similarity on the synopsis of the movie
53+
- Perform hybrid search by adding filters to genre, cast, and year
54+

0 commit comments

Comments
 (0)