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

[Feature] Pangea Cloud Plugin #794

Merged
merged 7 commits into from
Dec 13, 2024
Merged

Conversation

pangea-andrest
Copy link
Contributor

Title: Pangea Cloud Plugin

  • Add a new plugin to call Pangea Cloud AI Guard service

Description: (optional)

  • This plugin include a before and after request hooks to call AI Guard service to process LLM inputs and outputs to analyze and redact text to avoid manipulation of the model, addition of malicious content, and other undesirable data transfers.

Motivation: (optional)
With AI Guard service users could eliminate PII, sensitive data, and malicious content from ingestion pipelines, LLM prompts and responses.

Identify and redact various forms of PII or sensitive information in AI prompts, responses, and context RAG data.
Uncover and block malware submitted by users or ingested through agents or RAG file ingestion.
Remove links to malicious IP addresses, domains, and URLs embedded in prompts, responses, or data vectors.

Related Issues: (optional)

@VisargD
Copy link
Collaborator

VisargD commented Dec 5, 2024

Hey @pangea-andrest , thanks for the PR! We will review this soon.

@narengogi narengogi requested a review from b4s36t4 December 7, 2024 09:22
Copy link
Contributor

@b4s36t4 b4s36t4 left a comment

Choose a reason for hiding this comment

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

Hi, @pangea-andrest. Thanks for raising this PR. Things are almost good, can you please resolve the comments I have raised.

Also you should be adding the plugin handler inside plugins/index.ts.

pangea: {
   textGuard: handler
}

Other than that it's looking good, tested and verified working fine!
cc: @VisargD

plugins/pangea/manifest.json Outdated Show resolved Hide resolved
plugins/pangea/textGuard.ts Outdated Show resolved Hide resolved
plugins/pangea/textGuard.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@b4s36t4 b4s36t4 left a comment

Choose a reason for hiding this comment

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

Can you please fix this one, rest looks good to me. Will approve after this.

plugins/pangea/textGuard.ts Outdated Show resolved Hide resolved
@pangea-andrest
Copy link
Contributor Author

@b4s36t4 @VisargD Please, let me know if we should do something else to get it ready. Thanks!

@b4s36t4
Copy link
Contributor

b4s36t4 commented Dec 12, 2024

Hey, @pangea-andrest. Sorry missed it. Just a small change please, I think you forget to remove the Error class at two places. Can you verify it again pls?

Comment on lines 20 to 26
if (!parameters.credentials?.domain) {
throw Error(`'parameters.credentials.domain' must be set`);
}

if (!parameters.credentials?.apiKey) {
throw Error(`'parameters.credentials.apiKey' must be set`);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, can remove it pls?

Copy link
Contributor Author

@pangea-andrest pangea-andrest Dec 12, 2024

Choose a reason for hiding this comment

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

Sure, I'll do it. Just to confirm, I guess in this case we want to return verdict: false, right? I mean, we do not want that an error in credentials allow malicious content to pass it through.

Copy link
Contributor

@b4s36t4 b4s36t4 Dec 12, 2024

Choose a reason for hiding this comment

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

I don't think so, cause there's no guardrail action happening. It's a pure usage issue, we could simply retrun verdict as true.

Yea, should be good to return true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@b4s36t4 So, is it confirmed as true? It seems that after the edit, you might want to say false.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's ok, will be good for now.

Copy link
Contributor

@b4s36t4 b4s36t4 left a comment

Choose a reason for hiding this comment

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

LGTM!

@VisargD VisargD merged commit ab7fa1c into Portkey-AI:main Dec 13, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants