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

# Migrating to 0.9.0

> Guide for migrating from 0.8.x to 0.9.0

## Summary

This guide will help you migrate your codebase from 0.8.X to 0.9.0.

## Installation

```bash theme={null}
pip install --upgrade guardrails-ai
```

## List of backwards incompatible changes

1. Guard.use\_many has been removed and its functionality added to Guard.use.
2. Guard.use no longer support specifying uninstantiated validators with its arguments as a tuple.  You must now pass an instantiated validator class.
3. Calling Guard.use with the same `on` value multiple times will overwrite the validators applied to the property specified by `on`.
4. Fetching a Guard by supplying the `name` keyword argument in the constructor is no Longer Supported.  Use Guard.load instead.
5. Guard.fetch\_guard has been removed.  Use Guard.load instead.
6. Guard.upsert\_guard has been removed.  Use Guard.save instead.

### New Guard.use Contract

Guard.use now supports specifying multiple validators.  Use this pattern instead of the removed Guard.use\_many:

```python theme={null}
# ❌ No Longer Supported
Guard().use_many(DetectPII("pii"), ToxicLanguage())

# ✅ New Pattern
Guard().use(DetectPII("pii"), ToxicLanguage())
```

Guard.use no longer supports specifying uninstantiated validators with its arguments as a tuple.

```python theme={null}
# ❌ No Longer Supported
Guard().use(DetectPII, "pii")

# ✅ New Pattern
Guard().use(DetectPII("pii"))
```

Calling Guard.use with the same `on` value multiple times will overwrite the validators applied to the property specified by `on`.

```python theme={null}
# ❌ No Longer Supported
Guard.use(
    DetectPII("pii")
).use(
    ToxicLanguage()
)

# ✅ New Pattern
Guard.use(
    DetectPII("pii"),
    ToxicLanguage()
)

# ✅ Still Supported: Chaining multiple use calls for different `on` values
Guard.use(
    DetectPII("pii"),
    ToxicLanguage(),
    on="output"
).use(
    UnusualPrompt(),
    on="messages"
)

```

### Loading a Guard from the Server

Retrieving a Guard from your guardrails-api server is now facilitated through the Guard.load method.

```python theme={null}
# ❌ No Longer Supported
my_guard = Guard(name="my-guard")

# ❌ No Longer Supported
my_guard = Guard.fetch_guard("my-guard")

# ✅ New Pattern
my_guard = Guard.load(
    "my-guard",
    api_key="my-api-key", # Optional
    base_url="http://localhost:8000" # Optional
)
```

### Persiting a Guard to the Server

In order to persist a Guard configured on your client to your postgres database backed server, use the Guard.save method.

```python theme={null}
# ❌ No Longer Supported: Autosave on init or use
my_guard = Guard(name="my-guard").use(DetectPII())

# ❌ No Longer Supported: upsert_guard
my_guard.upsert_guard()

# ✅ New Pattern
my_guard.save()
```

## Improvements

### Guard.get\_validators

Guard.get\_validators allows you to retrieve the list of validators applied to a specific property.

You can utilize this along with Guard.use to make additive updates to your Guard.

```python theme={null}
my_guard = Guard.load("my_guard")

input_validators = my_guard.get_validators(on="messages")
input_validators.append(DetectPII("pii"))

my_guard.use(*input_validators, on="messages")

my_guard.save()
```
