Vector databases are rapidly growing in popularity as a way to add long-term memory to LLMs like GPT-4, LLaMDA, and LLaMA. Learn how popular vector databases like Pinecone and Weaviate can store ML embeddings to integrate with tools like ChatGPT. 

#programming #tech #TheCodeReport

💬 Chat with Me on Discord

https://discord.gg/fireship

🔗 Resources

Full Vector DB tutorial coming soon on @beyondfireship 
Rektor https://github.com/codediodeio/rektor-db
OpenAI Embeddings https://platform.openai.com/docs/guides/embeddings
Weaviate GitHub https://github.com/weaviate/weaviate
Chroma GitHub https://github.com/chroma-core/chroma


🔥 Get More Content - Upgrade to PRO

Upgrade at https://fireship.io/pro
Use code YT25 for 25% off PRO access 

🎨 My Editor Settings

- Atom One Dark 
- vscode-icons
- Fira Code Font

🔖 Topics Covered

- What is a vector in computer science?
- VC funding of databases news
- What are ML embeddings?
- What is a vector database?
- Vector database vs SQL
- Are vector databases fast?
- How to make custom chatGPT app
- Vector database basics tutorial
- Trending github repos about AGI
2024-02-04T13:26:06.942Z
nova-2
2-general-nova
2024-01-09.29447
30089e05-99d1-4376-b32e-c263170674af
75142179-385f-4bb8-8903-480575e3abba
10486e9dad0b696eecce02d14ba93b5ef7a8e2f0a6ab1eef84966a79708da855
67875a7f-c9c4-48a0-aa55-5bdb8a91c34a
deprecated
It is April 7, 2023, and you're watching the CodeReport.
1 month ago, vector database Weeviate landed $16,000,000 in Series A funding.
Last week, Pinecone DB just got a check for 28,000,000 at a 700,000,000 valuation.
And yesterday, Chroma, an open source project with only 1.2 GitHub stars, raised 18,000,000 for its embeddings database.
And I just launched my own vector database this morning.
We're like pre revenue, pre vision, and pre code, and valued at $420,000,000 Leave your credit card details in the comments if you'd like to invest.
But you might be wondering, what the hell is Vector database.
Or what the hell is a vector even?
Well, that's easy.
A vector is just an array of numbers.
But what's cool about vectors is that they can represent more complex checks like words, sentences, images, or audio files in a continuous high dimensional space called an embedding.
It's kinda like this.
When When you go to a party, all of the jocks sit around the TV and watch football.
Meanwhile, all the girls find the dance floor, while you group together with all the programming introverts to talk about vectors in the corner.
Notice how All the similar objects are grouped together.
Embeddings work the same way, except they map the semantic meaning of words together or similar features in virtually any other data type.
These embeddings can then be used for things like recommendation systems, search engines, and even text generation like chat gpt.
But once you have your embeddings, The question becomes, where do you store them and how do you query them quickly?
That's where vector databases come in.
In a relational database, you have rows and columns.
In a In database, you have documents and collections, but in a vector database, you have arrays of numbers clustered together based on similarity, which can be queried with ultra low latency, making it an ideal choice for AI driven applications.
Volational databases like Postgres have tools like pgvector to support this type of functionality, And Redis also has 1st class vector support.
But a bunch of new native vector databases are popping up, like Weeviate and Milvus are open source options written in Go.
Then you have Pinecone, which is extremely popular, but is not open source.
Then you have Chroma, which is based on ClickHouse under the hood, and many other options from there.
Let's jump into some code to see what it looks like.
Here, I'm using Chroma and JavaScript, and the first thing I'll do is create the client, then define an embedding function.
In this case, it will use the OpenAI API API to update the embeddings whenever a new data point is added.
Each data point is just a document with an ID and some text.
And finally, we can query the database ace by passing a string of text just like an LLM.
What's most interesting though is that in the query result, we get the data back in addition to an array a of distances, with a smaller number indicating a higher degree of similarity.
That's pretty cool, but the real reason that these databases are so hot right now is that they can extend LLMs with long term memory.
You start with a general purpose model, like OpenAI's GPT 4, Meta's llama, or Google's Lambda, then provide your own data in a vector database.
Base.
When the user makes a prompt, you can then query relevant documents from your own database to update the contacts, which will customize the final response, and it can also retrieve historical data to give the AI long term memory.
In addition, they also integrate with tools like langchain that combine multiple LLMs together.
It's all pretty crazy, and I'm working on a tutorial on my second channel with Weeviate, so make sure to subscribe Grab over there if you really wanna dive into this stuff.
And lastly, in related news, if you check out the top trending repos in GitHub today, they're almost all trying to create artificial general intelligence, like Microsoft's Jarvis, AutoGPT, and Baby AGI, which are tools that use vector databases and LLMs to prune themselves.
And this is terrifying as someone who just became with a prompt engineer.
I never thought I'd become obsolete twice in 1 month.
This has been the CodeReport, thanks for watching, and I will see you in the next one.

