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

[New Plugin] Medical Advice Detection #688

Closed
wants to merge 18 commits into from

Conversation

Akshay-66
Copy link
Contributor

Plugin Name: Medical Advice Detection
Plugin Description: Detects Medical Advice in the generated response and flags a warning whenever the LLM provides a medical advice.


Core logic:

  • A simple keyword-based detection mechanism is used in both the request and response stages. If any predefined medical keywords are found, the plugin flags a warning.
  • detectMedicalAdvice(): Scans the response for medical keywords.
  • detectMedicalRequest(): Scans the request for medical-related queries.
  • BeforeRequestHook: Detects whether a user query is likely to lead to medical advice (e.g., checking for keywords like "symptoms" or "diagnose").
  • AfterRequestHook: Detects medical advice in the LLM's generated response by scanning for medical-related keywords (e.g., "prescribe," "treatment," "medication")

Related Issues:


Finally all unit tests pass by running

image

@Akshay-66
Copy link
Contributor Author

@b4s36t4 @vrushankportkey
Request for Review / Changes / Approval.

Copy link
Collaborator

@narengogi narengogi left a comment

Choose a reason for hiding this comment

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

Interesting take on a plugin implementation.
I guess this could be called a generic plugin instead of a medicalkeywords plugin. Because this plugin just invokes a function which is expected to be user defined,

imo, this should not be in the default plugin category.

@Akshay-66
Copy link
Contributor Author

Thank you @narengogi for your opinion on this,
It's a great idea to make it as customizable for users for various purposes like medical ,legal and some other privacy / sensitive content / advice (By just changing the keywords given [using it as a template]).

Yes, It just invokes a function, but I'm not aware of more complex logic's and I'm super excited to work on that, can you provide me even more details to improve, like what will be the expectation and result.

Hope you will guide me in the following way.

@narengogi
Copy link
Collaborator

@b4s36t4 I suggest we close this as not required, what do you think?

@b4s36t4
Copy link
Contributor

b4s36t4 commented Nov 25, 2024

Yea, we can close this.

@Akshay-66 Akshay-66 closed this Nov 25, 2024
@Akshay-66
Copy link
Contributor Author

Ok done, Thanks for your Time and Support.

@b4s36t4
Copy link
Contributor

b4s36t4 commented Nov 25, 2024

Thanks for your work @Akshay-66. I know this is a bit complicated task and could've been good if it went well.

If you're up for it you can contribute to new plugins/guardrail, Please try to integrated AWS Bedrock guardrail.

https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-use-independent-api.html

Please let us know if you're willing to do so, I'll create a new issue and get it assigned to you.

Once again thanks for your contribution :)

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