---
sidebar:
  label: roboto.sentinels
  order: 23
title: roboto.sentinels
---
## Module Contents

### NotSet

```python
roboto.sentinels.NotSet
```

`from roboto.sentinels import NotSet`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L127-L127)

### NotSetType

```python
class roboto.sentinels.NotSetType(**data)
```

`from roboto.sentinels import NotSetType`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L37-L82)

Bases: `pydantic.BaseModel`

A sentinel value for fields (e.g. kwargs) that are not set, useful when 'None' is a meaningful value.

It extends pydantic.BaseModel so that it integrates nicely with pydantic's schema generation/json serialization.

#### NotSetType.openapi_schema_modifier()

```python
@staticmethod
def openapi_schema_modifier(schema: dict[str, Any], model: Any) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L51-L79)

Replace NotSetType with null in anyOf lists.

To use in pydantic.BaseModel, add the following to your model: >>> class Config: ... schema_extra = NotSetType.openapi_schema_modifier

See [https://docs.pydantic.dev/1.10/usage/schema/#schema-customization](https://docs.pydantic.dev/1.10/usage/schema/#schema-customization)

**Parameters**

- **schema** (`dict[str, Any]`)
- **model** (`Any`)

**Returns**

- `None`

### Null

```python
class roboto.sentinels.Null
```

`from roboto.sentinels import Null`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L16-L21)

### PydanticModel

```python
roboto.sentinels.PydanticModel
```

`from roboto.sentinels import PydanticModel`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L13-L13)

### T

```python
roboto.sentinels.T
```

`from roboto.sentinels import T`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L12-L12)

### is_any_set()

```python
def roboto.sentinels.is_any_set(value: PydanticModel) -> bool
```

`from roboto.sentinels import is_any_set`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L116-L124)

Checks whether a Pydantic model has at least one field that is explicitly set.

**Parameters**

- **value** (`PydanticModel`)

**Returns**

- `bool`

### is_not_set()

```python
def roboto.sentinels.is_not_set(value: Any) -> TypeGuard[NotSetType]
```

`from roboto.sentinels import is_not_set`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L85-L86)

**Parameters**

- **value** (`Any`)

**Returns**

- `TypeGuard[NotSetType]`

### is_set()

```python
def roboto.sentinels.is_set(value: Union[T, NotSetType]) -> TypeGuard[T]
```

`from roboto.sentinels import is_set`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L89-L90)

**Parameters**

- **value** (`Union[T, NotSetType]`)

**Returns**

- `TypeGuard[T]`

### maybe_null()

```python
def roboto.sentinels.maybe_null(value: T) -> Union[T, Null]
```

`from roboto.sentinels import maybe_null`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L27-L34)

Returns the null sentinel if value is the string "null" (case-insensitive), otherwise returns value unchanged.

**Parameters**

- **value** (`T`)

**Returns**

- `Union[T, Null]`

### null

```python
roboto.sentinels.null
```

`from roboto.sentinels import null`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L24-L24)

### remove_not_set()

```python
def roboto.sentinels.remove_not_set(value: PydanticModel) -> PydanticModel
```

`from roboto.sentinels import remove_not_set`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L107-L113)

This function round-trips a pydantic model through initialization while ensuring that NotSetType values are not explicitly set. This allows value.model_dump(exclude_unset=True) to be used to generate a correct payload.

**Parameters**

- **value** (`PydanticModel`)

**Returns**

- `PydanticModel`

### value_or_default_if_unset()

```python
def roboto.sentinels.value_or_default_if_unset(
    value: Union[T, NotSetType],
    default: T,
) -> T
```

`from roboto.sentinels import value_or_default_if_unset`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L100-L104)

**Parameters**

- **value** (`Union[T, NotSetType]`)
- **default** (`T`)

**Returns**

- `T`

### value_or_not_set()

```python
def roboto.sentinels.value_or_not_set(value: Optional[T]) -> Union[T, NotSetType]
```

`from roboto.sentinels import value_or_not_set`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/sentinels.py#L93-L97)

**Parameters**

- **value** (`Optional[T]`)

**Returns**

- `Union[T, NotSetType]`
