SlideShare a Scribd company logo
The Trinity in GenAI - Spring AI,
LangChain4J and OpenAI
I Love Tech ROMANIA 2024
Juarez Barbosa Junior @juarezjunior
Sr Principal Java Developer Evangelist
ORACLE
Copyright © 2024, Oracle and/or its affiliates
Juarez Barbosa Junior
Senior Principal Java Developer Evangelist
• Coming from Dublin, Ireland
• 20 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, IoT, AI,
Blockchain, Rust
• Speaker at conferences
• Oracle CloudWorld, Oracle Code, Microsoft Ignite, Microsoft
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, Test.js Summit,
Porto TechHub Conf, Pyjamas, MiTechCon, JUGs, meetups, etc.
@juarezjunior
@juarezjunior
Agenda
• AI and GenAI – Synthetic Content
• Artificial Intelligence and GenAI
• OpenAI, Cohere
• Spring AI
• LangChain4J
• Enabling GenAI with AI Vector Search in
Oracle Database
• Java App Dev with the Oracle Database
• Technical References
• Audience: Business and Technical
audiences (not Machine Learning
Engineers)
Copyright © 2024, Oracle and/or its affiliates
AI and GenAI –
Synthetic Content
Bucharest the Capital of Romania
pictured in a futuristic scenario in one
image
Copyright © 2024, Oracle and/or its affiliates
Artificial Intelligence and GenAI
• Core concepts in a nutshell
• GenAI - 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).
• Training data – dataset
• Apps – Applied currently in the fields of content development, entertainment,
drug discovery, software development, healthcare, material generation
sciences, and others.
• Ethical issues – misuse, deep fakes, bias and discrimination, automation and
job replacements, cybersecurity and cybercriminals.
• AI is now a commodity!
Copyright © 2024, Oracle and/or its affiliates
OpenAI
• Generative AI with OpenAI
• Natural Language Processing (NLP)
• Powerful, pre-trained and customizable Machine Learning Models
• OpenAI API (REST interface)
• Scalable infrastructure (powered by Microsoft Azure)
• Artificial General Intelligence (AGI) Research – ultimate goal
• https://openai.com/sora
Copyright © 2024, Oracle and/or its affiliates
Spring AI
• Spring AI
• Java app framework for building AI-related applications. It encapsulates many
of the complexities required to interact with a number of different GenAI
providers such as OpenAI by providing a robust abstraction layer.
• API support across AI providers for chat, text-to-image, and embedding
models.
• Its goal is to apply to the AI domain Spring ecosystem design principles such
as portability and modular design and promote using POJOs as the building
blocks of an application to the AI domain.
• https://spring.io/projects/spring-ai
Copyright © 2024, Oracle and/or its affiliates
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
• AI Services, RAG, Tools, Chains
• https://docs.langchain4j.dev/
Copyright © 2024, Oracle and/or its affiliates
Enabling Generative AI
with AI Vector Search in
Oracle Database
Recap on background behind semantic search and
Generative AI leveraging Oracle AI Vector Search
9 Copyright © 2024, Oracle and/or its affiliates
The following is intended to outline our general product
direction. It is intended for information purposes only, and may
not be incorporated into any contract. It is not a commitment to
deliver any material, code, or functionality, and should not be
relied upon in making purchasing decisions. The development,
release, timing, and pricing of any features or functionality
described for Oracle’s products may change and remains at the
sole discretion of Oracle Corporation.
The materials in this presentation pertain to Oracle Health, Oracle, Oracle Cerner, and Cerner Enviza which are all wholly owned
subsidiaries of Oracle Corporation. Nothing in this presentation should be taken as indicating that any decisions regarding the
integration of any EMEA Cerner and/or Enviza entities have been made where an integration has not already occurred.
10 Copyright © 2024, Oracle and/or its affiliates
Generative AI and AI Vector Search Democratizes AI
Using Vector Databases plus LLMs is SIMPLE
• No longer requires data scientists to build AI solution
• Use standard pre trained embedding models
• Generate vectors, add to private Vector Database
• Augment LLM search with private knowledge
AI vector search is SUPERFAST
• In order to provide AI responses in real time
11 Copyright © 2024, Oracle and/or its affiliates
Finding what you’re looking for can be challenging…
Copyright © 2024, Oracle and/or its affiliates
12
I have a photo of an
artwork, but don’t know
the artist or work’s name
I heard a catchy tune
and can even hum a
few bars, but don’t
know the title or artist
I got this error message
ORA-XXXX, but don’t
know how to resolve it
A technology called Vector Search
enables end-user questions
to be mapped to relevant data
in your database
Copyright © 2024, Oracle and/or its affiliates
13
Vector search continues to evolve…
Copyright © 2024, Oracle and/or its affiliates
14
Vector Space Model
1960s – 1970s
Word Embeddings
e.g., LSA and LDA
2000s
Deep Learning Era
e.g., Word2Vec and GloVe
2010s
Efficient Search Algorithms
e.g., ANN, HNSW, PQ, Annoy
2010s
Transformers and Contextual Embeddings
e.g., BERT, GPT, etc.
late 2010s
33
42
16
21
50
Early Multidimensional Indexing
e.g., KD trees, R-trees, Ball trees
1970s – 1990s
Dedicated Vector Databases
e.g., Milvus, Pinecone, Vespa
late 2010s …
Relational Database
Integration
e.g., Oracle
late 2010s – 2020s
Vectors in AI represent semantics of
unstructured data such as images, documents, videos, etc.
A vector is a sequence of
numbers, called dimensions,
used to capture the important
"features" of the data
Vectors represent the semantic
content of data, not the
underlying words or pixels
Vectors generated using deep
learning embedding models
Vector
33
42
16
21
50
Copyright © 2024, Oracle and/or its affiliates
15
Word relatedness in two dimensions
An intuitive example
Copyright © 2024, Oracle and/or its affiliates
16
blackberry
strawberry
apple
raspberry
pear
plum
cat
kitten
dog
puppy
wolf
lion
Maine
Vermont
New York
kiwi
d1
d2
elephant
tiger
Convert an image to one or more vector embeddings and search vector database
Embeddings for images
Copyright © 2024, Oracle and/or its affiliates
17
0.5, 1.5, 2.6, -1.1, …
Compare these against other
vectors in the database to find
similar content
Generating embeddings
Use an embedding model
18 Copyright © 2024, Oracle and/or its affiliates
Text documents
Natural Language
Embedding
Model
Images
Image
Embedding
Model
Text Vector Table
id vector Image
1 [0.5, 1.5, 2.6, -1.1, …]
2 [1.0, 0.9, 1.6, -1.3, …]
3 [0.6, 1.1, 1.3, -0.9, …]
… … …
Image Vector Table
id vector text
1 [0.8, 0.5, 1.6, -2.5, …] “It was the best of times, it was the
worst of times, it was..”
2 [1.1, 0.3, 0.6, -1.3, …] “It is a truth universally
acknowledged, that a single man..”
3 [1.3, 0.1, 0.2, -1.1, …] “It was a bright cold day in April,
and the clocks were striking..”
… … …
Simple vector search
Pipeline
19 Copyright © 2024, Oracle and/or its affiliates
Embedding
Model
Input Data
Object
Data Object Retrieval
Vector ID
Matches
Relevant
content
Vector Search
embedding
What we’re looking for
Text description, image, etc.
compare
…
Role of vector databases with LLMs
Address the hallucination problem inherent in LLM responses
Augment prompt with enterprise-specific content to produce better responses
Avoid exceeding LLM token limits by using most relevant content
22 Copyright © 2024, Oracle and/or its affiliates
Broad range of data
from the internet
Snapshot of data from a point in time
Private enterprise data
Current data - frequently updated
LLM
Vector Database
Role of vector databases with LLMs
Avoid using sensitive customer data for LLM training and fine-tuning
Cheaper than fine-tuning LLMs, which can be expensive to update
Real-time updated knowledgebase
Cache previous LLM prompts/responses to improve performance and reduce costs
23 Copyright © 2024, Oracle and/or its affiliates
LLM
Better business outcomes
Vector Database
LLM-based chatbot with “enterprise knowledge”
Extended pipeline using retrieval architecture
24 Copyright © 2024, Oracle and/or its affiliates
Prompt
Chat History
Embedding
Model
”What’s the policy?”
”What’s my corporate
401k policy?”
Enhanced
Prompt
Similarity Search
Relational Database
Vector ID
Matches
Fetch docs for matching IDs
Augmented
Prompt
Enhanced prompt + policy details +
scenario examples + known concerns +
expected policy changes…
LLM
Private
content
RESPONSE
Vector Database
embedding
embedding
Use cases
What do embeddings and vector databases enable?
Copyright © 2024, Oracle and/or its affiliates
25
Similarity Search
Match candidates with jobs
Image and video retrieval
Find patients with similar issues
Legal e-discovery
Content-Based
Filtering
Personalized recommendation
Find retail items from image
Natural Language
Processing
Text Classification and Clustering
SQL generation
Data Analytics
Anomaly detection
Pattern recognition
Computer Vision
Face recognition
Biometric identification
Object detection
Biomedical Research
Gene/DNA similarity analysis
Molecular structure search
Geographic
Information Systems
Spatial analysis
Map rendering
Industrial Applications
Quality control
Predictive maintenance
Machinery malfunction
26 Copyright © 2024, Oracle and/or its affiliates
AI Vector Search can augment your prompt
to enable accuracy with Generative AI.
Java App
Dev with
Oracle
Database
Copyright © 2024, Oracle and/or its affiliates
Oracle JDBC - Support for the Latest Java
Versions
• Support to the latest Java versions
(11, 17, 21) and GraalVM
• Project Loom - Virtual Threads
support
• Java Virtual Threads and Pipelined
Database Operations
• JDBC Standards - 4.2 and 4.3
• Reactive Streams - Java Flow API
support
• R2DBC, Reactive Streams Ingestion
(RSI)
• Pipelined Database Operations
Data access is critical in
mission-critical applications!
Copyright © 2024, Oracle and/or its affiliates
Overview of Oracle DB Access with Java
Copyright © 2024, Oracle and/or its affiliates
Copyright © 2024, Oracle and/or its affiliates
Technical References
• Spring AI - https://spring.io/projects/spring-ai
• LangChain4J - https://github.com/langchain4j
• OpenAI - https://openai.com/
• Oracle AI Vector Search - https://rb.gy/gqhw4m
• SD4J by Oracle Labs - https://github.com/oracle/sd4j
• Java / JDBC – https://www.oracle.com/database/technologies/appdev/jdbc.html
• Introduction to Oracle JDBC Driver Support for Virtual Threads -
https://bit.ly/3UlNJWP
• Developing an Oracle JDBC app with GraalVM Native Image - https://rb.gy/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 23c Free —
Developer Release – https://rb.gy/qxlrbx
• Pipelined Database Operations - https://rb.gy/iy3sgh
Juarez Junior
@juarezjunior
The Trinity in GenAI - Spring AI, LangChain4J and OpenAI
Appendix
33 Oracle DatabaseWorld @ CloudWorld Copyright © 2023, Oracle and/or its affiliates
Oracle for Devs + Demos
New | Oracle Database 23ai
Next-Generation Converged Database Services
Over 300 major new features plus thousands of enhancements
Available on OCI and Azure
Major focus on
• AI for Data features
• Developer/Analyst features
• Mission-Critical features
Addresses data management pain points that have frustrated customers forever
Copyright © 2024, Oracle and/or its affiliates
Oracle LiveLabs
Showcasing how Oracle’s solutions can
solve your business problems
500+
free workshops,
available or in
development
3.5 million
people have already visited
LiveLabs
developer.oracle.com/livelabs
learn something new …at your pace!
600+
events run
using LiveLabs
workshops
3 membership tiers
Connect: @oracleace facebook.com/OracleACEs
aceprogram_ww@oracle.com
500+ technical experts &
community leaders helping peers globally
The Oracle ACE Program recognizes & rewards individuals for
their technical & community contributions to the Oracle community
Nominate
yourself or a candidate:
ace.oracle.com/nominate
Learn more - ace.oracle.com
blogs.oracle.com/ace
Create your FREE
Cloud Account
• Go to
https://signup.cloud.oracle.com/
Copyright © 2024, Oracle and/or its affiliates
SD4J – Demo
• Creating GenAI Apps in Java with SD4J (Stable
Diffusion for Java) and the ONNX Runtime
• https://juarezjunior.medium.com/b72385c59329
Copyright © 2024, Oracle and/or its affiliates
Spring AI with Open AI
• Code walkthrough of a sample Spring AI application
that uses Open AI
Copyright © 2024, Oracle and/or its affiliates

