Skip to main content

SmartObjectAdapter

Namespace: Wisej.AI.Adapters

Assembly: Wisej.AI

Converts unstructured text into a structured .NET object.

public class SmartObjectAdapter : 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.

NameTypeDescription
containerIContainerAn 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.

ParameterTypeDescription
disposingBooleantrue 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 .

ParameterTypeDescription
TThe 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.

ParameterTypeDescription
objectTypeTypeThe 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 .

ParameterTypeDescription
TThe type of the object to return.
imageImageThe 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.

ParameterTypeDescription
imageImageThe image to convert.
objectTypeTypeThe 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 .

ParameterTypeDescription
TThe type of the object to return.
streamStreamThe stream to convert.
streamType StringThe 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.

ParameterTypeDescription
streamStreamThe stream to convert.
objectTypeTypeThe type of the object to return.
streamType StringThe 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 .

ParameterTypeDescription
TThe type of the object to return.
textStringThe 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.

ParameterTypeDescription
textStringThe text to convert.
objectTypeTypeThe 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.

ParameterTypeDescription
argsObjectParsedEventArgsThe ObjectParsedEventArgs instance containing the event data.

RunAsyncCore(control)

Executes the core logic of the adapter asynchronously.

ParameterTypeDescription
controlControlThe 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

NameDescription
IToolProviderRepresents a provider that supplies tools.