Galileo Protect can be embedded in your production application through gp.invoke() like below:
Copy
Ask AI
USER_QUERY = 'What\'s my SSN? Hint: my SSN is 123-45-6789'MODEL_RESPONSE = 'Your SSN is 123-45-6789'response = gp.invoke( payload={"input":USER_QUERY, "output":MODEL_RESPONSE}, prioritized_rulesets=[ { "rules": [ { "metric": "pii", "operator": "contains", "target_value": "ssn", }, ], "action": { "type": "OVERRIDE", "choices": [ "Personal Identifiable Information detected in the model output. Sorry, I cannot answer that question." ], }, }, ], stage_id=stage_id, timeout=10, # number of seconds for timeout )