NVIDIA / NeMo-Guardrails

NeMo Guardrails is an open-source toolkit for easily adding programmable guardrails to LLM-based conversational systems.
Other
4.2k stars 399 forks source link

Add Private AI Integration #815

Closed letmerecall closed 2 weeks ago

letmerecall commented 1 month ago

Description

This PR introduces an integration for Private AI for PII detection. It adds a detect_pii action which can be used in input, output and retrieval flow.

@Pouyanpi @drazvan

Related Issue(s)

813

Checklist

Pouyanpi commented 1 month ago

Thank you @letmerecall for your PR. I'll review it and update you if needed.

In the meantime, I suggest you to run following command to convert flows.v1.co to Colang 2.x compatible version.

mv ./nemoguardrails/library/privateai/flows.v1.co ./nemoguardrails/library/privateai/flows.co

Then use the migration tool

nemoguardrails convert --from-version '1.0' "./nemoguardrails/library/privateai" --validate

Then remove the main.co

rm nemoguardrails/library/privateai/main.co

If you think it is beneficial you can create a config in ./examples/config folder, similar to patronusai or autoalign.

letmerecall commented 1 month ago

Thank you @letmerecall for your PR. I'll review it and update you if needed.

In the meantime, I suggest you to run following command to convert flows.v1.co to Colang 2.x compatible version.

mv ./nemoguardrails/library/privateai/flows.v1.co ./nemoguardrails/library/privateai/flows.co

Then use the migration tool

nemoguardrails convert --from-version '1.0' "./nemoguardrails/library/privateai" --validate

Then remove the main.co

rm nemoguardrails/library/privateai/main.co

If you think it is beneficial you can create a config in ./examples/config folder, similar to patronusai or autoalign.

Thanks @Pouyanpi! Actually I tried that in my fork (https://github.com/privateai/NeMo-Guardrails/pull/4) but was hesitant to include it as I couldn't find a way to test the flow.

Can you point me to some examples to test Colang 2.x flow? Or do you suggest to still include it without any test?

Pouyanpi commented 4 weeks ago

Thank you @letmerecall for adding Colang 2 flows.

A good example is abc_v2.

If you create a config folder in the examples as I explained above you can use the migration tool to convert that config.

for example

nemoguardrails conver --from-version '1.0' "./examples/bots/abc"

Converts abc to a configuration similar to abc_v2. You can do the same for your example configuration.

This way you can test it yourself. Please note that currently we don't support retrieval flow in Colang 2 but only input and output rails.

letmerecall commented 4 weeks ago

Thank you @letmerecall for adding Colang 2 flows.

A good example is abc_v2.

If you create a config folder in the examples as I explained above you can use the migration tool to convert that config.

for example


nemoguardrails conver --from-version '1.0' "./examples/bots/abc"

Converts abc to a configuration similar to abc_v2. You can do the same for your example configuration.

This way you can test it yourself. Please note that currently we don't support retrieval flow in Colang 2 but only input and output rails.

Perfect! I'll give it a shot. Thanks.