Skip to content

Commit 80a5002

Browse files
Genai workshop (#187)
* workshop 1 structure * updates * course updates * coming soon * updates * moved note * fix cypher * fix msg * add link to gitpod * separate imports * Bring genai-workshop up to date (#185) * s/new/news * Introduction to vector indexes and unstructured data (#180) * 1.18.3 --------- Co-authored-by: Adam Cowley <adam@adamcowley.co.uk> * workshop 2 structure * workshop 2 lessons * updates * fixes after walkthrough * add summary --------- Co-authored-by: Adam Cowley <adam@adamcowley.co.uk>
1 parent ee264c8 commit 80a5002

File tree

35 files changed

+1176
-61
lines changed

35 files changed

+1176
-61
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
"scheme": "file"
2121
}
2222
],
23+
"asciidoc.antora.enableAntoraSupport": false,
2324
}

asciidoc/courses/genai-workshop/course.adoc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
:status: active
33
:duration: 2 hours
44
:caption: GenAI Beyond Chat with RAG, Knowledge Graphs and Python
5-
:usecase: blank-sandbox
5+
:usecase: recommendations
66
:key-points: A comma, separated, list of learnings
77
:repository: neo4j-graphacademy/genai-workshop
88

@@ -13,7 +13,7 @@ In this GenAI and Neo4j workshop, you will learn how Neo4j can support your GenA
1313
You will:
1414

1515
* Use Vector indexes and embeddings in Neo4j to perform similarity and keyword search
16-
* Use Python and Langchain to integrate with Neo4j and OpenAI
16+
* Use Python and LangChain to integrate with Neo4j and OpenAI
1717
* Learn about Large Language Models (LLMs), hallucination and integrating knowledge graphs
1818
* Explore Retrieval Augmented Generation (RAG) and its role in grounding LLM-generated content
1919

@@ -38,3 +38,9 @@ To complete the practical tasks within this workshop, you will need:
3838

3939
* Access to gitpod.io (you will need a github, gitpod, or bitbucket account) or a local Python environment
4040
* An OpenAI billing account and API key
41+
42+
[.includes]
43+
== This workshop includes
44+
45+
* [lessons]#7 lessons#
46+
* [challenges]#11 short hands-on challenges#

asciidoc/courses/genai-workshop/modules/1-knowledge-graphs-vectors/lessons/1-getting-started/lesson.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ You can open a Neo4j Browser window throughout this course by clicking the link:
1313

1414
== Get the code
1515

16-
You can use Gitpod as an online IDE and workspace for this workshop.
16+
You can use link:https://gitpod.io[Gitpod^] as an online IDE and workspace for this workshop.
1717
It will automatically clone the workshop repository and set up your environment.
1818

1919
lab::Open `Gitpod workspace`[]

asciidoc/courses/genai-workshop/modules/1-knowledge-graphs-vectors/lessons/11-next-steps/lesson.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ You have:
88

99
* Used vector indexes to search for similar data
1010
* Created embeddings and vector indexes
11-
* Built a graph of unstructured data using Python and Langchain
11+
* Built a graph of unstructured data using Python and LangChain
1212
13-
You can learn more about Neo4j at link:graphacademy.neo4j.com[Neo4j GraphAcademy].
13+
You can learn more about Neo4j on link:https://graphacademy.neo4j.com[ GraphAcademy^].
1414

1515
read::Finished[]
1616

asciidoc/courses/genai-workshop/modules/1-knowledge-graphs-vectors/lessons/3-search-vector/lesson.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
:type: challenge
44
:sandbox: true
55

6-
The Neo4j sandbox contains a sample of 1000 movies.
7-
Running the following Cypher query will return the titles and plots for the movies in the database:
6+
The Neo4j sandbox contains a sample of 1000 embeddings for movie plots.
7+
Running the following Cypher query will return the titles and plots for the movies that have embeddings:
88

99
[source, cypher]
1010
----
1111
MATCH (m:Movie)
12+
WHERE m.plotEmbedding IS NOT NULL
1213
RETURN m.title, m.plot
1314
----
1415

