> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inworld.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Inworld Safety Module

[Overview](../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

* [SafetyConfig](#safetyconfig)
* [CreationConfig](#creationconfig)

## Methods

* [SetupSafetyThreshold](#setupsafetythreshold)
* [SetupEmbedder](#setupembedder)
* [SetupSafetyConfig](#setupsafetyconfig)
* [IsSafe](#issafe)

## Reference

<img src="https://mintcdn.com/inworldai/GzK0EwIb2T2yQTle/Unity/runtime/runtime-reference/images/InworldSafetyModule.png?fit=max&auto=format&n=GzK0EwIb2T2yQTle&q=85&s=53e6ec52f592f107a159a7f356d13994" alt="Safety Module Config" width="598" height="485" data-path="Unity/runtime/runtime-reference/images/InworldSafetyModule.png" />

### 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

| Parameter  | Type                    | Description                                                       |
| ---------- | ----------------------- | ----------------------------------------------------------------- |
| safetyData | `List<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

| Parameter             | Type                    | Description                                              |
| --------------------- | ----------------------- | -------------------------------------------------------- |
| textEmbedderInterface | `TextEmbedderInterface` | The 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

| Parameter        | Type                    | Description                             |
| ---------------- | ----------------------- | --------------------------------------- |
| safetyThresholds | `List<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

| Parameter | Type     | Description                                        |
| --------- | -------- | -------------------------------------------------- |
| sentence  | `string` | The 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.

***