More Related Content

PDF
Blazingly Fast GenAI App Development using Spring AI
PDF
Java Forum Nord - Hannover - The Trinity in GenAI - Spring AI, LangChain4J a...
PDF
OSN-Blazingly Fast GenAI App Development With Java and Spring AI
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
PDF
DevTour25_Harness_Powerof_LLMs_GenAI_V1.0_1747121713796001qCJ4.pdf
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
PDF
The Key to AI Success: Your Data with Oracle Netsuite Ham Patel, COO, Europe,...
Blazingly Fast GenAI App Development using Spring AI
Java Forum Nord - Hannover - The Trinity in GenAI - Spring AI, LangChain4J a...
OSN-Blazingly Fast GenAI App Development With Java and Spring AI
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
DevTour25_Harness_Powerof_LLMs_GenAI_V1.0_1747121713796001qCJ4.pdf
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
The Key to AI Success: Your Data with Oracle Netsuite Ham Patel, COO, Europe,...

Similar to The Trinity in GenAI - Spring AI, LangChain4J and OpenAI (20)

PDF
Exploring AI as tools in your career.pdf
PDF
Java Developers - What Lies Ahead in the AI era
PDF
DSS_A Solid Foundation for GenAI Apps - Exploring Architectural Blueprints fo...
PDF
Vector databases and neural search
PPTX
AI hype or reality
PPTX
Vector Databases and Why Are They Used in Modern AI - Marko Lohert - ATD 2024
PPTX
Vector Search -An Introduction in Oracle Database 23ai.pptx
PPTX
Artificial Intelligence in Emerging Technology
PDF
Designing a Generative AI QnA solution with Proprietary Enterprise Business K...
PDF
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
PDF
Sandesh_Rao_Unlocking Oracle Database Mysteries AHF Insights and the AI-LLM D...
PPTX
Ajit Jaokar, Data Science for IoT professor at Oxford University “Enterprise ...
PDF
AI and Machine Learning PG program
PDF
Blending AI in Enterprise Architecture.pdf
PDF
stackconf 2022: Introduction to Vector Search with Weaviate
PDF
20240302 QFM005 Machine Intelligence Reading List February 2024
PPTX
Artificial Intelligence
PDF
Oracle CNCF Meetup Malaga - Build CNCF projects in OCI
PDF
Artificial Intelligence
PDF
Big Data & Artificial Intelligence
Exploring AI as tools in your career.pdf
Java Developers - What Lies Ahead in the AI era
DSS_A Solid Foundation for GenAI Apps - Exploring Architectural Blueprints fo...
Vector databases and neural search
AI hype or reality
Vector Databases and Why Are They Used in Modern AI - Marko Lohert - ATD 2024
Vector Search -An Introduction in Oracle Database 23ai.pptx
Artificial Intelligence in Emerging Technology
Designing a Generative AI QnA solution with Proprietary Enterprise Business K...
HKOSCon18 - Chetan Khatri - Open Source AI / ML Technologies and Application ...
Sandesh_Rao_Unlocking Oracle Database Mysteries AHF Insights and the AI-LLM D...
Ajit Jaokar, Data Science for IoT professor at Oxford University “Enterprise ...
AI and Machine Learning PG program
Blending AI in Enterprise Architecture.pdf
stackconf 2022: Introduction to Vector Search with Weaviate
20240302 QFM005 Machine Intelligence Reading List February 2024
Artificial Intelligence
Oracle CNCF Meetup Malaga - Build CNCF projects in OCI
Artificial Intelligence
Big Data & Artificial Intelligence
Ad