asciidoc/courses/genai-workshop/modules/1-knowledge-graphs-vectors/lessons/3-search-vector/reset.cypher

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
11
LOAD CSV WITH HEADERS
2-
FROM 'https://data.neo4j.com/llm-vectors-unstructured/movies-plot-embedding.csv' AS row
3-
MERGE (m:Movie {movieId: toInteger(row.movieId)})
4-
SET
5-
m.tmdbId = toInteger(row.tmdbId),
6-
m.imdbId = toInteger(row.imdbId),
7-
m.released = row.released,
8-
m.title = row.title,
9-
m.year = toInteger(row.year),
10-
m.plot = row.plot,
11-
m.budget = toInteger(row.budget),
12-
m.imdbRating = toFloat(row.imdbRating),
13-
m.poster = row.poster,
14-
m.runtime = toInteger(row.runtime),
15-
m.imdbVotes = toInteger(row.imdbVotes),
16-
m.revenue = toInteger(row.revenue),
17-
m.url = row.url
18-
WITH m, row
19-
CALL db.create.setNodeVectorProperty(m, 'plotEmbedding', apoc.convert.fromJsonList(row.plotEmbedding));
2+
FROM 'https://data.neo4j.com/rec-embed/movie-plot-embeddings-1k.csv'
3+
AS row
4+
MATCH (m:Movie {movieId: row.movieId})
5+
CALL db.create.setNodeVectorProperty(m, 'plotEmbedding', apoc.convert.fromJsonList(row.embedding));
206

217
CREATE VECTOR INDEX moviePlots IF NOT EXISTS
228
FOR (m:Movie)

asciidoc/courses/genai-workshop/modules/1-knowledge-graphs-vectors/lessons/4-embeddings/lesson.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ WITH genai.vector.encode(
4040
{ token: "sk-..." }) AS myMoviePlot
4141
CALL db.index.vector.queryNodes('moviePlots', 6, myMoviePlot)
4242
YIELD node, score
43-
RETURN node.text, score
43+
RETURN node.title, node.plot, score
4444
----
4545

4646
Experiment with different movie plots and observe the results.

asciidoc/courses/genai-workshop/modules/1-knowledge-graphs-vectors/lessons/5-create-vector-index/lesson.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ You previously used a vector index to find similar text; you can also use a vect
99

1010
== Movie posters
1111

12-
GraphAcademy has loaded a dataset of movie posters into the sandbox.
12+
GraphAcademy has loaded a sample of 1000 movie poster embeddings into the sandbox.
1313
Each movie has a URL to a poster image:
1414

1515
[source, cypher]
@@ -98,12 +98,13 @@ image:images/babe-similar-posters.jpg[3 movie posters, Babe, Lassie, Before the
9898

9999
Pick a different movie and write a similar Cypher query to find similar posters.
100100

101-
You can view all the movie titles using this Cypher:
101+
You can view the movies that have a poster embedding using this Cypher:
102102

103103
[source, cypher]
104104
----
105105
MATCH (m:Movie)
106-
RETURN m.title
106+
WHERE m.posterEmbedding IS NOT NULL
107+
RETURN m.title, m.poster
107108
----
108109

109110
== Continue
Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
1-
LOAD CSV WITH HEADERS
2-
FROM 'https://data.neo4j.com/llm-vectors-unstructured/movies-poster-embedding.csv' AS row
3-
MERGE (m:Movie {movieId: toInteger(row.movieId)})
4-
SET
5-
m.tmdbId = toInteger(row.tmdbId),
6-
m.imdbId = toInteger(row.imdbId),
7-
m.released = row.released,
8-
m.title = row.title,
9-
m.year = toInteger(row.year),
10-
m.plot = row.plot,
11-
m.budget = toInteger(row.budget),
12-
m.imdbRating = toFloat(row.imdbRating),
13-
m.poster = row.poster,
14-
m.runtime = toInteger(row.runtime),
15-
m.imdbVotes = toInteger(row.imdbVotes),
16-
m.revenue = toInteger(row.revenue),
17-
m.url = row.url
18-
WITH m, row
19-
CALL db.create.setNodeVectorProperty(m, 'posterEmbedding', apoc.convert.fromJsonList(row.posterEmbedding));
1+
LOAD CSV WITH HEADERS FROM "https://data.neo4j.com/rec-embed/movie-poster-embeddings-1k.csv" AS row
2+
match (m:Movie {movieId:row.movieId})
3+
WITH row,m
4+
CALL db.create.setNodeVectorProperty(m, 'posterEmbedding', apoc.convert.fromJsonList(row.posterEmbedding))

asciidoc/courses/genai-workshop/modules/1-knowledge-graphs-vectors/lessons/6-unstructured-data/lesson.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ read::Move on[]
4040

4141
You learned about how you can store unstructured data in a graph.
4242

43-
In the next task, you will use Python and Langchain to load, chunk, embed, and store unstructured data in Neo4j.
43+
In the next task, you will use Python and LangChain to load, chunk, embed, and store unstructured data in Neo4j.

0 commit comments

Comments
 (0)