Speaker 0: It is April 7, 2023, and you're watching the CodeReport. 1 month ago, vector database Weeviate landed $16,000,000 in Series A funding. Last week, Pinecone DB just got a check for 28,000,000 at a 700,000,000 valuation. And yesterday, Chroma, an open source project with only 1.2 GitHub stars, raised 18,000,000 for its embeddings database. And I just launched my own vector database this morning.

We're like pre revenue, pre vision, and pre code, and valued at $420,000,000 Leave your credit card details in the comments if you'd like to invest. But you might be wondering, what the hell is Vector database. Or what the hell is a vector even? Well, that's easy. A vector is just an array of numbers.

But what's cool about vectors is that they can represent more complex checks like words, sentences, images, or audio files in a continuous high dimensional space called an embedding. It's kinda like this. When When you go to a party, all of the jocks sit around the TV and watch football. Meanwhile, all the girls find the dance floor, while you group together with all the programming introverts to talk about vectors in the corner. Notice how All the similar objects are grouped together.

Embeddings work the same way, except they map the semantic meaning of words together or similar features in virtually any other data type. These embeddings can then be used for things like recommendation systems, search engines, and even text generation like chat gpt. But once you have your embeddings, The question becomes, where do you store them and how do you query them quickly? That's where vector databases come in. In a relational database, you have rows and columns.

In a In database, you have documents and collections, but in a vector database, you have arrays of numbers clustered together based on similarity, which can be queried with ultra low latency, making it an ideal choice for AI driven applications. Volational databases like Postgres have tools like pgvector to support this type of functionality, And Redis also has 1st class vector support. But a bunch of new native vector databases are popping up, like Weeviate and Milvus are open source options written in Go. Then you have Pinecone, which is extremely popular, but is not open source. Then you have Chroma, which is based on ClickHouse under the hood, and many other options from there.

Let's jump into some code to see what it looks like. Here, I'm using Chroma and JavaScript, and the first thing I'll do is create the client, then define an embedding function. In this case, it will use the OpenAI API API to update the embeddings whenever a new data point is added. Each data point is just a document with an ID and some text. And finally, we can query the database ace by passing a string of text just like an LLM.

What's most interesting though is that in the query result, we get the data back in addition to an array a of distances, with a smaller number indicating a higher degree of similarity. That's pretty cool, but the real reason that these databases are so hot right now is that they can extend LLMs with long term memory. You start with a general purpose model, like OpenAI's GPT 4, Meta's llama, or Google's Lambda, then provide your own data in a vector database. Base. When the user makes a prompt, you can then query relevant documents from your own database to update the contacts, which will customize the final response, and it can also retrieve historical data to give the AI long term memory.

In addition, they also integrate with tools like langchain that combine multiple LLMs together. It's all pretty crazy, and I'm working on a tutorial on my second channel with Weeviate, so make sure to subscribe Grab over there if you really wanna dive into this stuff. And lastly, in related news, if you check out the top trending repos in GitHub today, they're almost all trying to create artificial general intelligence, like Microsoft's Jarvis, AutoGPT, and Baby AGI, which are tools that use vector databases and LLMs to prune themselves. And this is terrifying as someone who just became with a prompt engineer. I never thought I'd become obsolete twice in 1 month.

