# Capabilities

A capability represents a type of AI operation. Providers implement capabilities to expose their features, and profiles are configured for a specific capability. Capabilities build on Microsoft.Extensions.AI (M.E.AI) interfaces.

## Available Capabilities

| Capability         | Description                                     | M.E.AI Interface                                |
| ------------------ | ----------------------------------------------- | ----------------------------------------------- |
| **Chat**           | Conversational AI, text generation, completions | `IChatClient`                                   |
| **Embedding**      | Vector embeddings for semantic search           | `IEmbeddingGenerator<string, Embedding<float>>` |
| **Speech-to-Text** | Audio transcription and voice input             | `ISpeechToTextClient`                           |

## Chat Capability

The Chat capability provides conversational AI features:

* Text completion and generation
* Multi-turn conversations
* System prompts and instructions
* Streaming responses
* Tool/function calling

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

```csharp
var messages = new List<ChatMessage>
{
    new(ChatRole.System, "You are a helpful assistant."),
    new(ChatRole.User, "What is Umbraco?")
};

var response = await _chatService.GetChatResponseAsync(
    chat => chat.WithAlias("content-chat"),
    messages);
```

{% endcode %}

## Embedding Capability

The Embedding capability generates vector representations of text:

* Semantic search indexing
* Document similarity
* Clustering and classification
* Retrieval-augmented generation (RAG)

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

```csharp
var embedding = await _embeddingService.GenerateEmbeddingAsync(
    "Umbraco is a content management system");

// embedding.Vector contains the float array
```

{% endcode %}

## Speech-to-Text Capability

The Speech-to-Text capability transcribes audio into text:

* Audio file transcription
* Real-time streaming transcription
* Language detection and hints
* Voice input for the Copilot

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

```csharp
var response = await _sttService.TranscribeAsync(
    stt => stt.WithAlias("voice-notes"),
    audioStream);

// response.Text contains the transcribed text
```

{% endcode %}

## Capability and Profile Relationship

Each profile is configured for exactly one capability. This ensures type safety and appropriate settings:

```
Chat Profile
    ├── Capability: Chat
    ├── Connection: OpenAI Prod
    ├── Model: gpt-4o
    └── Settings: AIChatProfileSettings
            ├── Temperature: 0.7
            ├── MaxTokens: 2000
            └── SystemPrompt: "..."

Embedding Profile
    ├── Capability: Embedding
    ├── Connection: OpenAI Prod
    ├── Model: text-embedding-3-small
    └── Settings: AIEmbeddingProfileSettings

Speech-to-Text Profile
    ├── Capability: Speech-to-Text
    ├── Connection: OpenAI Prod
    ├── Model: whisper-1
    └── Settings: AISpeechToTextProfileSettings
```

## Checking Provider Capabilities

Not all providers support all capabilities. You can check what a provider supports:

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

```csharp
var provider = _registry.GetProvider("openai");

if (provider.HasCapability<IAIChatCapability>())
{
    // Provider supports chat
}

if (provider.HasCapability<IAIEmbeddingCapability>())
{
    // Provider supports embeddings
}

if (provider.HasCapability<IAISpeechToTextCapability>())
{
    // Provider supports speech-to-text
}
```

{% endcode %}

## Capability Interfaces

Capabilities are defined by interfaces in `Umbraco.AI.Core`:

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

```csharp
public interface IAIChatCapability : IAICapability
{
    Task<IChatClient> CreateChatClientAsync(
        object settings,
        AIProfile profile,
        CancellationToken cancellationToken = default);
}
```

{% endcode %}

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

```csharp
public interface IAIEmbeddingCapability : IAICapability
{
    Task<IEmbeddingGenerator<string, Embedding<float>>> CreateEmbeddingGeneratorAsync(
        object settings,
        AIProfile profile,
        CancellationToken cancellationToken = default);
}
```

{% endcode %}

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

```csharp
public interface IAISpeechToTextCapability : IAICapability
{
    Task<ISpeechToTextClient> CreateSpeechToTextClientAsync(
        object settings,
        AIProfile profile,
        CancellationToken cancellationToken = default);
}
```

{% endcode %}

## Related

* [Providers](/ai-in-umbraco/concepts/providers.md) - Implement capabilities
* [Profiles](/ai-in-umbraco/concepts/profiles.md) - Configure capability-specific settings
* [Chat API](/ai-in-umbraco/using-the-api/chat.md) - Use the Chat capability
* [Embeddings API](/ai-in-umbraco/using-the-api/embeddings.md) - Use the Embedding capability
* [Speech-to-Text API](/ai-in-umbraco/using-the-api/speech-to-text.md) - Use the Speech-to-Text capability


---

# 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/capabilities.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.
