Skip to content

Commit e065e23

Browse files
GenAI workshop (#182)
* workshop 1 structure * updates * course updates * coming soon * updates * moved note
1 parent 8d9296b commit e065e23

File tree

26 files changed

+1058
-1
lines changed

26 files changed

+1058
-1
lines changed

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@
2020
"scheme": "file"
2121
}
2222
],
23-
"asciidoc.antora.enableAntoraSupport": true,
2423
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
= Gen-AI - Hands-on Workshop
2+
:status: active
3+
:duration: 2 hours
4+
:caption: GenAI Beyond Chat with RAG, Knowledge Graphs and Python
5+
:usecase: blank-sandbox
6+
:key-points: A comma, separated, list of learnings
7+
:repository: neo4j-graphacademy/genai-workshop
8+
9+
== Course Description
10+
11+
In this GenAI and Neo4j workshop, you will learn how Neo4j can support your GenAI projects.
12+
13+
You will:
14+
15+
* Use Vector indexes and embeddings in Neo4j to perform similarity and keyword search
16+
* Use Python and Langchain to integrate with Neo4j and OpenAI
17+
* Learn about Large Language Models (LLMs), hallucination and integrating knowledge graphs
18+
* Explore Retrieval Augmented Generation (RAG) and its role in grounding LLM-generated content
19+
20+
After completing this workshop, you will be able to explain the terms LLM, RAG, grounding, and knowledge graphs. You will also have the knowledge and skills to create simple LLM-based applications using Neo4j and Python.
21+
22+
=== Prerequisites
23+
24+
Before taking this course, you should have:
25+
26+
* A basic understanding of Graph Databases and Neo4j
27+
* Knowledge of Python and capable of reading simple programs
28+
29+
While not essential, we completing the GraphAcademy link:/courses/neo4j-fundamentals/[Neo4j Fundamentals^] course.
30+
31+
=== Duration
32+
33+
{duration}
34+
35+
== What you need
36+
37+
To complete the practical tasks within this workshop, you will need:
38+
39+
* Access to gitpod.io (you will need a github, gitpod, or bitbucket account) or a local Python environment
40+
* An OpenAI billing account and API key
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
= Getting Started
2+
:order: 1
3+
:type: lesson
4+
:lab: {repository-link}
5+
:disable-cache: true
6+
7+
We have created a link:https://github.com/neo4j-graphacademy/genai-workshop[repository^] for this workshop.
8+
It contains the starter code and resources you need.
9+
10+
A blank Neo4j Sandbox instance has also been created for you to use during this course.
11+
12+
You can open a Neo4j Browser window throughout this course by clicking the link:#[Toggle Sandbox,role=classroom-sandbox-toggle] button in the bottom right-hand corner of the screen.
13+
14+
== Get the code
15+
16+
You can use Gitpod as an online IDE and workspace for this workshop.
17+
It will automatically clone the workshop repository and set up your environment.
18+
19+
lab::Open `Gitpod workspace`[]
20+
21+
[NOTE]
22+
You will need to login with a Github, Gitlab, or Bitbucket account.
23+
24+
Alternatively, you can clone the repository and set up the environment yourself.
25+
26+
[%collapsible]
27+
.Develop on your local machine
28+
====
29+
You will need link:https://python.org[Python] installed and the ability to install packages using `pip`.
30+
31+
You may want to set up a virtual environment using link:https://docs.python.org/3/library/venv.html[`venv`^] or link:https://virtualenv.pypa.io/en/latest/[`virtualenv`^] to keep your dependencies separate from other projects.
32+
33+
Clone the link:https://github.com/neo4j-graphacademy/genai-workshop[github.com/neo4j-graphacademy/genai-workshop] repository:
34+
35+
[source,bash]
36+
----
37+
git clone https://github.com/neo4j-graphacademy/genai-workshop
38+
----
39+
40+
Install the required packages using `pip`:
41+
42+
[source,bash]
43+
----
44+
cd genai-workshop
45+
pip install -r requirements.txt
46+
----
47+
====
48+
49+
== Setup the environment
50+
51+
Create a copy of the `.env.example` file and name it `.env`.
52+
Fill in the required values.
53+
54+
[source]
55+
.Create a .env file
56+
----
57+
include::{repository-raw}/main/.env.example[]
58+
----
59+
60+
Add your Open AI API key (`OPENAI_API_KEY`), which you can get from link:https://platform.openai.com[platformn.openai.com].
61+
62+
Update the Neo4j sandbox connection details:
63+
64+
NEO4J_URI:: [copy]#bolt://{sandbox_ip}:{sandbox_boltPort}#
65+
NEO4J_USERNAME:: [copy]#{sandbox_username}#
66+
NEO4J_PASSWORD:: [copy]#{sandbox_password}#
67+
68+
== Test your setup
69+
70+
You can test your setup by running `test_environment.py` - this will attempt to connect to the Neo4j sandbox and the OpenAI API.
71+
72+
You will see an `OK` message if you have set up your environment correctly. If any tests fail, check the contents of the `.env` file.
73+
74+
== Continue
75+
76+
When you are ready, you can move on to the next task.
77+
78+
read::Success - let's get started![]
79+
80+
[.summary]
81+
== Summary
82+
83+
You have setup your environment and are ready to start the workshop.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
= Expand the Graph
2+
:order: 10
3+
:type: challenge
4+
:optional: true
5+
:sandbox: true
6+
7+
In this *optional* challenge, you can extend the graph with additional data.
8+
9+
== All Courses
10+
11+
Currently, the graph contains data from a single course, `llm-fundamentals`, you can download the link:https://data.neo4j.com/llm-vectors-unstructured/courses.zip[lesson files for all the courses^].
12+
13+
. Download the content for all the courses - link:https://data.neo4j.com/llm-vectors-unstructured/courses.zip[data.neo4j.com/llm-vectors-unstructured/courses.zip^]
14+
. Update the graph with the new data
15+
. Explore the graph and find the connections between the courses
16+
17+
== Additional metadata
18+
19+
While the course content is unstructured, it contains metadata you can extract and include in the graph.
20+
21+
Examples include:
22+
23+
* The course title is the first level 1 heading in the file - `= Course Title`
24+
* Level 2 headings denote section titles - `== Section Title`
25+
* The lessons include parameters in the format `:parameter: value` at the top of the file, such as:
26+
** `:type:` - the type of lesson (e.g. `lesson`, `challenge`, `quiz`)
27+
** `:order:` - the order of the lesson in the module
28+
** `:optional:` - whether the lesson is optional
29+
30+
Explore the course content and see what other data you can extract and include in the graph.
31+
32+
When you are ready to move on, click Continue.
33+
34+
== Continue
35+
36+
When you are ready, you can move on to the next task.
37+
38+
read::Move on[]
39+
40+
[.summary]
41+
== Summary
42+
43+
In this optional challenge, you extended the graph with additional data.
44+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
= Next steps
2+
:order: 11
3+
:type: lesson
4+
5+
Congratulations on completing this workshop!
6+
7+
You have:
8+
9+
* Used vector indexes to search for similar data
10+
* Created embeddings and vector indexes
11+
* Built a graph of unstructured data using Python and Langchain
12+
13+
You can learn more about Neo4j at link:graphacademy.neo4j.com[Neo4j GraphAcademy].
14+
15+
read::Finished[]
16+
17+
[.summary]
18+
== Summary
19+
20+
Congratulations on completing this workshop!
Lines changed: 1 addition & 0 deletions
Loading
27.7 KB
Loading