More from Juarez Junior (20)

PDF
WeAreDevelopers Berlin - Blazingly Fast GenAI App Development With Java and S...
PDF
WeAreDevelopers Berlin - LangChain4J - A Guide for Impatient Developers
PDF
Build Stuff Lithuania - Blazingly Fast GenAI App Development With Java and Sp...
PDF
DUBJUG-Simplifying Data Access with Jakarta Data for Domain-Driven Design
PDF
Cloud Lunch and Learn -Microsoft Semantic Kernel for Java
PDF
Compass AI Budapest -The Trinity in GenAI - Spring AI, LangChain4J and OpenAI
PDF
GSAS - Global Software Architecture Summit - GenAI-Architectural-Blueprints
PDF
BaselOne_Langchain4J - A Guide for Impatient Developers
PDF
DeveloperWeek USA - A Solid Foundation for GenAI Apps - Exploring Architectur...
PDF
I Love Tech Romania - Blazingly Fast GenAI App Development With Java and Spri...
PDF
I Love Tech Romania - The Trinity in GenAI - Spring AI, LangChain4J and OpenAI
PDF
DUBJUG_Blazingly Fast GenAI App Development With Java and Spring AI.pdf
PDF
DUBJUG_Creating GenAI Apps in Java with SD4J and the ONNX Runtime
PDF
I Love Tech Romania - A High-Speed Data Ingestion Microservice in Java Using ...
PDF
DevTalks Cluj Romania - A Solid Foundation for GenAI Apps.pdf
PDF
Quarkus Club_Java Virtual Threads & Pipelined Database Operations
PDF
Quarkus Club_Revolutionize Java Database App Development with Reactive Stream...
PDF
TDC - The Developers Conference - The Trinity in GenAI - Spring AI, LangChain...
PDF
TDC - The Developers Conference - Creating GenAI Apps in Java with SD4J and t...
PDF
TDC - The Developers Conference - An Introduction to Machine Learning in Java...
WeAreDevelopers Berlin - Blazingly Fast GenAI App Development With Java and S...
WeAreDevelopers Berlin - LangChain4J - A Guide for Impatient Developers
Build Stuff Lithuania - Blazingly Fast GenAI App Development With Java and Sp...
DUBJUG-Simplifying Data Access with Jakarta Data for Domain-Driven Design
Cloud Lunch and Learn -Microsoft Semantic Kernel for Java
Compass AI Budapest -The Trinity in GenAI - Spring AI, LangChain4J and OpenAI
GSAS - Global Software Architecture Summit - GenAI-Architectural-Blueprints
BaselOne_Langchain4J - A Guide for Impatient Developers
DeveloperWeek USA - A Solid Foundation for GenAI Apps - Exploring Architectur...
I Love Tech Romania - Blazingly Fast GenAI App Development With Java and Spri...
I Love Tech Romania - The Trinity in GenAI - Spring AI, LangChain4J and OpenAI
DUBJUG_Blazingly Fast GenAI App Development With Java and Spring AI.pdf
DUBJUG_Creating GenAI Apps in Java with SD4J and the ONNX Runtime
I Love Tech Romania - A High-Speed Data Ingestion Microservice in Java Using ...
DevTalks Cluj Romania - A Solid Foundation for GenAI Apps.pdf
Quarkus Club_Java Virtual Threads & Pipelined Database Operations
Quarkus Club_Revolutionize Java Database App Development with Reactive Stream...
TDC - The Developers Conference - The Trinity in GenAI - Spring AI, LangChain...
TDC - The Developers Conference - Creating GenAI Apps in Java with SD4J and t...
TDC - The Developers Conference - An Introduction to Machine Learning in Java...
Ad

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
cuic standard and advanced reporting.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Cloud computing and distributed systems.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation theory and applications.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Understanding_Digital_Forensics_Presentation.pptx
MYSQL Presentation for SQL database connectivity
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
20250228 LYD VKU AI Blended-Learning.pptx
Electronic commerce courselecture one. Pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
CIFDAQ's Market Insight: SEC Turns Pro Crypto
cuic standard and advanced reporting.pdf
Review of recent advances in non-invasive hemoglobin estimation
Approach and Philosophy of On baking technology
Encapsulation_ Review paper, used for researhc scholars
Chapter 3 Spatial Domain Image Processing.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Cloud computing and distributed systems.

