SlideShare a Scribd company logo
1 of 26
#Neo4jConnections
Improved Results with
Vector Search in
Knowledge Graphs
Jennifer Reif
Email: jennifer.reif@neo4j.com
Twitter: @JMHReif
LinkedIn: linked.com/in/jmhreif
Github: github.com/JMHReif
Website: jmhreif.com
Alison Cossette
Email: alison.cossette@neo4j.com
Twitter: @alison_cossette
LinkedIn: linkedin.com/in/alison-cossette-7115857/
Github: github.com/alisoncossette
What is Vector Search?
In AI-generated results…
What is a vector
Neo4j Inc. All rights reserved 2023
● Length
● Direction
● Components have meaning
horizontal
vertical
Vector Example - Shapes
Neo4j Inc. All rights reserved 2023
● Length
● Width
Length
Width
Vector Example - Shapes
Neo4j Inc. All rights reserved 2023
Length
Width
Vector Example - Shapes
Neo4j Inc. All rights reserved 2023
Length
Width
Vector arithmetic
Neo4j Inc. All rights reserved 2023
1
a
b
2
a
b
3
a + b
Kings and Queens
Neo4j Inc. All rights reserved 2023
king − man + woman ≈ queen
1 2 3
What are vector embeddings
Neo4j Inc. All rights reserved 2023
● Same concepts, just “an arrow”
● 100s or 1000s dimensions
● Each dimension corresponds to an
interesting feature or characteristic
Neighborhoods
Neo4j Inc. All rights reserved 2023
● cosine
● direction / angle based
vector point
query
nearest 4
● Euclidean
● distance based
Vector index
Neo4j Inc. All rights reserved 2023
● Queries can become expensive
○ need to compare every vector to the query
● Indexes make them quicker
○ like an index in a book, jumping right where you need
● Approximate nearest neighbour (k-ANN)
○ give me the 20 closest vectors to this one
How to Add Vectors
To Enhance Data in Neo4j…
Data -> Vectors?
Neo4j Inc. All rights reserved 2023
● Generate some vector embeddings
● Several models to meet your requirements
● Store on a node property
Improved Results with Vector Search in Knowledge Graphs
APOC example
WITH "<apiKey>" as apiKey
MATCH (d:Document)
WITH apiKey, a
CALL {
WITH apiKey, a
CALL apoc.ml.openai.embedding([d.text], apiKey, {}) yield index, text, embedding
CALL db.create.setNodeVectorProperty(d, 'textEmbedding', embedding)
RETURN d as doc
}
RETURN doc{.*};
Create and query vector index
CALL db.index.vector.createNodeIndex('document-embeddings', 'Document',
'textEmbedding', 1536, 'cosine');
CALL db.index.vector.queryNodes('document-embeddings', 10, $queryVector)
YIELD node AS similarDocuments, score
MATCH (similarDocuments)<-[:HAS]-(c:Company)
RETURN c.companyName as companyName, avg(score) AS score
ORDER BY score DESC LIMIT 10
How to use the vector index
Neo4j Inc. All rights reserved 2023
CALL db.index.vector.createNodeIndex(
'index-name', 'Label', 'propertyKey', 1536, 'cosine')
CALL db.index.vector.queryNodes('index-name', 1000, $queryVector)
valid:
● 'euclidean'
● 'cosine'
OpenAI gen2
dimensions
same name
nearest 1000
to queryVector
● parameter
● alias
● property
● manually typed
😬 good luck
Full documentation in Cypher manual
https://neo4j.com/docs/cypher-manual/current/indexes-for-vector-search/
Use LLM with Graph
Vector Search
To Harness Relevant and Contextual
Responses…
RAG enables…
Natural language
search on factual
information
retrieved from a
database
Prompt +
Relevant
Information
LLM API LLM
Chat API
User
Database
Search
Prompt Response
Relevant Results
/ Documents
2
3
1
Database
Retrieval Augmented Generation
19 Neo4j Inc. All rights reserved 2023
Graph + Vector = Semantic Search
Neo4j Inc. All rights reserved 2023
Find similar documents.
Find related information.
Combine for more
accurate results within a
relevant context.
Vector Index
Graph Structure
Knowledge Graph
Similarity Search
Pattern Matching
Demo Time!
Are there any employees mentioned who work at
2 different companies?
Generic: not much value-add
Which managers with a Chicago address own
companies?
Relevant: Context needs to match user question
Which companies are vulnerable to lithium
shortage?
Augmenting: LLM gets area, graph gets targets
Which manager has the most Amazon holdings?
Reliable: accuracy with question terms
Resources
● Graphacademy course: LLM Fundamentals
https://graphacademy.neo4j.com/courses/llm-fundamentals/
● Docs: Neo4j vector index https://neo4j.com/docs/cypher-manual/current/indexes-for-
vector-search/
● Docs: OpenAI embeddings https://platform.openai.com/docs/guides/embeddings/how-
to-get-embeddings
● Docs: APOC ML https://neo4j.com/labs/apoc/5/ml/openai/
● Demo App: https://github.com/neo4j-partners/neo4j-generative-ai-aws
Jennifer Reif
Email: jennifer.reif@neo4j.com
Twitter: @JMHReif
LinkedIn: linked.com/in/jmhreif
Github: github.com/JMHReif
Website: jmhreif.com
Alison Cossette
Email: alison.cossette@neo4j.com
Twitter: @alison_cossette
LinkedIn: linkedin.com/in/alison-cossette-
7115857/
Github: github.com/alisoncossette

