TDC - The Developers Conference - The Trinity in GenAI - Spring AI, LangChain4J and OpenAI

juarezjunior 27 views 30 slides Mar 11, 2025
Slide 1
Slide 1 of 30
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30

About This Presentation

TDC - The Developers Conference - The Trinity in GenAI - Spring AI, LangChain4J and OpenAI


Slide Content

ORACLE

TDC FLORIPA

A Trindade em GenAl -
Spring Al, LangChain4J e
OpenAl

Juarez Barbosa Junior @juarezjunior » DEVELOPER" S
Sr Principal Java Developer Evangelist CONFERENCE
12 de Junho de 2024

CentroSul - Florianópolis, SC, Brasil a

[9] ojuarezjunior Juarez Barbosa Junior
Senior Principal Java Developer Evangelist @ Oracle

+ Coming from Dublin, Ireland

. = years of experience in SW Engineering & DevRel
Oracle, Microsoft, IBM, Nokia, Unisys, Accenture, startups
+ Microsoft Azure Developer Relations Lead
+ IBM Watson Tech Evangelist & Cloud Rockstar
+ IBM Mobile Tech Evangelist & Global Thought Leader
+ Nokia Developers Global Champion
+ Java, Python, Cloud, DevOps, SRE, Cloud-native, loT, Al,
Blockchain, Rust
+ Speaker at conferences

+ Oracle CloudWorld, Oracle Code, Microsoft Ignite & TechX, jPrime,
JCON, DevConf.cz, GeeCon, DevOpsDays, DeveloperWeek,
DevOps Institute, CloudLand, DWX, The Developer's Conference
(TDC), Sec4Dev, JSNation, NodeConf, Conf42, Shift Conf, Global
Azure, Open-Source Lisbon, CodeFrenzy, Mélée Numérique,
React Summit, Tests Summit, Porto TechHub Conf, Pyjamas,
MiTechCon, Data Science Summit, OSN, JUGs, meetups,

hackathons.

Agenda

» Aland GenAl - Synthetic Content

+ Artificial Intelligence and GenAl

+ OpenAl

+ LangChain4J

+» Spring Al

+ GenAl with the Oracle Database 23ai
+ Demos

+ Technical References

« Audience: Business and Technical
audiences (not necessarily Machine
Learning Engineers)

Florianópolis pictured in a futuristic
Al and GenAl — cityscape

Synthetic Content

Artificial Intelligence and GenAl

. Core concepts in a nutshell

+ GenAl - Artificial intelligence algorithms and transformer
models with the capability of generating content.

+ Content - Text, images, videos, code, and others.
+ Generation - a result of an input prompt (prompt engineering).

+ Ethical issues — misuse, deep fakes, bias and discrimination,
automation and job replacements, cybersecurity and
cybercriminals.

Artificial Intelligence and GenAl

. Core concepts in a nutshell

+ Apps - Applied currently in the fields of content development,
entertainment, drug discovery, software development,
healthcare, material generation sciences, and others.

« Alis now a commodity!
+ Artificial General Intelligence (AGI) Research - ultimate goal

OpenAl Wegen

- Generative Al with OpenAl
+ Natural Language Processing (NLP)

+ Powerful, pre-trained and customizable Machine Learning
Models

+ OpenAl API (REST interface)
+ Scalable infrastructure (GPUs)
« https://openai.com/sora

LangChain4J

. LangChain4J
+ Easy interaction with LLMs and Vector Stores

+ All major commercial and open-source LLMs and Vector Stores are easily
accessible through a unified API

« Easy integration with Java frameworks - Quarkus and Spring Boot
+ Al Services, RAG, Tools, Chains
+ https://docs.langchain4j.dev/

© spring

Spring Al (1.0.0 M1)

- Spring Al (Al Concepts)

+ A Java app framework for building Al-related applications. It provides a robust
abstraction layer that encapsulates many of the complexities required to interact with
various GenAl providers, such as OpenAl, Cohere, Google Vertex Al/Gemini, and
others.

+ API support across Al providers for chat, text-to-image, and embedding models.

Its goal is to apply to the Al domain Spring ecosystem design principles such as
portability and modular design and promote using POJOs as the building blocks of an
application to the Al domain.

+ https://spring.io/projects/spring-ai

© spring

- RAG (Retrieval-Augment Generation) with Spring Al

Spring Al

+ LLMs' baseline knowledge might have gaps based on their training data. If you ask
an LLM to write about a recent trend or event, the LLM won't know what you're
talking about, so you may get meaningless responses.

+ There's a way to provide LLMs with additional information (including business-
specific data)- that is what RAG is for!

+ Oracle - What Is Retrieval-Augmented Generation (RAG)?
+ Oracle - What Is Generative Al? How Does It Work?

© spring

- RAG (Retrieval-Augment Generation) with Spring Al
+ In a nutshell, RAG is a technique that:
+ Reads unstructured data;
+ Converts the data into tokens;

+ It uses embeddings to transform the tokens into floating-point
arrays or vectors so that LLM can process and interpret them;

Spring Al

+ It stores the vectors in Vector Databases.

© spring

