> 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/smartprompt/wisej.ai.smartparallelprompt.md).

# SmartParallelPrompt

Namespace: **Wisej.AI**

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

* [SmartObject](/ai/components/api/wisej.ai.smartobject.md)
  * [SmartPrompt](/ai/components/api/smartprompt.md)
    * [SmartParallelPrompt](/ai/components/api/smartprompt/wisej.ai.smartparallelprompt.md)

Represents a smart parallel prompt that can execute multiple tasks concurrently.

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

```csharp
public class SmartParallelPrompt : SmartPrompt
```

{% endtab %}

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

```visual-basic
Public Class SmartParallelPrompt
    Inherits SmartPrompt
```

{% endtab %}
{% endtabs %}

This class extends the [SmartPrompt](/ai/components/api/smartprompt.md) class and provides functionality to run multiple prompts in parallel.

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) SmartParallelPrompt(text)

Initializes a new instance of the [SmartParallelPrompt](/ai/components/api/smartprompt/wisej.ai.smartparallelprompt.md) class with optional text.

| Name     | Type                                                          | Description                                             |
| -------- | ------------------------------------------------------------- | ------------------------------------------------------- |
| **text** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text associated with the prompt. Default is `null`. |

## Methods

### ![](/files/ptrKjmmRoQB76pvrIqh0) AskAsync(hub, inputs)

Executes the prompt tasks asynchronously in parallel.

| Parameter  | Type                                                              | Description                                       |
| ---------- | ----------------------------------------------------------------- | ------------------------------------------------- |
| **hub**    | [SmartHub](/ai/components/api/smarthub.md)                        | The smart hub used for executing the tasks.       |
| **inputs** | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | An array of input prompts to process in parallel. |

**Returns:** [Task\<Message\[\]>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains an array of [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md) objects.

This method runs each input through the [AskAsync](/ai/components/api/smartprompt.md#askasync-hub-question-image) method and tracks the progress using the [CurrentIndex](/ai/components/api/smartprompt/wisej.ai.smartparallelprompt.md) property.

```csharp

var smartPrompt = new SmartParallelPrompt();
var messages = await smartPrompt.RunAsync(hub, new string[] { "input1", "input2" });

```

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *hub* is `null`.
* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *inputs* is `null`.

### ![](/files/ptrKjmmRoQB76pvrIqh0) AskAsync(hub, inputs, images)

Executes the prompt tasks asynchronously in parallel.

| Parameter  | Type                                                                    | Description                                       |
| ---------- | ----------------------------------------------------------------------- | ------------------------------------------------- |
| **hub**    | [SmartHub](/ai/components/api/smarthub.md)                              | The smart hub used for executing the tasks.       |
| **inputs** | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string)       | An array of input prompts to process in parallel. |
| **images** | [Image\[\]](https://docs.microsoft.com/dotnet/api/system.drawing.image) | An array of input images to process in parallel.  |

**Returns:** [Task\<Message\[\]>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains an array of [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md) objects.

This method runs each input through the [AskAsync](/ai/components/api/smartprompt.md#askasync-hub-question-image) method and tracks the progress using the [CurrentIndex](/ai/components/api/smartprompt/wisej.ai.smartparallelprompt.md) property.

```csharp

var smartPrompt = new SmartParallelPrompt();
var messages = await smartPrompt.RunAsync(hub, new string[] { "input1", "input2" });

```

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *hub* is `null`.
* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *inputs* is `null`.
* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *images* is `null`.

### ![](/files/ptrKjmmRoQB76pvrIqh0) AskAsync(endpoint, inputs)

Executes the prompt tasks asynchronously in parallel.

| Parameter    | Type                                                              | Description                                       |
| ------------ | ----------------------------------------------------------------- | ------------------------------------------------- |
| **endpoint** | [SmartEndpoint](/ai/components/api/smartendpoint.md)              | The endpoint used for executing the tasks.        |
| **inputs**   | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | An array of input prompts to process in parallel. |

**Returns:** [Task\<Message\[\]>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains an array of [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md) objects.

This method runs each input through the [AskAsync](/ai/components/api/smartprompt.md#askasync-hub-question-image) method and tracks the progress using the [CurrentIndex](/ai/components/api/smartprompt/wisej.ai.smartparallelprompt.md) property.

```csharp

var smartPrompt = new SmartParallelPrompt();
var messages = await smartPrompt.RunAsync(hub, new string[] { "input1", "input2" });

```

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *inputs* is `null`.

### ![](/files/ptrKjmmRoQB76pvrIqh0) AskAsync(endpoint, inputs, images)

Executes the prompt tasks asynchronously in parallel.

| Parameter    | Type                                                                    | Description                                       |
| ------------ | ----------------------------------------------------------------------- | ------------------------------------------------- |
| **endpoint** | [SmartEndpoint](/ai/components/api/smartendpoint.md)                    | The endpoint used for executing the tasks.        |
| **inputs**   | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string)       | An array of input prompts to process in parallel. |
| **images**   | [Image\[\]](https://docs.microsoft.com/dotnet/api/system.drawing.image) | An array of input images to process in parallel.  |

**Returns:** [Task\<Message\[\]>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains an array of [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md) objects.

This method runs each input through the [AskAsync](/ai/components/api/smartprompt.md#askasync-hub-question-image) method and tracks the progress using the [CurrentIndex](/ai/components/api/smartprompt/wisej.ai.smartparallelprompt.md) property.

```csharp

var smartPrompt = new SmartParallelPrompt();
var messages = await smartPrompt.RunAsync(hub, new string[] { "input1", "input2" });

```

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when *inputs* is `null`.

### ![](/files/ptrKjmmRoQB76pvrIqh0) OnProgress(args)

Raises the [Progress](#progress) event.

| Parameter | Type                                                                                             | Description     |
| --------- | ------------------------------------------------------------------------------------------------ | --------------- |
| **args**  | [ProgressEventArgs](https://docs.wisej.com/api?q=wisej.ai.smartparallelprompt+progresseventargs) | The event data. |

## Events

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

[ProgressEventHandler](https://docs.wisej.com/api?q=wisej.ai.smartparallelprompt+progresseventhandler) Occurs when progress is made in the execution of the parallel tasks.

## 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/smartprompt/wisej.ai.smartparallelprompt.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.
