# Configure AI

## AI configuration at a glance

AI Configuration controls the AI provider and response preferences used by Atloria's AI
documentation engine. The surface lets you choose a default provider, set response length and
randomness, control streaming, and save a copy of the settings.

| If you need to… | Go to |
|---|---|
| Choose which provider handles AI operations | [Configure the provider and AI settings](#configure-the-provider-and-ai-settings) |
| Adjust response length or randomness | [Configure the provider and AI settings](#configure-the-provider-and-ai-settings) |
| Understand the tabs and available controls | [Understand the configuration surface](#understand-the-configuration-surface) |
| Recover from an unavailable provider or import failure | [When configuration goes wrong](#when-configuration-goes-wrong) |
| Read the wider AI Configuration reference | [AI configuration reference](doc:ai-configuration-reference) |
| Read the wider AI workspace overview | [AI Configuration overview](doc:ai-configuration-overview) |

## Before you start

Before changing a setting, have access to the AI Configuration route and know which provider your
organization intends to use.

Prerequisites

- Know the provider you want to make the default.
- Have the JSON settings file available if you plan to import settings.
- Be ready to check the provider's availability before testing its connection.

The provider list and the initial setting values depend on the environment and the saved browser
settings. Check the values shown on screen before changing them.

## Open AI Configuration

Use the AI settings route to reach the configuration surface.

Prerequisites

- You have access to the Atloria application.

Steps

1. Open **AI Configuration** in Atloria.

**Result:** The AI Configuration surface is open.

## Understand the configuration surface

AI Configuration groups provider selection and advanced response preferences into separate tabs.

The tabs are:

| If you need to… | Select |
|---|---|
| Choose or test an AI provider | **Providers** |
| View current-month AI usage | **Usage** |
| Review recent AI requests | **History** |
| Change response preferences or manage settings files | **Settings** |

The **Providers** tab shows one provider choice for each provider returned to the surface. The
selected choice is the default provider. Each provider also has a **Test Connection** control; that
control is disabled while the provider is unavailable or while its test is running.

The **Settings** tab contains these controls:

| Control | What it changes |
|---|---|
| **Max Tokens** | The maximum number of tokens generated in a response. |
| **Temperature** | The randomness of AI responses. |
| **Enable Streaming** | Whether responses stream in real time. |
| **Auto-Save Settings** | Whether changes are saved automatically to browser storage. |
| **📥 Export Settings** | Downloads the current settings as JSON. |
| **📤 Import Settings** | Opens a file chooser for a JSON settings file. |
| **🔄 Reset to Defaults** | Replaces the current settings with the default settings. |

`Prompts` is not one of the available tabs. The page does not provide required markers or
validation rules for these configuration fields, and it does not provide a separate save button.

## Configure the provider and AI settings

Use this procedure when you need to select the provider or change how AI responses are generated.

Prerequisites

- You are on the AI Configuration surface.
- The provider you want to use appears in **Providers**.

Steps

1. Select **Providers**.
2. Select the radio control beside the provider you want to make the default.
3. Select **Test Connection** for that provider.
4. Select **Settings**.
5. Set **Max Tokens** within the displayed range from `100` to `4000` in increments of `100`.
6. Set **Temperature** within the displayed range from `0` to `1` in increments of `0.1`.
7. Select or clear **Enable Streaming**.
8. Select or clear **Auto-Save Settings**.

Changes are saved to browser storage when you change a setting; no separate save control is
provided.

**Result:** The selected provider and the changed response preferences remain displayed on the
configuration surface.

## Handle provider and settings branches

The provider branch you see depends on the provider list and its availability. The settings branch
you see depends on whether an imported file can be read as JSON.

| If you see… | Do this |
|---|---|
| `No AI providers configured.` and `Please configure your environment variables.` | Arrange for the required provider configuration, then return to **Providers**. |
| `● Unavailable` | Choose an available provider before selecting **Test Connection**. |
| `Testing...` | Wait for the test to finish. |
| `● Available` | The provider is available for testing. |
| `✓ Test Passed` | Continue with the provider as the default choice if it is the provider you need. |
| `✗ Test Failed` | Choose another available provider or correct the provider configuration before trying again. |
| A settings file is ready to use | Select **📤 Import Settings**, then choose the JSON file. |
| You need to discard the current settings | Select **🔄 Reset to Defaults**. |

**Result:** The surface displays the provider state or import/reset outcome associated with the
action you selected. If a message indicates an error, use the troubleshooting table next.

## When configuration goes wrong

Use the message on screen to choose the matching recovery action.

| What you see | Meaning | What to do |
|---|---|---|
| `Failed to import settings:` | The error detail follows this fixed text. | Select **📤 Import Settings** and choose a valid JSON settings file. |
| `Invalid settings file` | The selected file could not be parsed as settings JSON. | Select **📤 Import Settings** and choose a valid JSON settings file. |
| `Failed to read file` | The file could not be read. | Select **📤 Import Settings** and choose a readable JSON settings file. |
| `Failed to load AI settings:` | The browser could not load saved AI settings. | Reload the AI Configuration surface. |
| `Failed to save AI settings:` | The browser could not save the changed AI settings. | Retry the change on the AI Configuration surface. |
| `Failed to reset AI settings:` | The browser could not reset the saved AI settings. | Retry **🔄 Reset to Defaults**. |

The route can also display `404` instead of the configuration surface. In that case, the AI
configuration controls are not available on the screen.

**Result:** You have matched the message on screen to its recovery action and can confirm the
configuration outcome in the next section.

## After you configure AI

After changing a setting, check the selected provider and displayed values on the **Settings**
tab. Use **📥 Export Settings** if you need a portable copy of the browser-stored settings.

For related guidance, continue to [AI Configuration overview](doc:ai-configuration-overview) or
[AI configuration reference](doc:ai-configuration-reference).

**Result:** The configuration surface shows the provider and response preferences you selected.