More Related Content

More from Neo4j

UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaNeo4j
 
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...Neo4j
 
From Knowledge Graphs via Lego Bricks to scientific conversations.pptx
From Knowledge Graphs via Lego Bricks to scientific conversations.pptxFrom Knowledge Graphs via Lego Bricks to scientific conversations.pptx
From Knowledge Graphs via Lego Bricks to scientific conversations.pptxNeo4j
 
Novo Nordisk: When Knowledge Graphs meet LLMs
Novo Nordisk: When Knowledge Graphs meet LLMsNovo Nordisk: When Knowledge Graphs meet LLMs
Novo Nordisk: When Knowledge Graphs meet LLMsNeo4j
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansQIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansNeo4j
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...Neo4j
 
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafosBBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafosNeo4j
 
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...Neo4j
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j
 
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdfRabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j
 
Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!Neo4j
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeNeo4j
 
Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)Neo4j
 

More from Neo4j (20)

UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
 
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
 
From Knowledge Graphs via Lego Bricks to scientific conversations.pptx
From Knowledge Graphs via Lego Bricks to scientific conversations.pptxFrom Knowledge Graphs via Lego Bricks to scientific conversations.pptx
From Knowledge Graphs via Lego Bricks to scientific conversations.pptx
 
Novo Nordisk: When Knowledge Graphs meet LLMs
Novo Nordisk: When Knowledge Graphs meet LLMsNovo Nordisk: When Knowledge Graphs meet LLMs
Novo Nordisk: When Knowledge Graphs meet LLMs
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansQIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
 
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafosBBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
 
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
 
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdfRabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
 
Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG time
 
Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)
 

Recently uploaded

UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewDianaGray10
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
Navigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiNavigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiRaviKumarDaparthi
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxFIDO Alliance
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfdanishmna97
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfalexjohnson7307
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data SciencePaolo Missier
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)Wonjun Hwang
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 

Recently uploaded (20)

UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Navigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiNavigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi Daparthi
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 

Improved Results with Vector Search in Knowledge Graphs

  • 1. #Neo4jConnections Improved Results with Vector Search in Knowledge Graphs Jennifer Reif Email: jennifer.reif@neo4j.com Twitter: @JMHReif LinkedIn: linked.com/in/jmhreif Github: github.com/JMHReif Website: jmhreif.com Alison Cossette Email: alison.cossette@neo4j.com Twitter: @alison_cossette LinkedIn: linkedin.com/in/alison-cossette-7115857/ Github: github.com/alisoncossette
  • 2. What is Vector Search? In AI-generated results…
  • 3. What is a vector Neo4j Inc. All rights reserved 2023 ● Length ● Direction ● Components have meaning horizontal vertical
  • 4. Vector Example - Shapes Neo4j Inc. All rights reserved 2023 ● Length ● Width Length Width
  • 5. Vector Example - Shapes Neo4j Inc. All rights reserved 2023 Length Width
  • 6. Vector Example - Shapes Neo4j Inc. All rights reserved 2023 Length Width
  • 7. Vector arithmetic Neo4j Inc. All rights reserved 2023 1 a b 2 a b 3 a + b
  • 8. Kings and Queens Neo4j Inc. All rights reserved 2023 king − man + woman ≈ queen 1 2 3
  • 9. What are vector embeddings Neo4j Inc. All rights reserved 2023 ● Same concepts, just “an arrow” ● 100s or 1000s dimensions ● Each dimension corresponds to an interesting feature or characteristic
  • 10. Neighborhoods Neo4j Inc. All rights reserved 2023 ● cosine ● direction / angle based vector point query nearest 4 ● Euclidean ● distance based
  • 11. Vector index Neo4j Inc. All rights reserved 2023 ● Queries can become expensive ○ need to compare every vector to the query ● Indexes make them quicker ○ like an index in a book, jumping right where you need ● Approximate nearest neighbour (k-ANN) ○ give me the 20 closest vectors to this one
  • 12. How to Add Vectors To Enhance Data in Neo4j…
  • 13. Data -> Vectors? Neo4j Inc. All rights reserved 2023 ● Generate some vector embeddings ● Several models to meet your requirements ● Store on a node property
  • 15. APOC example WITH "<apiKey>" as apiKey MATCH (d:Document) WITH apiKey, a CALL { WITH apiKey, a CALL apoc.ml.openai.embedding([d.text], apiKey, {}) yield index, text, embedding CALL db.create.setNodeVectorProperty(d, 'textEmbedding', embedding) RETURN d as doc } RETURN doc{.*};
  • 16. Create and query vector index CALL db.index.vector.createNodeIndex('document-embeddings', 'Document', 'textEmbedding', 1536, 'cosine'); CALL db.index.vector.queryNodes('document-embeddings', 10, $queryVector) YIELD node AS similarDocuments, score MATCH (similarDocuments)<-[:HAS]-(c:Company) RETURN c.companyName as companyName, avg(score) AS score ORDER BY score DESC LIMIT 10
  • 17. How to use the vector index Neo4j Inc. All rights reserved 2023 CALL db.index.vector.createNodeIndex( 'index-name', 'Label', 'propertyKey', 1536, 'cosine') CALL db.index.vector.queryNodes('index-name', 1000, $queryVector) valid: ● 'euclidean' ● 'cosine' OpenAI gen2 dimensions same name nearest 1000 to queryVector ● parameter ● alias ● property ● manually typed 😬 good luck Full documentation in Cypher manual https://neo4j.com/docs/cypher-manual/current/indexes-for-vector-search/
  • 18. Use LLM with Graph Vector Search To Harness Relevant and Contextual Responses…
  • 19. RAG enables… Natural language search on factual information retrieved from a database Prompt + Relevant Information LLM API LLM Chat API User Database Search Prompt Response Relevant Results / Documents 2 3 1 Database Retrieval Augmented Generation 19 Neo4j Inc. All rights reserved 2023
  • 20. Graph + Vector = Semantic Search Neo4j Inc. All rights reserved 2023 Find similar documents. Find related information. Combine for more accurate results within a relevant context. Vector Index Graph Structure Knowledge Graph Similarity Search Pattern Matching
  • 22. Are there any employees mentioned who work at 2 different companies? Generic: not much value-add
  • 23. Which managers with a Chicago address own companies? Relevant: Context needs to match user question
  • 24. Which companies are vulnerable to lithium shortage? Augmenting: LLM gets area, graph gets targets
  • 25. Which manager has the most Amazon holdings? Reliable: accuracy with question terms
  • 26. Resources ● Graphacademy course: LLM Fundamentals https://graphacademy.neo4j.com/courses/llm-fundamentals/ ● Docs: Neo4j vector index https://neo4j.com/docs/cypher-manual/current/indexes-for- vector-search/ ● Docs: OpenAI embeddings https://platform.openai.com/docs/guides/embeddings/how- to-get-embeddings ● Docs: APOC ML https://neo4j.com/labs/apoc/5/ml/openai/ ● Demo App: https://github.com/neo4j-partners/neo4j-generative-ai-aws Jennifer Reif Email: jennifer.reif@neo4j.com Twitter: @JMHReif LinkedIn: linked.com/in/jmhreif Github: github.com/JMHReif Website: jmhreif.com Alison Cossette Email: alison.cossette@neo4j.com Twitter: @alison_cossette LinkedIn: linkedin.com/in/alison-cossette- 7115857/ Github: github.com/alisoncossette

Editor's Notes

  1. Retrieve relevant documents using LLM embeddings & vector search Combine relevant documents with prompt Instruct LLM to only use the relevant documents to generate response
  2. Question: Are there any employees mentioned who work at 2 different companies? Question: Which managers with a Chicago address own companies? Question: Which companies are vulnerable to lithium shortage? Question: Which manager has the most Amazon holdings?