LLM
Reading
Resources
Prompt Engineering
Scaffold a Spring Boot application
Generate a Spring Boot service with the following requirements:
1. Use Java 21
2. Use latest Spring Boot GA version
3. Package name: com.example.demo
using Spring Data Rest, PostgreSQL as database
with dependencies: Lombok
with base package: cq.project.reading_companion
with entities:
class Book { String name, String isbn10, String isbn13, Storage storage}
enum Storage { BOX, KINDLE, GOOGLE_PLAY_BOOKS }
class Position { String isbn13, int page, LocalDateTime when }
Java code:
Use the following Lombok annotations whenever applicable:
@Data, @Builder, @NoArgsConstructor, @AllArgsConstructor, @RequiredArgsConstructor
to replace getters, setters, constructors, Builder patterns
Use @EqualsAndHashCode for equals and hashCode methods
Use @Slf4j in all classes to enable logging with SLF4J
For DTO classes
1. Make all fields final
2. Add an all arguments constructor
For constructors or methods with more than 3 arguments, use a new line for every argument
Use var for local variable declaration
Testing:
Use AssertJ for assertions and matchers
Use Testcontainers for integration testing, don't use H2 or any embedded DB
Use @RequiredArgsConstructor for constructor injection for Spring beans,
Use Objects.toString to convert row values if String is needed
For JPA entities:
Use @JdbcType(PostgreSQLEnumJdbcType.class) for mapping PostgreSQL enums
Remove all comments in the source code
Framework for LLM use case evaluation
Type of customer need | Example | ML Implementation (Yes/No/Depends) | Type of ML Implementation |
---|---|---|---|
Repetitive tasks where a customer needs the same output for the same input | Add my email across various forms online | No | Creating a rules-based system is more than sufficient to help you with your outputs |
Repetitive tasks where a customer needs different outputs for the same input | The customer is in “discovery mode” and expects a new experience when taking the same action: - Generate a new artwork per click - StumbleUpon style exploration | Yes | - Image generation LLMs - Recommendation algorithms (collaborative filtering) |
Repetitive tasks where a customer needs the same/similar output for different inputs | - Grading essays - Generating themes from customer feedback | Depends | If simple: rules-based system works. If complex combinations: - Classifiers - Topic modelling Use LLMs for patternless or one-off cases |
Repetitive tasks where a customer needs different outputs for different inputs | - Answering customer support questions - Search | Yes | Too many permutations for rules-based systems. Consider: - LLMs with retrieval-augmented generation (RAG) - Decision trees for products such as search |
Non-repetitive tasks with different outputs | Review of a hotel/restaurant | Yes | Pre-LLMs needed specialized models: - Recurrent neural networks (RNNs) - LSTMs LLMs are a great fit for this type of scenario |