# Settings

AI Settings provide a central place to configure system-wide defaults for Umbraco.AI. These settings are stored in the database and managed through the backoffice or programmatically.

## What Settings Store

| Property                       | Description                                                                                                  |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `Id`                           | Fixed identifier (always the same GUID)                                                                      |
| `DefaultChatProfileId`         | The profile used when no profile is specified for chat operations                                            |
| `DefaultEmbeddingProfileId`    | The profile used when no profile is specified for embedding operations                                       |
| `DefaultSpeechToTextProfileId` | The profile used when no profile is specified for speech-to-text operations                                  |
| `ClassifierChatProfileId`      | Optional profile for internal classification tasks (e.g., agent routing). Falls back to default chat profile |

{% hint style="info" %}
Settings are a singleton entity - there is only one settings record for the entire application.
{% endhint %}

## Configuring Default Profiles

The recommended way to configure default profiles is through the backoffice. See [Managing Settings](/ai-in-umbraco/backoffice/managing-settings.md) for step-by-step instructions.

## Using Settings in Code

### Getting Current Settings

{% code title="Example.cs" %}

```csharp
public class SettingsExample
{
    private readonly IAISettingsService _settingsService;

    public SettingsExample(IAISettingsService settingsService)
    {
        _settingsService = settingsService;
    }

    public async Task<AISettings> GetCurrentSettings()
    {
        return await _settingsService.GetSettingsAsync();
    }
}
```

{% endcode %}

### Updating Settings

{% code title="Example.cs" %}

```csharp
public async Task UpdateDefaultProfile(Guid chatProfileId)
{
    var settings = await _settingsService.GetSettingsAsync();
    settings.DefaultChatProfileId = chatProfileId;
    await _settingsService.SaveSettingsAsync(settings);
}
```

{% endcode %}

## How Default Profiles Work

When you call an AI service without specifying a profile:

1. The service checks for a default profile in AI Settings (database).
2. If not found, an exception is thrown.

{% code title="Example.cs" %}

```csharp
// Uses the default chat profile from Settings
var response = await _chatService.GetChatResponseAsync(
    chat => chat.WithAlias("content-chat"),
    messages);

// Explicitly specifies a profile (overrides default)
var response = await _chatService.GetChatResponseAsync(
    chat => chat.WithAlias("content-chat").WithProfile(profileId),
    messages);
```

{% endcode %}

## Classifier Chat Profile

The classifier chat profile is an optional setting that allows you to designate a cheaper or faster model for internal classification tasks. Currently, this is used by the Copilot's "Auto" agent mode to classify user prompts and route them to the best available agent.

### Fallback Chain

When the classifier profile is requested:

1. **Database settings** — `ClassifierChatProfileId` (configured in backoffice)
2. **Configuration file** — `ClassifierChatProfileAlias` in `appsettings.json`
3. **Default chat profile** — Falls back to the standard default chat profile

The fallback chain means you only need to configure the classifier profile if you want to use a different (typically cheaper) model for classification. If not set, the default chat profile is used automatically.

## Configuration File Fallback

For advanced scenarios like Continuous Integration/Continuous Deployment (CI/CD) pipelines or infrastructure-as-code, you can configure defaults via `appsettings.json`:

{% code title="appsettings.json" %}

```json
{
    "Umbraco": {
        "AI": {
            "DefaultChatProfileAlias": "content-writer",
            "DefaultEmbeddingProfileAlias": "embeddings",
            "DefaultSpeechToTextProfileAlias": "transcription",
            "ClassifierChatProfileAlias": "fast-classifier"
        }
    }
}
```

{% endcode %}

{% hint style="warning" %}
Database settings (configured via backoffice) take precedence over configuration file settings. Use configuration files only when you need environment-specific defaults that can't be managed through the backoffice.
{% endhint %}

## Managing Settings

### Via Backoffice

You can configure settings through the backoffice. See [Managing Settings](/ai-in-umbraco/backoffice/managing-settings.md) for step-by-step instructions.

### Via Management API

{% code title="Management API endpoints" %}

```http
GET /umbraco/management/api/v1/ai/settings
PUT /umbraco/management/api/v1/ai/settings
```

{% endcode %}

See [Settings API](/ai-in-umbraco/management-api/settings.md) for details.

## Related

* [Profiles](/ai-in-umbraco/concepts/profiles.md) - The profiles that can be set as defaults
* [Managing Settings](/ai-in-umbraco/backoffice/managing-settings.md) - Backoffice guide


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.umbraco.com/ai-in-umbraco/concepts/settings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
