> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/smartadapter/wisej.ai.adapters.smartrealtimeadapter.md).

# SmartRealtimeAdapter

Namespace: **Wisej.AI.Adapters**

Assembly: **Wisej.AI** (3.5.0.0)

* [SmartAdapter](/ai/components/api/smartadapter.md)
  * [SmartRealtimeAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartrealtimeadapter.md)

Represents a smart adapter that provides real-time data processing capabilities for use with the [OpenAIEndpointRealtime](/ai/components/api/smartendpoint/wisej.ai.endpoints.openaiendpointrealtime.md) endpoint.

{% tabs %}
{% tab title="C#" %}

```csharp
public class SmartRealtimeAdapter : SmartAdapter
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class SmartRealtimeAdapter
    Inherits SmartAdapter
```

{% endtab %}
{% endtabs %}

The `SmartRealtimeAdapter` class extends the [SmartAdapter](/ai/components/api/smartadapter.md) base class to enable real-time data handling and integration with OpenAI's real-time endpoint. This adapter is designed to facilitate seamless communication and data exchange in scenarios where immediate processing and response are required.

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) SmartRealtimeAdapter()

Initializes a new instance of the [SmartRealtimeAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartrealtimeadapter.md) class.

This constructor sets up the [SmartRealtimeAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartrealtimeadapter.md) by initializing the internal prompt and subscribing to the application's refresh event. The prompt is initialized with a default label, and the adapter will respond to application-wide refresh events for real-time updates.

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) Enabled

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Gets or sets a value indicating whether the component accepts voice input from the user. (Default: `True`)

When set to `true` (the default value), the component is enabled to receive and process voice input from the user. Setting this property to `false` disables voice input functionality for the component.

### ![](/files/ptrKjmmRoQB76pvrIqh0) Listening

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Gets a value indicating whether the component is currently listening for the user's voice.

