> 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.smartreportadapter.md).

# SmartReportAdapter

Namespace: **Wisej.AI.Adapters**

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

* [SmartAdapter](/ai/components/api/smartadapter.md)
  * [SmartReportAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartreportadapter.md)

Enhances the ChatBox control to allow seamless PDF report queries using an AI provider.

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

```csharp
public class SmartReportAdapter : SmartAdapter
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

Utilizes these services: [IDocumentConversionService](/ai/components/api/services/idocumentconversionservice.md).\
The [SmartReportAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartreportadapter.md) class extends the functionality of a [ChatBox](#chatbox) to provide capabilities for reading and interpreting reports. It utilizes prompts and sessions to interact with the user and process report data.

## Constructors

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

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

## Properties

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Gets or sets a value indicating whether the history of the conversation is cleared after each response. (Default: `False`)

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the avatar image source for the bot. (Default: `"resource.wx/Wisej.AI/Icons/wisej-avatar.svg"`)

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the name of the bot. (Default: `"Wisej.AI"`)

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

[ChatBox](https://docs.wisej.com/api?q=wisej.web.ext.chatcontrol.chatbox): Gets the [ChatBox](#chatbox) control associated with this adapter.

### ![](/files/KL0Ik37djZRr8a07Wopd) ConversionService

[IDocumentConversionService](/ai/components/api/services/idocumentconversionservice.md): Gets or sets the document conversion service used for converting documents to text.

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

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the prompt to execute. Used only when the adapter is not connected to a [ChatBox](#chatbox). (Default: `null`)

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

[Stream](https://docs.microsoft.com/dotnet/api/system.io.stream): Gets or sets the PDF source stream for the report.

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

[User](https://docs.wisej.com/api?q=wisej.web.ext.chatcontrol.user): Gets the user associated with the bot.

## Methods

### ![](/files/ptrKjmmRoQB76pvrIqh0) AskAsync(question)

| Parameter    | Type                                                          | Description |
| ------------ | ------------------------------------------------------------- | ----------- |
| **question** | [String](https://docs.microsoft.com/dotnet/api/system.string) |             |

**Returns:** [Task\<String>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1).

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  When question is null.

### ![](/files/KL0Ik37djZRr8a07Wopd) evaluate\_expression(expression)

Evaluates a mathematical expression asynchronously.

| Parameter      | Type                                                          | Description                              |
| -------------- | ------------------------------------------------------------- | ---------------------------------------- |
| **expression** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The mathematical expression to evaluate. |

**Returns:** [Task\<Object>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains the evaluated result of the expression.

This method uses the browser's evaluation engine to compute the result of the given expression.

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

Raises the [AnswerReceived](#answerreceived) event.

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

### ![](/files/KL0Ik37djZRr8a07Wopd) OnControlCreated(control)

| Parameter   | Type                                                      | Description |
| ----------- | --------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) |             |

### ![](/files/KL0Ik37djZRr8a07Wopd) OnControlDisposed(control)

| Parameter   | Type                                                      | Description |
| ----------- | --------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) |             |

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

Raises the [ReadingReport](#readingreport) event.

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

### ![](/files/ptrKjmmRoQB76pvrIqh0) ResetSession(removeMessages)

Resets the conversation history.

| Parameter          | Type                                                            | Description                                                                     |
| ------------------ | --------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| **removeMessages** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | Indicates whether all messages from the ChatBox control should also be removed. |

### ![](/files/KL0Ik37djZRr8a07Wopd) RunAsyncCore(control)

Executes the core logic asynchronously for running the session.

| Parameter   | Type                                                      | Description                              |
| ----------- | --------------------------------------------------------- | ---------------------------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control associated with the session. |

**Returns:** [Task\<Message>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task representing the asynchronous operation.

## Events

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

[AnswerReceivedHandler](https://docs.wisej.com/api?q=wisej.ai.adapters.smartreportadapter+answerreceivedhandler) Occurs when an answer is received from the session.

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

[ReadingReportEventHandler](https://docs.wisej.com/api?q=wisej.ai.adapters.smartreportadapter+readingreporteventhandler) Occurs when a report is being read.

## 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.smartreportadapter.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.
