Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: Write/retrieve chunks using postgres #17
feat: Write/retrieve chunks using postgres #17
Changes from 3 commits
47f8392
cc85481
e1b0082
7c39b94
b0cb245
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
It seems like we could invert this and use
SELECT DISTINCT ... from chunk
to get the deduplicated chunks.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.
Maybe? I want to get something in first and then play with it. I'd like to be able to point a pgsql repl at the database with chunks loaded in, and then see what works (and also use explain to see what the query does, etc.). Deferring.
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.
If this is an error, shouldn't it throw an exception?
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.
It could -- but with background tasks, there isn't really anything to do with that error. What I think we actually need to do is mark the document (or ingestion associated with the document) as failed and/or do some kind of dead letter. That said -- perhaps we shouldn't treat this as an error?
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.
Can we not return the chunk ID's or something? This seems like an assumption that's going to cause bugs as soon as we support updating a document.
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.
We could. My thinking was that we could write them into the DB rather than trying to keep them in memory and then read them back out. But, I think that both llamaindex and various other embeddings will lead to the whole text having to fit in memory anyway during an ingest, so maybe it doesn't matter.
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.
Actually, I take that back. There isn't a great way to do that. Specifically:
fetch
, we can't provide a list of rows to insert -- it needs to be a single query.I think I'll leave as is for this PR. I think we could handle update in a variety of ways:
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.
yeah, including an "ingest version" or something that we could filter on the other side would work.