-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add implementation of Prisma vectorstore #440
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh nice i like this a lot
an example would probably hel[
43cd9ed
to
b5306ad
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments, looks good otherwise
const pageContent = typeof metadata[this.contentColumn]; | ||
if (pageContent !== "string") | ||
throw new Error("Content column must be a string"); | ||
return new Document({ pageContent, metadata }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd want to remove the pageContent from metadata
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment, it returns the subset a Prisma model (TModel
and TSelectModel
), which do include the this.contentColumn
).
We could remove the content column from the metadata, but I would argue that the metadata should contain the same columns, as user specifies in the dbConfig
.
hello @dqbd, I was wondering if we could use typeorm to avoid adding another orm in the dependencies? |
Hi @MaximeThoonsen!
Both Regardless, I think a TypeORM vectorstore implementation is certainly doable. Will look into it and possibly create a separate PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks!
Add an implementation of Prisma vectorstore, with type safety in mind.
1. Prisma vectorstore implements a mock interface, as it depends on the types generated via
prisma generate
This does mean that the code might be unnecessary brittle compared to hardcoding
@prisma/client
directly in user codebases.2. Added optional generic type argument for Document metadata
Developers can now specify a concrete type for
metadata
prop inDocument
. AFAIK this does not propagate in chains etc, but I believe this to be an useful starting block.3.
fromDocuments
andfromTexts
is currently unsupportedAs there is a significant difficulty upserting entire documents, I've marked these methods as
@deprecated
for now.