Skip to main content
Overview > Inworld Safety Module Class: InworldSafetyModule | Inherits from: InworldFrameworkModule Module for content safety checking and moderation within the Inworld framework. Provides real-time content analysis to detect potentially harmful or inappropriate content. Integrates with text embedding services for advanced semantic analysis of user inputs and AI responses.

Properties

Methods

Reference

Safety Module Config

SafetyConfig

Gets the current safety configuration instance. Contains the configured safety thresholds and topic settings for content moderation.

Returns

Type: SafetyConfig Description: The safety configuration instance with current threshold settings.

CreationConfig

Gets the safety checker creation configuration instance. Contains settings used during the initialization of the safety checker.

Returns

Type: SafetyCheckerCreationConfig Description: The creation configuration instance for safety checker initialization.

SetupSafetyThreshold

Sets up safety thresholds for content moderation. Replaces current threshold configuration with the provided data.

Parameters

ParameterTypeDescription
safetyDataList<SafetyThreshold>List of safety thresholds to configure for different topic types.

Returns

Type: void

SetupEmbedder

Sets up the text embedder interface for semantic analysis. Required for advanced content understanding and safety classification.

Parameters

ParameterTypeDescription
textEmbedderInterfaceTextEmbedderInterfaceThe text embedder interface to use for content analysis.

Returns

Type: void

SetupSafetyConfig

Configures safety settings based on provided threshold data. Converts SafetyThreshold objects to internal TopicThreshold format.

Parameters

ParameterTypeDescription
safetyThresholdsList<SafetyThreshold>List of safety thresholds to configure.

Returns

Type: void

IsSafe

Checks if the provided sentence is safe according to current safety thresholds. Performs real-time content analysis using the configured safety parameters.

Parameters

ParameterTypeDescription
sentencestringThe text content to analyze for safety violations.

Returns

Type: bool Description: True if the content is considered safe, false if it violates safety thresholds.

Serialized Fields

The following fields are configurable in the Unity Inspector:

Safety Configuration

  • m_SafetyData (List<SafetyThreshold>) - List of safety thresholds for different topic types

Remote Configuration

  • m_Provider (string) - The AI model provider for safety checking
  • m_ModelName (string) - The specific model name to use for safety analysis

Local Configuration

  • m_ModelPath (string) - The file path to a local safety model

Safety Threshold Configuration

The SafetyThreshold class defines safety parameters for content moderation:

SafetyThreshold Properties

  • topic (UnsafeTopic) - The type of unsafe topic to monitor
  • threshold (float) - The threshold value for this topic (typically between 0.0 and 1.0)

Threshold Behavior

  • Lower values (closer to 0.0) are more restrictive and will flag more content as unsafe
  • Higher values (closer to 1.0) are more permissive and will allow more content through

Important Notes

The safety module requires a text embedder module. Your InworldController must initialize one before initializing the safety module.