| description | Create a profile to configure how AI requests are made and use it in your code. |
|---|
A profile combines a connection with model settings for a specific use case. Profiles let you configure temperature, model selection, and system prompts once and reuse them throughout your application.
- At least one connection created
- In the Umbraco backoffice, navigate to the AI section
- Click Profiles in the tree
- Click Create Profile
Fill in the profile details:
| Field | Description | Example |
|---|---|---|
| Name | A display name for this profile | "Content Assistant" |
| Alias | A unique identifier for lookups | "content-assistant" |
| Capability | The type of AI capability | "Chat" |
| Connection | Which connection to use | "OpenAI Production" |
| Model | The specific model to use | "gpt-4o" |
For chat profiles, you can configure:
| Setting | Description | Default |
|---|---|---|
| Temperature | Controls randomness (0-2). Lower is more focused. | Provider default |
| Max Tokens | Maximum tokens in the response | Provider default |
| System Prompt | Instructions sent with every request | None |
{% hint style="info" %} Leave settings empty to use the model's default values. Only set values you want to override. {% endhint %}
To use this profile when no profile is specified in code:
- Navigate to the AI section > Settings
- Select "Content Assistant" from the Default Chat Profile dropdown
- Click Save
{% hint style="info" %} See Managing Settings for more details on configuring defaults. {% endhint %}
{% code title="ContentController.cs" %}
using Microsoft.Extensions.AI;
using Umbraco.AI.Core.Chat;
public class ContentController : UmbracoApiController
{
private readonly IAIChatService _chatService;
public ContentController(IAIChatService chatService)
{
_chatService = chatService;
}
[HttpPost]
public async Task<IActionResult> GenerateSummary([FromBody] string content)
{
var messages = new List<ChatMessage>
{
new(ChatRole.User, $"Summarize this content:\n\n{content}")
};
// Uses the default profile configured in Settings
var response = await _chatService.GetChatResponseAsync(messages);
return Ok(response.Message.Text);
}
}{% endcode %}
To use a specific profile, pass the profile ID:
{% code title="ContentController.cs" %}
public async Task<IActionResult> GenerateSummary(
[FromBody] string content,
[FromServices] IAIProfileService profileService)
{
var profile = await profileService.GetProfileByAliasAsync("content-assistant");
var messages = new List<ChatMessage>
{
new(ChatRole.User, $"Summarize this content:\n\n{content}")
};
var response = await _chatService.GetChatResponseAsync(profile!.Id, messages);
return Ok(response.Message.Text);
}{% endcode %}
When you make a chat request:
- The profile is resolved by ID or alias
- The associated connection provides credentials
- Profile settings (model, temperature, and so on) configure the request
- Any registered middleware is applied
- The request is sent to the AI provider
Create different profiles for different use cases:
| Profile | Use Case | Model | Temperature |
|---|---|---|---|
content-assistant |
Content suggestions | gpt-4o | 0.7 |
code-helper |
Code generation | gpt-4o | 0.2 |
translator |
Translation | gpt-4o-mini | 0.3 |
Learn more about using the chat API:
{% content-ref url="../using-the-api/chat/README.md" %} Chat {% endcontent-ref %}
Or explore the core concepts:
{% content-ref url="../concepts/README.md" %} Core Concepts {% endcontent-ref %}