It requires some knowledge of OpenAI's moderation endpoint results. See docs here.class CustomModeration(OpenAIModerationChain):    def _moderate(self, text: str, results: dict) -> str:        if results["flagged"]:            error_str = f"The following text was found that violates OpenAI's content policy: {text}"            return error_str        return textcustom_moderation = CustomModeration()custom_moderation.run("This is okay")    'This is okay'custom_moderation.run("I will kill you")    "The following text was found that violates OpenAI's content policy: I will kill you"How to append a Moderation chain to an LLMChain‚ÄãTo easily combine a moderation chain with an LLMChain, you can use the SequentialChain abstraction.Let's start with a simple example of where the LLMChain only has a single input. For this purpose,
This notebook walks through examples of how to use a moderation chain, and several common ways for doing so.
This notebook walks through examples of how to use a moderation chain, and several common ways for doing so. ->: It requires some knowledge of OpenAI's moderation endpoint results. See docs here.class CustomModeration(OpenAIModerationChain):    def _moderate(self, text: str, results: dict) -> str:        if results["flagged"]:            error_str = f"The following text was found that violates OpenAI's content policy: {text}"            return error_str        return textcustom_moderation = CustomModeration()custom_moderation.run("This is okay")    'This is okay'custom_moderation.run("I will kill you")    "The following text was found that violates OpenAI's content policy: I will kill you"How to append a Moderation chain to an LLMChain‚ÄãTo easily combine a moderation chain with an LLMChain, you can use the SequentialChain abstraction.Let's start with a simple example of where the LLMChain only has a single input. For this purpose,