For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Overview

Learn how to use Umbraco.AI services in your code for chat, embeddings, and more.

Umbraco.AI provides a service layer that wraps Microsoft.Extensions.AI types with Umbraco-specific features like profiles and connections. This section covers how to use these services in your code.

Primary Services

Service
Purpose

IAIChatService

Chat completions and conversational AI

IAIEmbeddingService

Generate vector embeddings for text

Dependency Injection (DI)

All services are registered automatically and can be injected into your controllers, services, and components:

ServiceInjection.cs
public class MyController : UmbracoApiController
{
    private readonly IAIChatService _chatService;
    private readonly IAIEmbeddingService _embeddingService;

    public MyController(
        IAIChatService chatService,
        IAIEmbeddingService embeddingService)
    {
        _chatService = chatService;
        _embeddingService = embeddingService;
    }
}

Using M.E.AI Types

Umbraco.AI uses standard Microsoft.Extensions.AI (M.E.AI) types:

Type
Namespace
Purpose

ChatMessage

Microsoft.Extensions.AI

A message in a conversation

ChatRole

Microsoft.Extensions.AI

User, Assistant, System, Tool

ChatResponse

Microsoft.Extensions.AI

Complete response from chat

ChatResponseUpdate

Microsoft.Extensions.AI

Streaming response chunk

ChatOptions

Microsoft.Extensions.AI

Request options (temperature, and so on)

Quick Examples

Chat Completion

Streaming Chat

Generate Embedding

In This Section

ChatEmbeddingsTools

Last updated

Was this helpful?