SmartObjectAdapter
Namespace: Wisej.AI.Adapters
Assembly: Wisej.AI
Converts unstructured text into a structured .NET object.
- C#
- VB.NET
public class SmartObjectAdapter : SmartAdapter
Public Class SmartObjectAdapter
Inherits SmartAdapter
This class provides methods to convert text, images, streams, and clipboard content into .NET objects. It supports OCR for image processing and can handle multiple iterations to resolve missing values.
Constructors
SmartObjectAdapter()
Initializes a new instance of the SmartObjectAdapter class.
SmartObjectAdapter(container)
Initializes a new instance of the SmartObjectAdapter class with the specified container.
| Name | Type | Description |
|---|---|---|
| container | IContainer | An IContainer that represents the container of the component. |
Properties
MaxIterations
Int32: Gets or sets the maximum number of times the adapter will try to use the available tools to complete the missing values. (Default: 2)
If the adapter was not provided any tool, this property is ignored since it will not try to resolve missing values.
UseOCR
Boolean: Gets or sets a value indicating whether OCR should be used for image processing. (Default: False)
Methods
Dispose(disposing)
Releases the unmanaged resources used by the SmartObjectAdapter and optionally releases the managed resources.
| Parameter | Type | Description |
|---|---|---|
| disposing | Boolean | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
FromClipboardAsync<T>()
Converts the clipboard content to an object of type T .
| Parameter | Type | Description |
|---|---|---|
| T | The type of the object to return. |
Returns: Task<T>. A task that represents the asynchronous operation. The task result contains the converted object.
FromClipboardAsync(objectType)
Converts the clipboard content to an object of the specified type.
| Parameter | Type | Description |
|---|---|---|
| objectType | Type | The type of the object to return. |
Returns: Task<Object>. A task that represents the asynchronous operation. The task result contains the converted object.
FromImageAsync<T>(image)
Converts the specified image to an object of type T .
| Parameter | Type | Description |
|---|---|---|
| T | The type of the object to return. | |
| image | Image | The image to convert. |
Returns: Task<T>. A task that represents the asynchronous operation. The task result contains the converted object.
FromImageAsync(image, objectType)
Converts the specified image to an object of the specified type.
| Parameter | Type | Description |
|---|---|---|
| image | Image | The image to convert. |
| objectType | Type | The type of the object to return. |
Returns: Task<Object>. A task that represents the asynchronous operation. The task result contains the converted object.
FromStreamAsync<T>(stream, streamType)
Converts the specified stream to an object of type T .
| Parameter | Type | Description |
|---|---|---|
| T | The type of the object to return. | |
| stream | Stream | The stream to convert. |
| streamType | String | The type of the stream. Default is null. |
Returns: Task<T>. A task that represents the asynchronous operation. The task result contains the converted object.
FromStreamAsync(stream, objectType, streamType)
Converts the specified stream to an object of the specified type.
| Parameter | Type | Description |
|---|---|---|
| stream | Stream | The stream to convert. |
| objectType | Type | The type of the object to return. |
| streamType | String | The type of the stream. Default is null. |
Returns: Task<Object>. A task that represents the asynchronous operation. The task result contains the converted object.
FromTextAsync<T>(text)
Converts the specified text to an object of type T .
| Parameter | Type | Description |
|---|---|---|
| T | The type of the object to return. | |
| text | String | The text to convert. |
Returns: Task<T>. A task that represents the asynchronous operation. The task result contains the converted object.
FromTextAsync(text, objectType)
Converts the specified text to an object of the specified type.
| Parameter | Type | Description |
|---|---|---|
| text | String | The text to convert. |
| objectType | Type | The type of the object to return. |
Returns: Task<Object>. A task that represents the asynchronous operation. The task result contains the converted object.
OnObjectParsed(args)
Raises the ObjectParsed event.
| Parameter | Type | Description |
|---|---|---|
| args | ObjectParsedEventArgs | The ObjectParsedEventArgs instance containing the event data. |
RunAsyncCore(control)
Executes the core logic of the adapter asynchronously.
| Parameter | Type | Description |
|---|---|---|
| control | Control | The control to use for the operation. |
Returns: Task<Message>. A task that represents the asynchronous operation. The task result contains the response message.
Events
ObjectParsed
ObjectParsedEventHandler Occurs when an object is parsed.
Implements
| Name | Description |
|---|---|
| IToolProvider | Represents a provider that supplies tools. |