This has been the CodeReport, thanks for watching, and I will see you in the next one.
It is April 7, 2023, and you're watching the CodeReport. 1 month ago, vector database Weeviate landed $16,000,000 in Series A funding. Last week, Pinecone DB just got a check for 28,000,000 at a 700,000,000 valuation. And yesterday, Chroma, an open source project with only 1.2 GitHub stars, raised 18,000,000 for its embeddings database. And I just launched my own vector database this morning. We're like pre revenue, pre vision, and pre code, and valued at $420,000,000 Leave your credit card details in the comments if you'd like to invest. But you might be wondering, what the hell is Vector database. Or what the hell is a vector even? Well, that's easy. A vector is just an array of numbers.
But what's cool about vectors is that they can represent more complex checks like words, sentences, images, or audio files in a continuous high dimensional space called an embedding. It's kinda like this. When When you go to a party, all of the jocks sit around the TV and watch football.
geometry
Meanwhile, all the girls find the dance floor, while you group together with all the programming introverts to talk about vectors in the corner. Notice how All the similar objects are grouped together. Embeddings work the same way, except they map the semantic meaning of words together or similar features in virtually any other data type.
These embeddings can then be used for things like recommendation systems, search engines, and even text generation like chat gpt. But once you have your embeddings, The question becomes, where do you store them and how do you query them quickly? That's where vector databases come in. In a relational database, you have rows and columns. In a In database, you have documents and collections, but in a vector database, you have arrays of numbers clustered together based on similarity, which can be queried with ultra low latency, making it an ideal choice for AI driven applications. Volational databases like Postgres have tools like pgvector to support this type of functionality, And Redis also has 1st class vector support. But a bunch of new native vector databases are popping up, like Weeviate and Milvus are open source options written in Go. Then you have Pinecone, which is extremely popular, but is not open source.
databases
data
data management
Then you have Chroma, which is based on ClickHouse under the hood, and many other options from there. Let's jump into some code to see what it looks like. Here, I'm using Chroma and JavaScript, and the first thing I'll do is create the client, then define an embedding function.
In this case, it will use the OpenAI API API to update the embeddings whenever a new data point is added. Each data point is just a document with an ID and some text. And finally, we can query the database ace by passing a string of text just like an LLM. What's most interesting though is that in the query result, we get the data back in addition to an array a of distances, with a smaller number indicating a higher degree of similarity. That's pretty cool, but the real reason that these databases are so hot right now is that they can extend LLMs with long term memory. You start with a general purpose model, like OpenAI's GPT 4, Meta's llama, or Google's Lambda, then provide your own data in a vector database. Base. When the user makes a prompt, you can then query relevant documents from your own database to update the contacts, which will customize the final response, and it can also retrieve historical data to give the AI long term memory. In addition, they also integrate with tools like langchain that combine multiple LLMs together. It's all pretty crazy, and I'm working on a tutorial on my second channel with Weeviate, so make sure to subscribe Grab over there if you really wanna dive into this stuff. And lastly, in related news, if you check out the top trending repos in GitHub today, they're almost all trying to create artificial general intelligence, like Microsoft's Jarvis, AutoGPT, and Baby AGI, which are tools that use vector databases and LLMs to prune themselves. And this is terrifying as someone who just became with a prompt engineer.
databases
artificial intelligence
data management
data
software
software development
neural networks
machine learning
I never thought I'd become obsolete twice in 1 month. This has been the CodeReport, thanks for watching, and I will see you in the next one.
It is April 7, 2023, and you're watching the CodeReport. 1 month ago, vector database Weeviate landed $16,000,000 in Series A funding. Last week, Pinecone DB just got a check for 28,000,000 at a 700,000,000 valuation. And yesterday, Chroma, an open source project with only 1.2 GitHub stars, raised 18,000,000 for its embeddings database. And I just launched my own vector database this morning. We're like pre revenue, pre vision, and pre code, and valued at $420,000,000 Leave your credit card details in the comments if you'd like to invest. But you might be wondering, what the hell is Vector database. Or what the hell is a vector even? Well, that's easy. A vector is just an array of numbers. But what's cool about vectors is that they can represent more complex checks like words, sentences, images, or audio files in a continuous high dimensional space called an embedding. It's kinda like this. When When you go to a party, all of the jocks sit around the TV and watch football. Meanwhile, all the girls find the dance floor, while you group together with all the programming introverts to talk about vectors in the corner. Notice how All the similar objects are grouped together. Embeddings work the same way, except they map the semantic meaning of words together or similar features in virtually any other data type. These embeddings can then be used for things like recommendation systems, search engines, and even text generation like chat gpt. But once you have your embeddings, The question becomes, where do you store them and how do you query them quickly? That's where vector databases come in. In a relational database, you have rows and columns. In a In database, you have documents and collections, but in a vector database, you have arrays of numbers clustered together based on similarity, which can be queried with ultra low latency, making it an ideal choice for AI driven applications. Volational databases like Postgres have tools like pgvector to support this type of functionality, And Redis also has 1st class vector support. But a bunch of new native vector databases are popping up, like Weeviate and Milvus are open source options written in Go. Then you have Pinecone, which is extremely popular, but is not open source. Then you have Chroma, which is based on ClickHouse under the hood, and many other options from there. Let's jump into some code to see what it looks like. Here, I'm using Chroma and JavaScript, and the first thing I'll do is create the client, then define an embedding function. In this case, it will use the OpenAI API API to update the embeddings whenever a new data point is added. Each data point is just a document with an ID and some text. And finally, we can query the database ace by passing a string of text just like an LLM. What's most interesting though is that in the query result, we get the data back in addition to an array a of distances, with a smaller number indicating a higher degree of similarity. That's pretty cool, but the real reason that these databases are so hot right now is that they can extend LLMs with long term memory. You start with a general purpose model, like OpenAI's GPT 4, Meta's llama, or Google's Lambda, then provide your own data in a vector database. Base. When the user makes a prompt, you can then query relevant documents from your own database to update the contacts, which will customize the final response, and it can also retrieve historical data to give the AI long term memory. In addition, they also integrate with tools like langchain that combine multiple LLMs together. It's all pretty crazy, and I'm working on a tutorial on my second channel with Weeviate, so make sure to subscribe Grab over there if you really wanna dive into this stuff. And lastly, in related news, if you check out the top trending repos in GitHub today, they're almost all trying to create artificial general intelligence, like Microsoft's Jarvis, AutoGPT, and Baby AGI, which are tools that use vector databases and LLMs to prune themselves. And this is terrifying as someone who just became with a prompt engineer. I never thought I'd become obsolete twice in 1 month. This has been the CodeReport, thanks for watching, and I will see you in the next one.
It
it
is
is
April
april
7,
7
2023,
2023
and
and
you're
you're
watching
watching
the
the
CodeReport.
codereport
1
1
month
month
ago,
ago
vector
vector
database
database
Weeviate
weeviate
landed
landed
$16,000,000
$16,000,000
in
in
Series
series
A
a
funding.
funding
Last
last
week,
week
Pinecone
pinecone
DB
db
just
just
got
got
a
a
check
check
for
for
28,000,000
28,000,000
at
at
a
a
700,000,000
700,000,000
valuation.
valuation
And
and
yesterday,
yesterday
Chroma,
chroma
an
an
open
open
source
source
project
project
with
with
only
only
1.2
1.2
GitHub
github
stars,
stars
raised
raised
18,000,000
18,000,000
for
for
its
its
embeddings
embeddings
database.
database
And
and
I
i
just
just
launched
launched
my
my
own
own
vector
vector
database
database
this
this
morning.
morning
We're
we're
like
like
pre
pre
revenue,
revenue
pre
pre
vision,
vision
and
and
pre
pre
code,
code
and
and
valued
valued
at
at
$420,000,000
$420,000,000
Leave
leave
your
your
credit
credit
card
card
details
details
in
in
the
the
comments
comments
if
if
you'd
you'd
like
like
to
to
invest.
invest
But
but
you
you
might
might
be
be
wondering,
wondering
what
what
the
the
hell
hell
is
is
Vector
vector
database.
database
Or
or
what
what
the
the
hell
hell
is
is
a
a
vector
vector
even?
even
Well,
well
that's
that's
easy.
easy
A
a
vector
vector
is
is
just
just
an
an
array
array
of
of
numbers.
numbers
But
but
what's
what's
cool
cool
about
about
vectors
vectors
is
is
that
that
they
they
can
can
represent
represent
more
more
complex
complex
checks
checks
like
like
words,
words
sentences,
sentences
images,
images
or
or
audio
audio
files
files
in
in
a
a
continuous
continuous
high
high
dimensional
dimensional
space
space
called
called
an
an
embedding.
embedding
It's
it's
kinda
kinda
like
like
this.
this
When
when
When
when
you
you
go
go
to
to
a
a
party,
party
all
all
of
of
the
the
jocks
jocks
sit
sit
around
around
the
the
TV
tv
and
and
watch
watch
football.
football
Meanwhile,
meanwhile
all
all
the
the
girls
girls
find
find
the
the
dance
dance
floor,
floor
while
while
you
you
group
group
together
together
with
with
all
all
the
the
programming
programming
introverts
introverts
to
to
talk
talk
about
about
vectors
vectors
in
in
the
the
corner.
corner
Notice
notice
how
how
All
all
the
the
similar
similar
objects
objects
are
are
grouped
grouped
together.
together
Embeddings
embeddings
work
work
the
the
same
same
way,
way
except
except
they
they
map
map
the
the
semantic
semantic
meaning
meaning
of
of
words
words
together
together
or
or
similar
similar
features
features
in
in
virtually
virtually
any
any
other
other
data
data
type.
type
These
these
embeddings
embeddings
can
can
then
then
be
be
used
used
for
for
things
things
like
like
recommendation
recommendation
systems,
systems
search
search
engines,
engines
and
and
even
even
text
text
generation
generation
like
like
chat
chat
gpt.
gpt
But
but
once
once
you
you
have
have
your
your
embeddings,
embeddings
The
the
question
question
becomes,
becomes
where
where
do
do
you
you
store
store
them
them
and
and
how
how
do
do
you
you
query
query
them
them
quickly?
quickly
That's
that's
where
where
vector
vector
databases
databases
come
come
in.
in
In
in
a
a
relational
relational
database,
database
you
you
have
have
rows
rows
and
and
columns.
columns
In
in
a
a
In
in
database,
database
you
you
have
have
documents
documents
and
and
collections,
collections
but
but
in
in
a
a
vector
vector
database,
database
you
you
have
have
arrays
arrays
of
of
numbers
numbers
clustered
clustered
together
together
based
based
on
on
similarity,
similarity
which
which
can
can
be
be
queried
queried
with
with
ultra
ultra
low
low
latency,
latency
making
making
it
it
an
an
ideal
ideal
choice
choice
for
for
AI
ai
driven
driven
applications.
applications
Volational
volational
databases
databases
like
like
Postgres
postgres
have
have
tools
tools
like
like
pgvector
pgvector
to
to
support
support
this
this
type
type
of
of
functionality,
functionality
And
and
Redis
redis
also
also
has
has
1st
1st
class
class
vector
vector
support.
support
But
but
a
a
bunch
bunch
of
of
new
new
native
native
vector
vector
databases
databases
are
are
popping
popping
up,
up
like
like
Weeviate
weeviate
and
and
Milvus
milvus
are
are
open
open
source
source
options
options
written
written
in
in
Go.
go
Then
then
you
you
have
have
Pinecone,
pinecone
which
which
is
is
extremely
extremely
popular,
popular
but
but
is
is
not
not
open
open
source.
source
Then
then
you
you
have
have
Chroma,
chroma
which
which
is
is
based
based
on
on
ClickHouse
clickhouse
under
under
the
the
hood,
hood
and
and
many
many
other
other
options
options
from
from
there.
there
Let's
let's
jump
jump
into
into
some
some
code
code
to
to
see
see
what
what
it
it
looks
looks
like.
like
Here,
here
I'm
i'm
using
using
Chroma
chroma
and
and
JavaScript,
javascript
and
and
the
the
first
first
thing
thing
I'll
i'll
do
do
is
is
create
create
the
the
client,
client
then
then
define
define
an
an
embedding
embedding
function.
function
In
in
this
this
case,
case
it
it
will
will
use
use
the
the
OpenAI
openai
API
api
API
api
to
to
update
update
the
the
embeddings
embeddings
whenever
whenever
a
a
new
new
data
data
point
point
is
is
added.
added
Each
each
data
data
point
point
is
is
just
just
a
a
document
document
with
with
an
an
ID
id
and
and
some
some
text.
text
And
and
finally,
finally
we
we
can
can
query
query
the
the
database
database
ace
ace
by
by
passing
passing
a
a
string
string
of
of
text
text
just
just
like
like
an
an
LLM.
llm
What's
what's
most
most
interesting
interesting
though
though
is
is
that
that
in
in
the
the
query
query
result,
result
we
we
get
get
the
the
data
data
back
back
in
in
addition
addition
to
to
an
an
array
array
a
a
of
of
distances,
distances
with
with
a
a
smaller
smaller
number
number
indicating
indicating
a
a
higher
higher
degree
degree
of
of
similarity.
similarity
That's
that's
pretty
pretty
cool,
cool
but
but
the
the
real
real
reason
reason
that
that
these
these
databases
databases
are
are
so
so
hot
hot
right
right
now
now
is
is
that
that
they
they
can
can
extend
extend
LLMs
llms
with
with
long
long
term
term
memory.
memory
You
you
start
start
with
with
a
a
general
general
purpose
purpose
model,
model
like
like
OpenAI's
openai's
GPT
gpt
4,
4
Meta's
meta's
llama,
llama
or
or
Google's
google's
Lambda,
lambda
then
then
provide
provide
your
your
own
own
data
data
in
in
a
a
vector
vector
database.
database
Base.
base
When
when
the
the
user
user
makes
makes
a
a
prompt,
prompt
you
you
can
can
then
then
query
query
relevant
relevant
documents
documents
from
from
your
your
own
own
database
database
to
to
update
update
the
the
contacts,
contacts
which
which
will
will
customize
customize
the
the
final
final
response,
response
and
and
it
it
can
can
also
also
retrieve
retrieve
historical
historical
data
data
to
to
give
give
the
the
AI
ai
long
long
term
term
memory.
memory
In
in
addition,
addition
they
they
also
also
integrate
integrate
with
with
tools
tools
like
like
langchain
langchain
that
that
combine
combine
multiple
multiple
LLMs
llms
together.
together
It's
it's
all
all
pretty
pretty
crazy,
crazy
and
and
I'm
i'm
working
working
on
on
a
a
tutorial
tutorial
on
on
my
my
second
second
channel
channel
with
with
Weeviate,
weeviate
so
so
make
make
sure
sure
to
to
subscribe
subscribe
Grab
grab
over
over
there
there
if
if
you
you
really
really
wanna
wanna
dive
dive
into
into
this
this
stuff.
stuff
And
and
lastly,
lastly
in
in
related
related
news,
news
if
if
you
you
check
check
out
out
the
the
top
top
trending
trending
repos
repos
in
in
GitHub
github
today,
today
they're
they're
almost
almost
all
all
trying
trying
to
to
create
create
artificial
artificial
general
general
intelligence,
intelligence
like
like
Microsoft's
microsoft's
Jarvis,
jarvis
AutoGPT,
autogpt
and
and
Baby
baby
AGI,
agi
which
which
are
are
tools
tools
that
that
use
use
vector
vector
databases
databases
and
and
LLMs
llms
to
to
prune
prune
themselves.
themselves
And
and
this
this
is
is
terrifying
terrifying
as
as
someone
someone
who
who
just
just
became
became
with
with
a
a
prompt
prompt
engineer.
engineer
I
i
never
never
thought
thought
I'd
i'd
become
become
obsolete
obsolete
twice
twice
in
in
1
1
month.
month
This
this
has
has
been
been
the
the
CodeReport,
codereport
thanks
thanks
for
for
watching,
watching
and
and
I
i
will
will
see
see
you
you
in
in
the
the
next
next
one.
one
success
The speaker discusses vector databases and their benefits for AI applications, including a low latency and continuous high dimensional space called an embedding. They explain how vector databases can be used for various purposes, including recommendation systems, search engines, and text generation. The speaker also discusses new native vector databases like Weeviate and Milzik, as well as the potential for extending LLMs with long term memory and integrating with tools like lang backbone. They conclude by reminding viewers to check out the top trending repos in GitHub and mention a tutorial on creating artificial general intelligence.
Vector databases are so hot right now. WTF are they?
It is April 7, 2023, and you're watching the CodeReport. 1 month ago, vector database Weeviate landed $16,000,000 in Series A funding. Last week, Pinecone DB just got a check for 28,000,000 at a 700,000,000 valuation. And yesterday, Chroma, an open source project with only 1.2 GitHub stars, raised 18,000,000 for its embeddings database. And I just launched my own vector database this morning. We're like pre revenue, pre vision, and pre code, and valued at $420,000,000 Leave your credit card details in the comments if you'd like to invest. But you might be wondering, what the hell is Vector database. Or what the hell is a vector even? Well, that's easy. A vector is just an array of numbers. But what's cool about vectors is that they can represent more complex checks like words, sentences, images, or audio files in a continuous high dimensional space called an embedding. It's kinda like this. When When you go to a party, all of the jocks sit around the TV and watch football. Meanwhile, all the girls find the dance floor, while you group together with all the programming introverts to talk about vectors in the corner. Notice how All the similar objects are grouped together. Embeddings work the same way, except they map the semantic meaning of words together or similar features in virtually any other data type. These embeddings can then be used for things like recommendation systems, search engines, and even text generation like chat gpt. But once you have your embeddings, The question becomes, where do you store them and how do you query them quickly? That's where vector databases come in. In a relational database, you have rows and columns. In a In database, you have documents and collections, but in a vector database, you have arrays of numbers clustered together based on similarity, which can be queried with ultra low latency, making it an ideal choice for AI driven applications. Volational databases like Postgres have tools like pgvector to support this type of functionality, And Redis also has 1st class vector support. But a bunch of new native vector databases are popping up, like Weeviate and Milvus are open source options written in Go. Then you have Pinecone, which is extremely popular, but is not open source. Then you have Chroma, which is based on ClickHouse under the hood, and many other options from there. Let's jump into some code to see what it looks like. Here, I'm using Chroma and JavaScript, and the first thing I'll do is create the client, then define an embedding function. In this case, it will use the OpenAI API API to update the embeddings whenever a new data point is added. Each data point is just a document with an ID and some text. And finally, we can query the database ace by passing a string of text just like an LLM. What's most interesting though is that in the query result, we get the data back in addition to an array a of distances, with a smaller number indicating a higher degree of similarity. That's pretty cool, but the real reason that these databases are so hot right now is that they can extend LLMs with long term memory. You start with a general purpose model, like OpenAI's GPT 4, Meta's llama, or Google's Lambda, then provide your own data in a vector database. Base. When the user makes a prompt, you can then query relevant documents from your own database to update the contacts, which will customize the final response, and it can also retrieve historical data to give the AI long term memory. In addition, they also integrate with tools like langchain that combine multiple LLMs together. It's all pretty crazy, and I'm working on a tutorial on my second channel with Weeviate, so make sure to subscribe Grab over there if you really wanna dive into this stuff. And lastly, in related news, if you check out the top trending repos in GitHub today, they're almost all trying to create artificial general intelligence, like Microsoft's Jarvis, AutoGPT, and Baby AGI, which are tools that use vector databases and LLMs to prune themselves. And this is terrifying as someone who just became with a prompt engineer. I never thought I'd become obsolete twice in 1 month. This has been the CodeReport, thanks for watching, and I will see you in the next one.
The speaker discusses vector databases and their benefits for AI applications, including a low latency and continuous high dimensional space called an embedding. They explain how vector databases can be used for various purposes, including recommendation systems, search engines, and text generation. The speaker also discusses new native vector databases like Weeviate and Milzik, as well as the potential for extending LLMs with long term memory and integrating with tools like lang backbone. They conclude by reminding viewers to check out the top trending repos in GitHub and mention a tutorial on creating artificial general intelligence.