Skip to content
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

Rag opensearch usecase with Beam's MLTransform #32018

Merged
merged 27 commits into from
Oct 3, 2024

Conversation

itsayushpandey
Copy link
Contributor

@itsayushpandey itsayushpandey commented Jul 30, 2024

Added Insertion and Enrichment pipeline for RAG (Retrival Augmented Generation) usecase using OpenSearch vector database #GSOC-259


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@itsayushpandey
Copy link
Contributor Author

R: @damccorm @jrmccluskey

Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

Comment on lines 209 to 212




Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if self.batch_counter == 0:
return

with _InsertEmbeddingInOpenSearchSink(self.host, self.port, self.username, self.password, self.embedded_columns) as sink:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you're instantiating a new instance of the internal class here every time? You wind up creating a new class + client every time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reason I did that because I don't want to bulk push on a stale connection. Given it's a batch push I thought it might be better instead of try catching an exception and reinstantiating a connection after error.
What do you think ?

@itsayushpandey itsayushpandey marked this pull request as draft July 31, 2024 17:49
@jrmccluskey
Copy link
Contributor

I'd recommend rebasing the PR now that the initial RAG PR is merged

@itsayushpandey itsayushpandey marked this pull request as ready for review August 18, 2024 02:42
Copy link
Contributor

@jrmccluskey jrmccluskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase this PR to remove the duplicate code (anything from #31657 that has already been reviewed and merged)

@itsayushpandey itsayushpandey changed the title Rag opensearch Rag opensearch usecase with Beam's MLTransform Aug 21, 2024
@itsayushpandey
Copy link
Contributor Author

@jrmccluskey - thanks for the review suggestions! I have made changes as per your feedback, please let me know if these look good.

Copy link
Contributor

@jrmccluskey jrmccluskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, probably time to focus on cleaning up the notebook

Same note on rebasing the branch, see https://stackoverflow.com/questions/7929369/how-to-rebase-local-branch-onto-remote-master/18442755#18442755

@itsayushpandey
Copy link
Contributor Author

itsayushpandey commented Aug 23, 2024

Code looks good, probably time to focus on cleaning up the notebook

Same note on rebasing the branch, see https://stackoverflow.com/questions/7929369/how-to-rebase-local-branch-onto-remote-master/18442755#18442755

@jrmccluskey - the branch seems upto date with master This branch has no conflicts with the base branch. Am I misunderstanding something?

@damccorm
Copy link
Contributor

damccorm commented Sep 5, 2024

@itsayushpandey I think this is the problem:

image

Your branch doesn't contain the most recent set of changes. To fix, you can:

git remote add upstream https://github.com/apache/beam.git
git fetch upstream
git rebase upstream/main

@itsayushpandey
Copy link
Contributor Author

Hi @damccorm - the trailing commits of branch should have been updated. Can you please check if this looks good to go now?
image

Copy link
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the slow review - has been a very busy stretch. This looks good to me - just had one minor comment, once that is addressed I'll merge

Copy link
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@damccorm damccorm merged commit 1d7b0bc into apache:master Oct 3, 2024
3 checks passed
@itsayushpandey itsayushpandey deleted the rag_opensearch branch October 3, 2024 13:21
reeba212 pushed a commit to reeba212/beam that referenced this pull request Dec 4, 2024
* Adding insertion and enrichment pipeline

* Enhanced Data Schema

* Added Apache Licensed to the notebook

* Adding Chunking Strategy

* removed unused imports

* Modified insertion logic in redis for incorporating chunking strategy

* refacted redis code

* code review changes

* Added chunking code in notebook

* Added code review changes

* Code review changes: using chunking strategy as enum

* Added Code Review Changes

* Code review changes

* Added code review changes

* Added Code Review Changes

* Code review changes

* Ingestion and Enrichment pipeline for OpenSearch Vector DB

* Added logic for reading password from .env file

* Added opensearch vector notebook

* Update credentials.env

* Added code review changes

* Added Description in opensearch notebook

* Added description in opensearch notebook

* Code review changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants