# SmartObject

Namespace: **Wisej.AI**

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

Provides common events and properties to [SmartPrompt](/ai/components/api/smartprompt.md), [SmartSession](/ai/components/api/smartsession.md), and [SmartHub](/ai/components/api/smarthub.md) objects.

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

```csharp
public class SmartObject : Component
```

{% endtab %}

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

```visual-basic
Public Class SmartObject
    Inherits Component
```

{% endtab %}
{% endtabs %}

## Properties

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Gets a value indicating whether the session has tools.

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

[ParameterCollection](https://docs.wisej.com/api?q=wisej.ai.parametercollection): Gets the collection of parameters for the session.

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

[ToolCollection](https://docs.wisej.com/api?q=wisej.ai.smarttool+toolcollection): Gets the collection of tools available in the session.

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

[Metrics](/ai/components/api/smartendpoint/wisej.ai.smartendpoint.metrics.md): Gets the usage metrics for the session.

## Methods

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

Clears all tools from the smart prompt.

### ![](/files/KL0Ik37djZRr8a07Wopd) OnAfterInvokeTool(args)

Raises the [AfterInvokeTool](#afterinvoketool) event.

| Parameter | Type                                                                                            | Description                                                                                                                             |
| --------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| **args**  | [InvokeToolEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.invoketooleventargs.md) | The [InvokeToolEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.invoketooleventargs.md) instance containing the event data. |

### ![](/files/KL0Ik37djZRr8a07Wopd) OnAfterResponseReceived(args)

Raises the [AfterResponseReceived](#afterresponsereceived) event.

| Parameter | Type                                                                                        | Description                                                                                                                         |
| --------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| **args**  | [MessagesEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.messageseventargs.md) | The [MessagesEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.messageseventargs.md) instance containing the event data. |

### ![](/files/KL0Ik37djZRr8a07Wopd) OnBeforeInvokeTool(args)

Raises the [BeforeInvokeTool](#beforeinvoketool) event.

| Parameter | Type                                                                                            | Description                                                                                                                             |
| --------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| **args**  | [InvokeToolEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.invoketooleventargs.md) | The [InvokeToolEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.invoketooleventargs.md) instance containing the event data. |

### ![](/files/KL0Ik37djZRr8a07Wopd) OnBeforeSendRequest(args)

Raises the [BeforeSendRequest](#beforesendrequest) event.

| Parameter | Type                                                                                        | Description                                                                                                                         |
| --------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| **args**  | [MessagesEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.messageseventargs.md) | The [MessagesEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.messageseventargs.md) instance containing the event data. |

### ![](/files/KL0Ik37djZRr8a07Wopd) OnConvertParameter(args)

Raises the [ConvertParameter](#convertparameter) event.

| Parameter | Type                                                                                                        | Description                                                                                                                                         |
| --------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| **args**  | [ConvertParameterEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.convertparametereventargs.md) | The [ConvertParameterEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.convertparametereventargs.md) instance containing the event data. |

### ![](/files/ptrKjmmRoQB76pvrIqh0) OnDone(e)

Raises the [Done](#done) event.

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

### ![](/files/KL0Ik37djZRr8a07Wopd) OnError(args)

Raises the [Error](#error) event.

| Parameter | Type                                                                                  | Description                                                                                                                   |
| --------- | ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **args**  | [ErrorEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.erroreventargs.md) | The [ErrorEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.erroreventargs.md) instance containing the event data. |

### ![](/files/ptrKjmmRoQB76pvrIqh0) OnPrepareMessages(e)

Raises the [PrepareMessages](#preparemessages) event.

| Parameter | Type                                                                                        | Description                                                                                                                  |
| --------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [MessagesEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.messageseventargs.md) | An [MessagesEventArgs](/ai/components/api/smarthub/wisej.ai.smartsession.messageseventargs.md) that contains the event data. |

### ![](/files/ptrKjmmRoQB76pvrIqh0) OnStart(e)

Raises the [Start](#start) event.

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

## Events

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

[InvokeToolEventHandler](/ai/components/api/smarthub/wisej.ai.smartsession.invoketooleventhandler.md) Occurs after a tool is invoked.

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

[MessagesEventHandler](/ai/components/api/smarthub/wisej.ai.smartsession.messageseventhandler.md) Occurs after a response is received.

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

[InvokeToolEventHandler](/ai/components/api/smarthub/wisej.ai.smartsession.invoketooleventhandler.md) Occurs before a tool is invoked.

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

[MessagesEventHandler](/ai/components/api/smarthub/wisej.ai.smartsession.messageseventhandler.md) Occurs before a request is sent.

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

[ConvertParameterEventHandler](/ai/components/api/smarthub/wisej.ai.smartsession.convertparametereventhandler.md) Occurs when a parameter needs to be converted.

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

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Occurs when the session is done processing a question.

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

[ErrorEventHandler](/ai/components/api/smarthub/wisej.ai.smartsession.erroreventhandler.md) Occurs when an error is encountered.

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

[MessagesEventHandler](/ai/components/api/smarthub/wisej.ai.smartsession.messageseventhandler.md) Occurs after the messages have been prepared and before they are send to the AI.

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

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Occurs when the session starts processing a question.

## Inherited By

| Name                                                                                  | Description                                                                                                                                     |
| ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| [SmartAgentPrompt](/ai/components/api/smartprompt/wisej.ai.smartagentprompt.md)       | TODO:                                                                                                                                           |
| [SmartParallelPrompt](/ai/components/api/smartprompt/wisej.ai.smartparallelprompt.md) | Represents a smart parallel prompt that can execute multiple tasks concurrently.                                                                |
| [SmartHub](/ai/components/api/smarthub.md)                                            | Represents a SmartHub component that provides AI capabilities to controls within a container.                                                   |
| [SmartPrompt](/ai/components/api/smartprompt.md)                                      | Represents a smart prompt component that can process and manage prompts with tools and parameters.                                              |
| [SmartRealtimeSession](/ai/components/api/wisej.ai.smartrealtimesession.md)           |                                                                                                                                                 |
| [SmartSession](/ai/components/api/smartsession.md)                                    | Represents a session that manages interactions with a smart hub and endpoint, handling prompts, messages, and tools within the session context. |


---

# 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.wisej.com/ai/components/api/wisej.ai.smartobject.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.