- The Spring Al API covers a wide range of functionalities
+ Chat Completion API
« Embeddings API
+ Image Generation API
+ Speech / Transcription API
+ Vector Databases
+ Function Calling API

Spring Al

Spring Al

- Spring Al - Blazingly Fast Performance
+ GraalVM

Native Image - compile Java code ahead
of time (AOT) to a binary - a native
executable

Developing an Oracle JDBC app with
GraalVM Native Image

mvn -Pnative native:compile
./target/spring-ai-graalvm-oai.exe

plugin
<groupId»org.graalvm.buildtoo1s</grouptd»
<arti factrdonative-maven-pluginc/artifact1é>
<configuration»
<buildargs>
<buildargo-o ./target/spring-ai-graalvm-oaif//buildarg>
<Jouildangs>
</configuration>
</plugin>

© spring

Copyright © 2024, Oracle and/or its affiliates

© spring

Spring Al

- Spring Al - Blazingly Fast Performance
+ Spring with Virtual Threads

- Add the following entry in the application.properties file:
spring.threads.virtual.enabled=true

+ Class VirtualThreadTaskExecutor
+ Embracing Virtual Threads

- All together now: Spring Boot 3.2, GraalVM native images, Java 21, and
virtual threads with Project Loom

Copyright © 2024, Oracle and/or its affiliates

Wy
New | Oracle Database 23ai CZ

Next-Generation Converged Database Services

Over 300 major new features plus thousands of enhancements
Available on OCI and Azure
Major focus on

+ Al for Data features

ai
+ Developer/Analyst features Database 23

+ Mission-Critical features

Addresses data management pain points that have frustrated customers forever

Oracle Database 23ai - Al for Data

Algorithmic Al

TR

Distributed Al



Pad
dz

—+

Al Vector Search Augmented Generative Al (LLMs)

a

Al Storage Al Developer Tools

Oracle Database 23ai - Dev for Data

SÉËE
JSON Relational
Duality Views

sed

Data Intent
Language

Lock-free Consistent Updates,
Long-running Transactions

JavaScript
Stored Procedures

Oracle Database 23ai - Mission-Critical Data

Hl,
EFT
RAFT Replication for
Globally Distributed Database

Ebo

Priority
Transactions

Cape ©2024 Once a/a

NN
soi © ©

Real-Time SQL Plan
Management

RAC, Exadata, Data Guard
Simplicity and Scalability

So

In-Database
Firewall

saL

Analytic SQL
Simplicity and Scalability

Free | Oracle Database 23ai For Developers

Oracle Always Free ADB ADB Free Container Image Oracle Database Free

Available on OCI Available for download Available as RPM, Docker
Image, VBox VM

Very Low Cost Supported Developer Edition of ADB, BaseDB, ExaDB-D, and ExaDB-C@C

Cape © 2024 Orca o/o as Cor ral

Experimente o poder da IA
gratuitamente na nuvem
Conheca os recursos de lA e ML da Oracle Cloud
com o Modo Gratuito.
Sáo US$ 500 em créditos para vocé usar

durante 30 dias - uma condiçäo EXCLUSIVA
para visitantes do TDC Floripa!

Confidential - Oracle Restricted

Demos

Confidential: Oracle Restricted

Reference Architecture for GenAl
MIC TO
[search apı | chatapı | Prompt ut |

a oros … Reference
= ER |. ES

oon (en En = Architecture
DM

=
=
Se el oe for GenAl Apps

Doe
=
rn ee

=

Source: Architectural Approach for Building Generative Al Applications

Image Generation - Spring Al with Open Al

TITAN

- Demo - Direct LLM calls - Image Generation

Chatbot - Spring Al with Open Al

IT |

. Demo - Direct LLM calls - Chatbot

RAG - Retrieval Augment Generation
Spring Al with Open Al and Oracle Database 23ai

TITAN

- Demo - RAG
- Spring Al + SimpleVectorStore + Open Al

. Spring Al + OracleVectorStore + OpenAl + Oracle
Database 23ai

Multimodality - Spring Al with Open Al

IT |

- Demo - Multimodality - Spring Al with Open Al

Function Calling - Spring Al with Open Al

TITAN

- Demo -Function Calling - Spring Al with Open Al

Confidential - Oracle Restricted

Technical References

Spring Al - https://spring.io/projects/spring-ai

OpenAl - https://openai.com/

Oracle Al Vector Search - https://rb.gv/sp41uk

Oracle Al Vector Search for Java Developers with the Oracle Database 23ai -

https://rb.gv/7ivwxr

E u / JDBC - https://www.oracle.com/jdbc
Introduction to Oracle JDBC Driver Support for Virtual Threads - https://bit.ly/3UINJWP

+ Developing an Oracle JDBC app with GraalVM Native Image - https://rb.sv/iy3sgh

+ Getting Started with Reactive Relational Database Connectivity and the Oracle R2DBC
Driver - https://rb.gy/42dnz5

* Getting Started with the Java library for Reactive Streams Ingestion (RSI) -
https://bit.ly/3rEiRnC

+ Introduction to JDBC Reactive Extensions with the Oracle Database — Developer
Release - https://rb.; xirbx

+ Pipelined Database Operations - https://rb.gv/ivössh

Juarez Junior

Y | @juarezjunior

ORACLE