SmartParallelPrompt
Namespace: Wisej.AI
Assembly: Wisej.AI
Represents a smart parallel prompt that can execute multiple tasks concurrently.
- C#
- VB.NET
public class SmartParallelPrompt : SmartPrompt
Public Class SmartParallelPrompt
Inherits SmartPrompt
This class extends the SmartPrompt class and provides functionality to run multiple prompts in parallel.
Constructors
SmartParallelPrompt(text)
Initializes a new instance of the SmartParallelPrompt class with optional text.
| Name | Type | Description |
|---|---|---|
| text | String | The text associated with the prompt. Default is null. |
Methods
AskAsync(hub, inputs)
Executes the prompt tasks asynchronously in parallel.
| Parameter | Type | Description |
|---|---|---|
| hub | SmartHub | The smart hub used for executing the tasks. |
| inputs | String[] | An array of input prompts to process in parallel. |
Returns: Task<Message[]>. A task that represents the asynchronous operation. The task result contains an array of Message objects.
This method runs each input through the AskAsync method and tracks the progress using the CurrentIndex property.
var smartPrompt = new SmartParallelPrompt();
var messages = await smartPrompt.RunAsync(hub, new string[] { "input1", "input2" });
Throws:
- ArgumentNullException
Thrown when hub is
null. - ArgumentNullException
Thrown when inputs is
null.
AskAsync(hub, inputs, images)
Executes the prompt tasks asynchronously in parallel.
| Parameter | Type | Description |
|---|---|---|
| hub | SmartHub | The smart hub used for executing the tasks. |
| inputs | String[] | An array of input prompts to process in parallel. |
| images | Image[] | An array of input images to process in parallel. |
Returns: Task<Message[]>. A task that represents the asynchronous operation. The task result contains an array of Message objects.
This method runs each input through the AskAsync method and tracks the progress using the CurrentIndex property.
var smartPrompt = new SmartParallelPrompt();
var messages = await smartPrompt.RunAsync(hub, new string[] { "input1", "input2" });
Throws:
- ArgumentNullException
Thrown when hub is
null. - ArgumentNullException
Thrown when inputs is
null. - ArgumentNullException
Thrown when images is
null.
AskAsync(endpoint, inputs)
Executes the prompt tasks asynchronously in parallel.
| Parameter | Type | Description |
|---|---|---|
| endpoint | SmartEndpoint | The endpoint used for executing the tasks. |
| inputs | String[] | An array of input prompts to process in parallel. |
Returns: Task<Message[]>. A task that represents the asynchronous operation. The task result contains an array of Message objects.
This method runs each input through the AskAsync method and tracks the progress using the CurrentIndex property.
var smartPrompt = new SmartParallelPrompt();
var messages = await smartPrompt.RunAsync(hub, new string[] { "input1", "input2" });
Throws:
- ArgumentNullException
Thrown when inputs is
null.
AskAsync(endpoint, inputs, images)
Executes the prompt tasks asynchronously in parallel.
| Parameter | Type | Description |
|---|---|---|
| endpoint | SmartEndpoint | The endpoint used for executing the tasks. |
| inputs | String[] | An array of input prompts to process in parallel. |
| images | Image[] | An array of input images to process in parallel. |
Returns: Task<Message[]>. A task that represents the asynchronous operation. The task result contains an array of Message objects.
This method runs each input through the AskAsync method and tracks the progress using the CurrentIndex property.
var smartPrompt = new SmartParallelPrompt();
var messages = await smartPrompt.RunAsync(hub, new string[] { "input1", "input2" });
Throws:
- ArgumentNullException
Thrown when inputs is
null.
OnProgress(args)
Raises the Progress event.
| Parameter | Type | Description |
|---|---|---|
| args | ProgressEventArgs | The event data. |
Events
Progress
ProgressEventHandler Occurs when progress is made in the execution of the parallel tasks.
Implements
| Name | Description |
|---|---|
| IToolProvider | Represents a provider that supplies tools. |