The Trinity in GenAI - Spring AI, LangChain4J and OpenAI

  • 1. The Trinity in GenAI - Spring AI, LangChain4J and OpenAI I Love Tech ROMANIA 2024 Juarez Barbosa Junior @juarezjunior Sr Principal Java Developer Evangelist ORACLE Copyright © 2024, Oracle and/or its affiliates
  • 2. Juarez Barbosa Junior Senior Principal Java Developer Evangelist • Coming from Dublin, Ireland • 20 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, IoT, AI, Blockchain, Rust • Speaker at conferences • Oracle CloudWorld, Oracle Code, Microsoft Ignite, Microsoft 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, Test.js Summit, Porto TechHub Conf, Pyjamas, MiTechCon, JUGs, meetups, etc. @juarezjunior @juarezjunior
  • 3. Agenda • AI and GenAI – Synthetic Content • Artificial Intelligence and GenAI • OpenAI, Cohere • Spring AI • LangChain4J • Enabling GenAI with AI Vector Search in Oracle Database • Java App Dev with the Oracle Database • Technical References • Audience: Business and Technical audiences (not Machine Learning Engineers) Copyright © 2024, Oracle and/or its affiliates
  • 4. AI and GenAI – Synthetic Content Bucharest the Capital of Romania pictured in a futuristic scenario in one image Copyright © 2024, Oracle and/or its affiliates
  • 5. Artificial Intelligence and GenAI • Core concepts in a nutshell • GenAI - 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). • Training data – dataset • Apps – Applied currently in the fields of content development, entertainment, drug discovery, software development, healthcare, material generation sciences, and others. • Ethical issues – misuse, deep fakes, bias and discrimination, automation and job replacements, cybersecurity and cybercriminals. • AI is now a commodity! Copyright © 2024, Oracle and/or its affiliates
  • 6. OpenAI • Generative AI with OpenAI • Natural Language Processing (NLP) • Powerful, pre-trained and customizable Machine Learning Models • OpenAI API (REST interface) • Scalable infrastructure (powered by Microsoft Azure) • Artificial General Intelligence (AGI) Research – ultimate goal • https://openai.com/sora Copyright © 2024, Oracle and/or its affiliates
  • 7. Spring AI • Spring AI • Java app framework for building AI-related applications. It encapsulates many of the complexities required to interact with a number of different GenAI providers such as OpenAI by providing a robust abstraction layer. • API support across AI providers for chat, text-to-image, and embedding models. • Its goal is to apply to the AI domain Spring ecosystem design principles such as portability and modular design and promote using POJOs as the building blocks of an application to the AI domain. • https://spring.io/projects/spring-ai Copyright © 2024, Oracle and/or its affiliates
  • 8. 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 • AI Services, RAG, Tools, Chains • https://docs.langchain4j.dev/ Copyright © 2024, Oracle and/or its affiliates
  • 9. Enabling Generative AI with AI Vector Search in Oracle Database Recap on background behind semantic search and Generative AI leveraging Oracle AI Vector Search 9 Copyright © 2024, Oracle and/or its affiliates
  • 10. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. The materials in this presentation pertain to Oracle Health, Oracle, Oracle Cerner, and Cerner Enviza which are all wholly owned subsidiaries of Oracle Corporation. Nothing in this presentation should be taken as indicating that any decisions regarding the integration of any EMEA Cerner and/or Enviza entities have been made where an integration has not already occurred. 10 Copyright © 2024, Oracle and/or its affiliates
  • 11. Generative AI and AI Vector Search Democratizes AI Using Vector Databases plus LLMs is SIMPLE • No longer requires data scientists to build AI solution • Use standard pre trained embedding models • Generate vectors, add to private Vector Database • Augment LLM search with private knowledge AI vector search is SUPERFAST • In order to provide AI responses in real time 11 Copyright © 2024, Oracle and/or its affiliates
  • 12. Finding what you’re looking for can be challenging… Copyright © 2024, Oracle and/or its affiliates 12 I have a photo of an artwork, but don’t know the artist or work’s name I heard a catchy tune and can even hum a few bars, but don’t know the title or artist I got this error message ORA-XXXX, but don’t know how to resolve it
  • 13. A technology called Vector Search enables end-user questions to be mapped to relevant data in your database Copyright © 2024, Oracle and/or its affiliates 13
  • 14. Vector search continues to evolve… Copyright © 2024, Oracle and/or its affiliates 14 Vector Space Model 1960s – 1970s Word Embeddings e.g., LSA and LDA 2000s Deep Learning Era e.g., Word2Vec and GloVe 2010s Efficient Search Algorithms e.g., ANN, HNSW, PQ, Annoy 2010s Transformers and Contextual Embeddings e.g., BERT, GPT, etc. late 2010s 33 42 16 21 50 Early Multidimensional Indexing e.g., KD trees, R-trees, Ball trees 1970s – 1990s Dedicated Vector Databases e.g., Milvus, Pinecone, Vespa late 2010s … Relational Database Integration e.g., Oracle late 2010s – 2020s
  • 15. Vectors in AI represent semantics of unstructured data such as images, documents, videos, etc. A vector is a sequence of numbers, called dimensions, used to capture the important "features" of the data Vectors represent the semantic content of data, not the underlying words or pixels Vectors generated using deep learning embedding models Vector 33 42 16 21 50 Copyright © 2024, Oracle and/or its affiliates 15
  • 16. Word relatedness in two dimensions An intuitive example Copyright © 2024, Oracle and/or its affiliates 16 blackberry strawberry apple raspberry pear plum cat kitten dog puppy wolf lion Maine Vermont New York kiwi d1 d2 elephant tiger
  • 17. Convert an image to one or more vector embeddings and search vector database Embeddings for images Copyright © 2024, Oracle and/or its affiliates 17 0.5, 1.5, 2.6, -1.1, … Compare these against other vectors in the database to find similar content
  • 18. Generating embeddings Use an embedding model 18 Copyright © 2024, Oracle and/or its affiliates Text documents Natural Language Embedding Model Images Image Embedding Model Text Vector Table id vector Image 1 [0.5, 1.5, 2.6, -1.1, …] 2 [1.0, 0.9, 1.6, -1.3, …] 3 [0.6, 1.1, 1.3, -0.9, …] … … … Image Vector Table id vector text 1 [0.8, 0.5, 1.6, -2.5, …] “It was the best of times, it was the worst of times, it was..” 2 [1.1, 0.3, 0.6, -1.3, …] “It is a truth universally acknowledged, that a single man..” 3 [1.3, 0.1, 0.2, -1.1, …] “It was a bright cold day in April, and the clocks were striking..” … … …
  • 19. Simple vector search Pipeline 19 Copyright © 2024, Oracle and/or its affiliates Embedding Model Input Data Object Data Object Retrieval Vector ID Matches Relevant content Vector Search embedding What we’re looking for Text description, image, etc. compare …
  • 20. Role of vector databases with LLMs Address the hallucination problem inherent in LLM responses Augment prompt with enterprise-specific content to produce better responses Avoid exceeding LLM token limits by using most relevant content 22 Copyright © 2024, Oracle and/or its affiliates Broad range of data from the internet Snapshot of data from a point in time Private enterprise data Current data - frequently updated LLM Vector Database
  • 21. Role of vector databases with LLMs Avoid using sensitive customer data for LLM training and fine-tuning Cheaper than fine-tuning LLMs, which can be expensive to update Real-time updated knowledgebase Cache previous LLM prompts/responses to improve performance and reduce costs 23 Copyright © 2024, Oracle and/or its affiliates LLM Better business outcomes Vector Database
  • 22. LLM-based chatbot with “enterprise knowledge” Extended pipeline using retrieval architecture 24 Copyright © 2024, Oracle and/or its affiliates Prompt Chat History Embedding Model ”What’s the policy?” ”What’s my corporate 401k policy?” Enhanced Prompt Similarity Search Relational Database Vector ID Matches Fetch docs for matching IDs Augmented Prompt Enhanced prompt + policy details + scenario examples + known concerns + expected policy changes… LLM Private content RESPONSE Vector Database embedding embedding
  • 23. Use cases What do embeddings and vector databases enable? Copyright © 2024, Oracle and/or its affiliates 25 Similarity Search Match candidates with jobs Image and video retrieval Find patients with similar issues Legal e-discovery Content-Based Filtering Personalized recommendation Find retail items from image Natural Language Processing Text Classification and Clustering SQL generation Data Analytics Anomaly detection Pattern recognition Computer Vision Face recognition Biometric identification Object detection Biomedical Research Gene/DNA similarity analysis Molecular structure search Geographic Information Systems Spatial analysis Map rendering Industrial Applications Quality control Predictive maintenance Machinery malfunction
  • 24. 26 Copyright © 2024, Oracle and/or its affiliates AI Vector Search can augment your prompt to enable accuracy with Generative AI.
  • 25. Java App Dev with Oracle Database Copyright © 2024, Oracle and/or its affiliates
  • 26. Oracle JDBC - Support for the Latest Java Versions • Support to the latest Java versions (11, 17, 21) and GraalVM • Project Loom - Virtual Threads support • Java Virtual Threads and Pipelined Database Operations • JDBC Standards - 4.2 and 4.3 • Reactive Streams - Java Flow API support • R2DBC, Reactive Streams Ingestion (RSI) • Pipelined Database Operations Data access is critical in mission-critical applications! Copyright © 2024, Oracle and/or its affiliates
  • 27. Overview of Oracle DB Access with Java Copyright © 2024, Oracle and/or its affiliates
  • 28. Copyright © 2024, Oracle and/or its affiliates Technical References • Spring AI - https://spring.io/projects/spring-ai • LangChain4J - https://github.com/langchain4j • OpenAI - https://openai.com/ • Oracle AI Vector Search - https://rb.gy/gqhw4m • SD4J by Oracle Labs - https://github.com/oracle/sd4j • Java / JDBC – https://www.oracle.com/database/technologies/appdev/jdbc.html • Introduction to Oracle JDBC Driver Support for Virtual Threads - https://bit.ly/3UlNJWP • Developing an Oracle JDBC app with GraalVM Native Image - https://rb.gy/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 23c Free — Developer Release – https://rb.gy/qxlrbx • Pipelined Database Operations - https://rb.gy/iy3sgh
  • 31. Appendix 33 Oracle DatabaseWorld @ CloudWorld Copyright © 2023, Oracle and/or its affiliates Oracle for Devs + Demos
  • 32. New | Oracle Database 23ai Next-Generation Converged Database Services Over 300 major new features plus thousands of enhancements Available on OCI and Azure Major focus on • AI for Data features • Developer/Analyst features • Mission-Critical features Addresses data management pain points that have frustrated customers forever Copyright © 2024, Oracle and/or its affiliates
  • 33. Oracle LiveLabs Showcasing how Oracle’s solutions can solve your business problems 500+ free workshops, available or in development 3.5 million people have already visited LiveLabs developer.oracle.com/livelabs learn something new …at your pace! 600+ events run using LiveLabs workshops
  • 34. 3 membership tiers Connect: @oracleace facebook.com/OracleACEs aceprogram_ww@oracle.com 500+ technical experts & community leaders helping peers globally The Oracle ACE Program recognizes & rewards individuals for their technical & community contributions to the Oracle community Nominate yourself or a candidate: ace.oracle.com/nominate Learn more - ace.oracle.com blogs.oracle.com/ace
  • 35. Create your FREE Cloud Account • Go to https://signup.cloud.oracle.com/ Copyright © 2024, Oracle and/or its affiliates
  • 36. SD4J – Demo • Creating GenAI Apps in Java with SD4J (Stable Diffusion for Java) and the ONNX Runtime • https://juarezjunior.medium.com/b72385c59329 Copyright © 2024, Oracle and/or its affiliates
  • 37. Spring AI with Open AI • Code walkthrough of a sample Spring AI application that uses Open AI Copyright © 2024, Oracle and/or its affiliates