SmartDataEntryAdapter

Wisej.AI.Adapters.SmartDataEntryAdapter

Namespace: Wisej.AI.Adapters

Assembly: Wisej.AI (3.5.0.0)

Enhances all the controls in the associated container with the AI-powered capability to extract structured data from unstructured text.

public class SmartDataEntryAdapter : SmartAdapter, IExtenderProvider

Works with:

  • AzureAI/OpenAI gpt-4

  • AzureAI/OpenAI gpt-4o

  • AzureAI/OpenAI gpt-3.5

  • AzureAI/Anthropic Claude

  • Google Gemini

  • Llama3:8b and 70b

Supports several types of sources for the input text: Clipboard (text or image), PDF stream, Text, Word, Excel. Uses the Tesseract extension to run the OCR text extraction on the user's browser in JavaScript.

Constructors

SmartDataEntryAdapter()

Initializes a new instance of the SmartDataEntryAdapter class.

SmartDataEntryAdapter(container)

Initializes a new instance of the SmartDataEntryAdapter class with the specified container.

Name
Type
Description

container

An IContainer that represents the container of the component.

Properties

ExcludeReadOnly

Boolean: Gets or sets a value indicating whether read-only controls should be excluded. (Default: False)

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 SmartDataEntryAdapter and optionally releases the managed resources.

Parameter
Type
Description

disposing

true to release both managed and unmanaged resources; false to release only unmanaged resources.

FromClipboardAsync()

Asynchronously processes data from the clipboard and extracts structured data.

Returns: Task. A task representing the asynchronous operation.

Throws:

FromImageAsync(image)

Asynchronously processes the provided image and extracts structured data.

Parameter
Type
Description

image

The image to be processed.

Returns: Task. A task representing the asynchronous operation.

Throws:

FromStreamAsync(stream, streamType)

Asynchronously processes the provided stream and extracts text and image data. If an image is detected without associated text, the method attempts to perform OCR to extract text.

Parameter
Type
Description

stream

The stream containing the input data.

streamType

An optional string that specifies the type of data being processed. If not provided, a default value is used.

Returns: Task. A task representing the asynchronous operation.

Throws:

FromTextAsync(text)

Asynchronously processes the provided text and extracts structured data.

Parameter
Type
Description

text

The text to be processed.

Returns: Task. A task representing the asynchronous operation.

Throws:

GetFieldName(component)

Gets the name of the field to extract for the specified component.

Parameter
Type
Description

component

The component for which to get the field name.

Returns: String. The name of the field to extract.

Throws:

GetFieldPrompt(component)

Parameter
Type
Description

Returns: String.

GetFieldRectangle(component)

Gets the rectangle that defines the area of the field to extract for the specified component.

Parameter
Type
Description

component

The component for which to get the field rectangle.

Returns: Nullable<Rectangle>. The rectangle that defines the area of the field to extract.

Throws:

OnParseValue(e)

Raises the ParseValue event.

Parameter
Type
Description

e

The ParseValueArgs instance containing the event data.

OnUpdateField(e)

Raises the UpdateField event.

Parameter
Type
Description

e

The UpdateFieldArgs instance containing the event data.

RunAsyncCore(control)

Asynchronously runs the core logic of the adapter on the specified control.

Parameter
Type
Description

control

The control to process.

Returns: Task<Message>. A task representing the asynchronous operation.

SetFieldName(component, value)

Sets the name of the field to extract for the specified component.

Parameter
Type
Description

component

The component for which to set the field name.

value

The name of the field to extract.

Throws:

SetFieldPrompt(component, value)

Sets the prompt to instruct the AI on how to extract the value for the field for the specified component.

Parameter
Type
Description

component

The component for which to set the field prompt.

value

The prompt to instruct the AI on how to extract the value for the field.

Throws:

SetFieldRectangle(component, value)

Sets the rectangle that defines the area of the field to extract for the specified component.

Parameter
Type
Description

component

The component for which to set the field rectangle.

value

The rectangle that defines the area of the field to extract.

Throws:

Events

ParseValue

ParseValueEventHandler Occurs when a value is parsed from the input data.

UpdateField

UpdateFieldEventHandler Occurs when a field is updated with a new value.

Implements

Name
Description

Represents a provider that supplies tools.

Last updated