asciidoc/courses/genai-workshop/modules/1-knowledge-graphs-vectors/lessons/2-vectors/images/vector-distance.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
= Semantic Search, Vectors, and Embeddings
2+
:order: 2
3+
:type: lesson
4+
5+
Machine learning and natural language processing (NLP) often use vectors and embeddings to represent and understand data.
6+
7+
== Semantic Search
8+
9+
Semantic search aims to understand search phrases' intent and contextual meaning, rather than focusing on individual keywords.
10+
11+
Traditional keyword search often depends on exact-match keywords or proximity-based algorithms that find similar words.
12+
13+
For example, if you input "apple" in a traditional search, you might predominantly get results about the fruit.
14+
15+
However, in a semantic search, the engine tries to gauge the context: Are you searching about the fruit, the tech company, or something else?
16+
17+
image:images/Apple-tech-or-fruit.png[An apple in the middle with a tech icons on the left and a food on the right,width=700,align=center]
18+
19+
20+
== What are Vectors
21+
22+
Vectors are simply a list of numbers.
23+
For example, the vector `[1, 2, 3]`` is a list of three numbers and could represent a point in three-dimensional space.
24+
25+
image:images/3d-vector.svg[A diagram showing a 3d representation of the x,y,z coordinates 1,1,1 and 1,2,3]
26+
27+
You can use vectors to represent many different types of data, including text, images, and audio.
28+
29+
Using vectors with a dimensionality of hundreds and thousands in machine learning and natural language processing (NLP) is common.
30+
31+
== What are Embeddings?
32+
33+
When referring to vectors in the context of machine learning and NLP, the term "embedding" is typically used.
34+
An embedding is a vector that represents the data in a useful way for a specific task.
35+
36+
Each dimension in a vector can represent a particular semantic aspect of the word or phrase.
37+
When multiple dimensions are combined, they can convey the overall meaning of the word or phrase.
38+
39+
For example, the word "apple" might be represented by an embedding with the following dimensions:
40+
41+
* fruit
42+
* technology
43+
* color
44+
* taste
45+
* shape
46+
47+
You can create embeddings in various ways, but one of the most common methods is to use a **large language model**.
48+
49+
For example, the embedding for the word "apple" is `0.0077788467, -0.02306925, -0.007360777, -0.027743412, -0.0045747845, 0.01289164, -0.021863015, -0.008587573, 0.01892967, -0.029854324, -0.0027962727, 0.020108491, -0.004530236, 0.009129008,` ... and so on.
50+
51+
== How are vectors used in semantic search?
52+
53+
You can use the _distance_ or _angle_ between vectors to gauge the semantic similarity between words or phrases.
54+
55+
image::images/vector-distance.svg[A 3 dimensional chart illustrating the distance between vectors. The vectors are for the words "apple" and "fruit",width=700,align=center]
56+
57+
Words with similar meanings or contexts will have vectors that are close together, while unrelated words will be farther apart.
58+
59+
This principle is employed in semantic search to find contextually relevant results for a user's query.
60+
61+
== Continue
62+
63+
When you are ready, you can move on to the next task.
64+
65+
read::Move on[]
66+
67+
[.summary]
68+
== Summary
69+
70+
You learned about semantic search, vectors, and embeddings.
71+
72+
Next, you will use a Neo4j vector index to find similar data.

0 commit comments

Comments
 (0)