The [Listening](#listening) property reflects the current listening state of the component.

### ![](/files/ptrKjmmRoQB76pvrIqh0) Muted

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Gets or sets a value indicating whether the component is muted. (Default: `False`)

When set to `true`, the component is muted and may not produce sound or notifications. The default value is `false`.

### ![](/files/ptrKjmmRoQB76pvrIqh0) TranscriptionEnabled

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Gets or sets a value indicating whether transcription functionality is enabled. (Default: `False`)

When set to `true`, transcription features are activated. The default value is `false`.

### ![](/files/ptrKjmmRoQB76pvrIqh0) Voice

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the voice of the model. (Default: `"Alloy"`)

Supported voices include: Alloy (default), Ash, Ballad, Coral, Echo, Sage, Shimmer, Verse. New voices can be used as they become available.

## Methods

### ![](/files/KL0Ik37djZRr8a07Wopd) CreateSession\<T>(systemPrompt)

| Parameter                                         | Type                                             | Description |
| ------------------------------------------------- | ------------------------------------------------ | ----------- |
| **T**                                             |                                                  |             |
| **systemPrompt** ![](/files/52BqKf9SltWQ97FbQSBF) | [SmartPrompt](/ai/components/api/smartprompt.md) |             |

**Returns:** [T](/ai/components/api/smartadapter/wisej.ai.adapters.smartrealtimeadapter.md).

### ![](/files/KL0Ik37djZRr8a07Wopd) OnAnswerReceived(e)

Raises the [AnswerReceived](#answerreceived) event.

| Parameter | Type                                                                                                                   | Description                                                                                                                                                    |
| --------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [AnswerReceivedEventArgs](https://docs.wisej.com/api?q=wisej.ai.adapters.smartrealtimeadapter+answerreceivedeventargs) | The [AnswerReceivedEventArgs](https://docs.wisej.com/api?q=wisej.ai.adapters.smartrealtimeadapter.answerreceivedeventargs) instance containing the event data. |

This method invokes the [AnswerReceived](#answerreceived) event, passing the specified event arguments to all registered event handlers.

### ![](/files/KL0Ik37djZRr8a07Wopd) OnEnabledChanged(e)

Raises the [EnabledChanged](#enabledchanged) event.

| Parameter | Type                                                                | Description                                                                                                   |
| --------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) instance that contains the event data. |

This method is called to trigger the [EnabledChanged](#enabledchanged) event. Derived classes can override this method to provide additional logic when the event is raised.

### ![](/files/KL0Ik37djZRr8a07Wopd) OnListeningChanged(e)

Raises the [ListeningChanged](#listeningchanged) event.

| Parameter | Type                                                                | Description                                                                                                |
| --------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) instance containing the event data. |

This method is called to notify subscribers that the listening state has changed. Derived classes can override this method to provide custom event data or additional logic.

### ![](/files/KL0Ik37djZRr8a07Wopd) OnMutedChanged(e)

Raises the [MutedChanged](#mutedchanged) event.

| Parameter | Type                                                                | Description                                                                                                |
| --------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) instance containing the event data. |

This method is called to notify subscribers that the muted state has changed. Derived classes can override this method to provide custom event data or additional logic.

### ![](/files/KL0Ik37djZRr8a07Wopd) OnTranscriptionReceived(e)

Raises the [TranscriptionReceived](#transcriptionreceived) event.

| Parameter | Type                                                                                                                                 | Description                                                                                                                                                                  |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [TranscriptionReceivedEventArgs](https://docs.wisej.com/api?q=wisej.ai.adapters.smartrealtimeadapter+transcriptionreceivedeventargs) | The [TranscriptionReceivedEventArgs](https://docs.wisej.com/api?q=wisej.ai.adapters.smartrealtimeadapter.transcriptionreceivedeventargs) instance containing the event data. |

This protected virtual method allows derived classes to trigger the [TranscriptionReceived](#transcriptionreceived) event. Override this method to provide custom event invocation logic.

### ![](/files/ptrKjmmRoQB76pvrIqh0) Reset()

Resets the current conversation with the OpenAI Realtime API endpoint.

This method clears the ongoing conversation state, allowing a new conversation to begin with the OpenAI endpoint. It is useful when you want to discard the current context and start fresh.

### ![](/files/ptrKjmmRoQB76pvrIqh0) StartListening()

Starts capturing and processing user voice input through the OpenAI Realtime API.

Call this method to begin listening for user voice input. The component will capture audio from the input device, transmit it to the OpenAI Realtime API, and process the response in real time. This enables interactive voice-driven features within your application.

### ![](/files/ptrKjmmRoQB76pvrIqh0) StopListening()

Stops capturing and processing user voice input.

Call this method to stop listening for user voice input. The component will cease capturing audio from the input device and terminate any ongoing communication with the OpenAI Realtime API. This is useful for conserving resources or when voice input is no longer required.

## Events

### ![](/files/ptrKjmmRoQB76pvrIqh0) AnswerReceived

[AnswerReceivedEventHandler](https://docs.wisej.com/api?q=wisej.ai.adapters.smartrealtimeadapter+answerreceivedeventhandler) Occurs when an answer is received.

Subscribe to this event to handle actions when an answer is received. The event provides [AnswerReceivedEventArgs](https://docs.wisej.com/api?q=wisej.ai.adapters.smartrealtimeadapter.answerreceivedeventargs) containing details about the received answer.

### ![](/files/ptrKjmmRoQB76pvrIqh0) EnabledChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Occurs when the enabled state of the object changes.

Subscribe to this event to be notified whenever the enabled state of the object is modified. The event provides standard [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) data.

### ![](/files/ptrKjmmRoQB76pvrIqh0) ListeningChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Occurs when the listening state of the component changes.

Subscribe to this event to be notified when the listening state is updated, such as when the component starts or stops listening for input.

### ![](/files/ptrKjmmRoQB76pvrIqh0) MutedChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Occurs when the muted state of the component changes.

Subscribe to this event to be notified when the muted state is updated, such as when the component is muted or unmuted.

### ![](/files/ptrKjmmRoQB76pvrIqh0) TranscriptionReceived

[TranscriptionReceivedEventHandler](https://docs.wisej.com/api?q=wisej.ai.adapters.smartrealtimeadapter+transcriptionreceivedeventhandler) Occurs when a transcription is received.

Subscribe to this event to handle actions when a new transcription is received. The event provides [TranscriptionReceivedEventArgs](https://docs.wisej.com/api?q=wisej.ai.adapters.smartrealtimeadapter.transcriptionreceivedeventargs) containing details about the transcription.

## Implements

| Name                                                                              | Description                                |
| --------------------------------------------------------------------------------- | ------------------------------------------ |
| [IToolProvider](/ai/components/api/smarttool/wisej.ai.smarttool.itoolprovider.md) | Represents a provider that supplies tools. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/ai/components/api/smartadapter/wisej.ai.adapters.smartrealtimeadapter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
