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

Fix: Gracefully handle error when generative_qa_parameters is not provided #3100

Conversation

pyek-bot
Copy link
Contributor

@pyek-bot pyek-bot commented Oct 11, 2024

Description

Gracefully handles error when required parameter is not provided for a rag pipeline.
Introduced in 2.10, we can backport till there if required. Please suggest.

Related Issues

Resolves #3092

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@@ -126,6 +126,11 @@ public void processResponseAsync(
}

GenerativeQAParameters params = GenerativeQAParamUtil.getGenerativeQAParameters(request);
if (params == null) {
throw new IllegalArgumentException(
"generative_qa_parameters not found. Please provide ext.generative_qa_parameters to proceed."
Copy link
Collaborator

Choose a reason for hiding this comment

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

May be we can refer to this link: https://opensearch.org/docs/latest/search-plugins/conversational-search/#step-6-use-the-pipeline-for-rag

so that customer knows which values to provide in this parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, added

Zhangxunmt
Zhangxunmt previously approved these changes Oct 11, 2024
Copy link
Collaborator

@Zhangxunmt Zhangxunmt left a comment

Choose a reason for hiding this comment

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

Adding an unit test to cover this case would makes the change more substantial.

@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval October 14, 2024 19:44 — with GitHub Actions Failure
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval October 14, 2024 19:44 — with GitHub Actions Failure
@dhrubo-os
Copy link
Collaborator

DCO is failing.

@pyek-bot pyek-bot force-pushed the rag_gracefully_handle_missing_params branch from e30acd1 to 290f89d Compare October 14, 2024 19:50
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env-require-approval October 14, 2024 19:51 — with GitHub Actions Inactive
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env-require-approval October 14, 2024 19:51 — with GitHub Actions Inactive
@pyek-bot
Copy link
Contributor Author

DCO is failing.

fixed

@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env-require-approval October 14, 2024 21:16 — with GitHub Actions Inactive
@pyek-bot pyek-bot temporarily deployed to ml-commons-cicd-env-require-approval October 14, 2024 21:16 — with GitHub Actions Inactive
@pyek-bot pyek-bot had a problem deploying to ml-commons-cicd-env-require-approval October 14, 2024 22:28 — with GitHub Actions Failure
@pyek-bot
Copy link
Contributor Author

Please add backport tag upto 2.12, since RAG was introduced in this version according to this doc: https://opensearch.org/docs/latest/search-plugins/search-pipelines/rag-processor/

@dhrubo-os dhrubo-os merged commit 0f7481e into opensearch-project:main Oct 15, 2024
13 of 14 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 15, 2024
…vided (#3100)

* fix: gracefully handle error when generative_qa_parameters is not provided

Signed-off-by: Pavan Yekbote <[email protected]>

* fix: spotless apply

Signed-off-by: Pavan Yekbote <[email protected]>

* docs: adding documentation link to error message

Signed-off-by: Pavan Yekbote <[email protected]>

* tests: adding UT to test null params

Signed-off-by: Pavan Yekbote <[email protected]>

---------

Signed-off-by: Pavan Yekbote <[email protected]>
(cherry picked from commit 0f7481e)
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.12 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.12 2.12
# Navigate to the new working tree
cd .worktrees/backport-2.12
# Create a new branch
git switch --create backport/backport-3100-to-2.12
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0f7481e3fba9833548074660fc79b69aef3ce527
# Push it to GitHub
git push --set-upstream origin backport/backport-3100-to-2.12
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.12

Then, create a pull request where the base branch is 2.12 and the compare/head branch is backport/backport-3100-to-2.12.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 15, 2024
…vided (#3100)

* fix: gracefully handle error when generative_qa_parameters is not provided

Signed-off-by: Pavan Yekbote <[email protected]>

* fix: spotless apply

Signed-off-by: Pavan Yekbote <[email protected]>

* docs: adding documentation link to error message

Signed-off-by: Pavan Yekbote <[email protected]>

* tests: adding UT to test null params

Signed-off-by: Pavan Yekbote <[email protected]>

---------

Signed-off-by: Pavan Yekbote <[email protected]>
(cherry picked from commit 0f7481e)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 15, 2024
…vided (#3100)

* fix: gracefully handle error when generative_qa_parameters is not provided

Signed-off-by: Pavan Yekbote <[email protected]>

* fix: spotless apply

Signed-off-by: Pavan Yekbote <[email protected]>

* docs: adding documentation link to error message

Signed-off-by: Pavan Yekbote <[email protected]>

* tests: adding UT to test null params

Signed-off-by: Pavan Yekbote <[email protected]>

---------

Signed-off-by: Pavan Yekbote <[email protected]>
(cherry picked from commit 0f7481e)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 15, 2024
…vided (#3100)

* fix: gracefully handle error when generative_qa_parameters is not provided

Signed-off-by: Pavan Yekbote <[email protected]>

* fix: spotless apply

Signed-off-by: Pavan Yekbote <[email protected]>

* docs: adding documentation link to error message

Signed-off-by: Pavan Yekbote <[email protected]>

* tests: adding UT to test null params

Signed-off-by: Pavan Yekbote <[email protected]>

---------

Signed-off-by: Pavan Yekbote <[email protected]>
(cherry picked from commit 0f7481e)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 15, 2024
…vided (#3100)

* fix: gracefully handle error when generative_qa_parameters is not provided

Signed-off-by: Pavan Yekbote <[email protected]>

* fix: spotless apply

Signed-off-by: Pavan Yekbote <[email protected]>

* docs: adding documentation link to error message

Signed-off-by: Pavan Yekbote <[email protected]>

* tests: adding UT to test null params

Signed-off-by: Pavan Yekbote <[email protected]>

---------

Signed-off-by: Pavan Yekbote <[email protected]>
(cherry picked from commit 0f7481e)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 15, 2024
…vided (#3100)

* fix: gracefully handle error when generative_qa_parameters is not provided

Signed-off-by: Pavan Yekbote <[email protected]>

* fix: spotless apply

Signed-off-by: Pavan Yekbote <[email protected]>

* docs: adding documentation link to error message

Signed-off-by: Pavan Yekbote <[email protected]>

* tests: adding UT to test null params

Signed-off-by: Pavan Yekbote <[email protected]>

---------

Signed-off-by: Pavan Yekbote <[email protected]>
(cherry picked from commit 0f7481e)
b4sjoo pushed a commit that referenced this pull request Oct 15, 2024
…vided (#3100) (#3111)

* fix: gracefully handle error when generative_qa_parameters is not provided

Signed-off-by: Pavan Yekbote <[email protected]>

* fix: spotless apply

Signed-off-by: Pavan Yekbote <[email protected]>

* docs: adding documentation link to error message

Signed-off-by: Pavan Yekbote <[email protected]>

* tests: adding UT to test null params

Signed-off-by: Pavan Yekbote <[email protected]>

---------

Signed-off-by: Pavan Yekbote <[email protected]>
(cherry picked from commit 0f7481e)

Co-authored-by: Pavan Yekbote <[email protected]>
pyek-bot added a commit to pyek-bot/ml-commons that referenced this pull request Oct 15, 2024
…vided (opensearch-project#3100)

* fix: gracefully handle error when generative_qa_parameters is not provided

Signed-off-by: Pavan Yekbote <[email protected]>

* fix: spotless apply

Signed-off-by: Pavan Yekbote <[email protected]>

* docs: adding documentation link to error message

Signed-off-by: Pavan Yekbote <[email protected]>

* tests: adding UT to test null params

Signed-off-by: Pavan Yekbote <[email protected]>

---------

Signed-off-by: Pavan Yekbote <[email protected]>
dhrubo-os pushed a commit that referenced this pull request Oct 17, 2024
…vided (#3100) (#3106)

* fix: gracefully handle error when generative_qa_parameters is not provided

Signed-off-by: Pavan Yekbote <[email protected]>

* fix: spotless apply

Signed-off-by: Pavan Yekbote <[email protected]>

* docs: adding documentation link to error message

Signed-off-by: Pavan Yekbote <[email protected]>

* tests: adding UT to test null params

Signed-off-by: Pavan Yekbote <[email protected]>

---------

Signed-off-by: Pavan Yekbote <[email protected]>
(cherry picked from commit 0f7481e)

Co-authored-by: Pavan Yekbote <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] RAG processor throws NPE when it is queried without "generative_qa_parameters" parameter
3 participants