v2.1

Summary

Members

Descriptions

namespaceLucidtech::Las

namespaceLucidtech::Las::Core

namespaceLucidtech::Las::Utils

namespace Lucidtech::Las

Summary

Members

Descriptions

classLucidtech::Las::ApiClient

A high level client to invoke API methods from Lucidtech AI Services.

classLucidtech::Las::Client

A low level client to invoke api methods from Lucidtech AI Services.

class Lucidtech::Las::ApiClient

class Lucidtech::Las::ApiClient
: public Lucidtech.Las.Client

A high level client to invoke API methods from Lucidtech AI Services.

Summary

Members

Descriptions

public inlineApiClient()

ApiClient constructor with credentials read from local file.

public inlineApiClient(AmazonCredentialscredentials)

ApiClient constructor.

public inlinePrediction`[Predict](#a00048_1a8fddf2de600c64f51788a5318102d7fb)(string documentPath,string modelName,string consentId)`

Run inference and create prediction on document, this method takes care of creating and uploaded document as well as running inference to create prediction on document.

public inlineFeedbackResponse`[SendFeedback](#a00048_1af318f59c6854feaded4e4c21f3fe441b)(string documentId,List< Dictionary< string, string >> feedback)`

Send feedback to the model. This method takes care of sending feedback related to a document specified by documentId. Feedback consists of ground truth values for the document specified as a List of Dictionaries.

public inlineRevokeResponse`[RevokeConsent](#a00048_1a8fbb4629795670a9b1e65b14cf471e6a)(string consentId)`

Revoke consent and delete all documents associated with consentId. Consent id is a parameter that is provided by the user upon making a prediction on a document.

Members

public inlineApiClient()

ApiClient constructor with credentials read from local file.

public inlineApiClient(AmazonCredentialscredentials)

ApiClient constructor.

Parameters

  • credentials Keys and credentials needed for authorization

public inlinePrediction`[Predict](#a00048_1a8fddf2de600c64f51788a5318102d7fb)(string documentPath,string modelName,string consentId)`

Run inference and create prediction on document, this method takes care of creating and uploaded document as well as running inference to create prediction on document.

using namespace Lucidtech.Las;
ApiClient apiClient = new ApiClient();
Prediction response =
apiClient.Predict(documentPath: "document.jpeg", modelName: "invoice", consentId: "bar");
Console.WriteLine(response.ToJsonString(Formatting.Indented));

Parameters

  • documentPath Path to document to run inference on

  • modelName The name of the model to use for inference

  • consentId An identifier to mark the owner of the document handle

Returns

Prediction on document

public inlineFeedbackResponse`[SendFeedback](#a00048_1af318f59c6854feaded4e4c21f3fe441b)(string documentId,List< Dictionary< string, string >> feedback)`

Send feedback to the model. This method takes care of sending feedback related to a document specified by documentId. Feedback consists of ground truth values for the document specified as a List of Dictionaries.

using namespace Lucidtech.Las;
ApiClient apiClient = new ApiClient();
var feedback = new List<Dictionary<string, string>>()
{
new Dictionary<string, string>(){{"label", "total_amount"},{"value", "54.50"}},
new Dictionary<string, string>(){{"label", "purchase_date"},{"value", "2007-07-30"}}
};
FeedbackResponse response = apiClient.SendFeedback(documentId: '<documentId>', feedback: feedback);
Console.WriteLine(response.ToJsonString(Formatting.Indented));

Parameters

  • documentId Document id

  • feedback Ground truth values

Returns

Data that can be used to confirm that the feedback uploaded was successful

public inlineRevokeResponse`[RevokeConsent](#a00048_1a8fbb4629795670a9b1e65b14cf471e6a)(string consentId)`

Revoke consent and delete all documents associated with consentId. Consent id is a parameter that is provided by the user upon making a prediction on a document.

using namespace Lucidtech.Las;
ApiClient apiClient = new ApiClient();
RevokeResponse response = apiClient.RevokeConsent(consentId: '<consentId>');
Console.WriteLine(response.ToJsonString(Formatting.Indented));

Parameters

  • consentId Delete documents associated with this consent id

Returns

The document ids of the deleted documents, and their consent id

class Lucidtech::Las::Client

A low level client to invoke api methods from Lucidtech AI Services.

Summary

Members

Descriptions

{property} RestClientRestSharpClient

{property}AmazonCredentials`[Credentials`](#a00052_1a9cbce969c8ef19a70894424cf9a39e41)

public inlineClient(AmazonCredentialscredentials)

Client constructor.

public inlineClient()

Client constructor with credentials read from local file.

public inline objectCreateDocument(byte [] content,string contentType,string consentId,string batchId,List< Dictionary< string, string >> feedback)

Creates a document handle, calls the POST /documents endpoint

public inline objectListDocuments(string batchId,string consentId)

Get documents from the REST API, calls the GET /documents endpoint.

public inline objectCreatePrediction(string documentId,string modelName,int? maxPages,bool? autoRotate,Dictionary< string, object >? extras)

Run inference and create a prediction, calls the POST /predictions endpoint.

public inline objectGetDocument(string documentId)

Get document from the REST API, calls the GET /documents/{documentId} endpoint.

public inline objectUpdateDocument(string documentId,List< Dictionary< string, string >> feedback)

Post feedback to the REST API, calls the POST /documents/{documentId} endpoint. Posting feedback means posting the ground truth data for the particular document. This enables the API to learn from past mistakes.

public inline objectDeleteConsent(string consentId)

Delete documents with this consentId, calls DELETE /consent/{consentId} endpoint.

public inline objectCreateBatch(string description)

Create a batch handle, calls the POST /batches endpoint.

Members

{property} RestClientRestSharpClient

{property}AmazonCredentials`[Credentials`](#a00052_1a9cbce969c8ef19a70894424cf9a39e41)

public inlineClient(AmazonCredentialscredentials)

Client constructor.

Parameters

  • credentials Keys, endpoints and credentials needed for authorization

public inlineClient()

Client constructor with credentials read from local file.

public inline objectCreateDocument(byte [] content,string contentType,string consentId,string batchId,List< Dictionary< string, string >> feedback)

Creates a document handle, calls the POST /documents endpoint

Create a document handle for a jpeg image

Client client = new Client();
byte[] content = File.ReadAllBytes("MyReceipt.jpeg");
var response = client.CreateDocument(content, "image/jpeg", "bar");

Parameters

  • content Content to POST

  • contentType A mime type for the document handle

  • consentId An identifier to mark the owner of the document handle

  • batchId Specifies the batch to which the document will be associated with

  • feedback A list of feedback items {label: value}, representing the ground truth values for the document

Returns

A deserialized object that can be interpreted as a Dictionary with the fields with batchId, documentId, contentType and consentId

public inline objectListDocuments(string batchId,string consentId)

Get documents from the REST API, calls the GET /documents endpoint.

Create a document handle for a jpeg image

Client client = new Client();
var response = client.ListDocuments('<batchId>');

Parameters

  • batchId The batch id that contains the documents of interest

  • consentId An identifier to mark the owner of the document handle

Returns

Documents from REST API contained in batch

public inline objectCreatePrediction(string documentId,string modelName,int? maxPages,bool? autoRotate,Dictionary< string, object >? extras)

Run inference and create a prediction, calls the POST /predictions endpoint.

Run inference and create a prediction using the invoice model on the document specified by ''

Client client = new Client();
var response = client.CreatePrediction('<documentId>',"invoice");

Parameters

  • documentId Path to document to upload Same as provided to CreateDocument

  • modelName The name of the model to use for inference

  • maxPages Maximum number of pages to run predictions on

  • autoRotate Whether or not to let the API try different rotations on the document when running

  • extras Extra information to add to json body

Returns

A deserialized object that can be interpreted as a Dictionary with the fields documentId and predictions, the value of predictions is the output from the model.

public inline objectGetDocument(string documentId)

Get document from the REST API, calls the GET /documents/{documentId} endpoint.

Get information of document specified by

Client client = new Client();
var response = client.GetDocument('<documentId>');

Parameters

  • documentId The document id to run inference and create a prediction on

Returns

Document information from REST API

public inline objectUpdateDocument(string documentId,List< Dictionary< string, string >> feedback)

Post feedback to the REST API, calls the POST /documents/{documentId} endpoint. Posting feedback means posting the ground truth data for the particular document. This enables the API to learn from past mistakes.

Client client = new Client();
var feedback = new List<Dictionary<string, string>>()
{
new Dictionary<string, string>(){{"label", "total_amount"},{"value", "54.50"}},
new Dictionary<string, string>(){{"label", "purchase_date"},{"value", "2007-07-30"}}
};
var response = client.UpdateDocument('<documentId>', feedback);

Parameters

  • documentId Path to document to upload, Same as provided to CreateDocument

  • feedback A list of feedback items

Returns

A deserialized object that can be interpreted as a Dictionary with the fields documentId, consentId, uploadUrl, contentType and feedback.

public inline objectDeleteConsent(string consentId)

Delete documents with this consentId, calls DELETE /consent/{consentId} endpoint.

Client client = new Client();
var response = client.DeleteConsent('<consentId>');

Parameters

  • consentId Delete documents with provided consentId

Returns

A deserialized object that can be interpreted as a Dictionary with the fields consentId and documentIds

public inline objectCreateBatch(string description)

Create a batch handle, calls the POST /batches endpoint.

Create a new batch with the provided description. on the document specified by ''

Client client = new Client();
var response = client.CreateBatch("Data gathered from the Mars Rover Invoice Scan Mission");

Parameters

  • description A brief description of the purpose of the batch

Returns

A deserialized object that can be interpreted as a Dictionary with the fields batchId and description. batchId can be used as an input when posting documents to make them a part of this batch.

namespace Lucidtech::Las::Core

Summary

Members

Descriptions

classLucidtech::Las::Core::AmazonCredentials

Used to fetch and store credentials. One of 3 conditions must be met to successfully create credentials.

classLucidtech::Las::Core::ClientException

A ClientException is raised if the client refuses to send request due to incorrect usage or bad request data.

classLucidtech::Las::Core::FeedbackResponse

The structured format of the response from a send feedback request.

classLucidtech::Las::Core::InvalidCredentialsException

An InvalidCredentialsException is raised if api key, access key id or secret access key is invalid.

classLucidtech::Las::Core::LimitExceededException

A LimitExceededException is raised if you have reached the limit of total requests per month associated with your credentials.

classLucidtech::Las::Core::Prediction

A class that contains all the necessary information regarding a prediction performed by ApiClient.

classLucidtech::Las::Core::RequestException

A RequestException is raised if something went wrong with the request.

classLucidtech::Las::Core::RevokeResponse

The structured format of the response from a revoke consent request.

classLucidtech::Las::Core::TooManyRequestsException

A TooManyRequestsException is raised if you have reached the number of requests per second limit associated with your credentials.

class Lucidtech::Las::Core::AmazonCredentials

Used to fetch and store credentials. One of 3 conditions must be met to successfully create credentials.

  • ClientId, ClientSecret, ApiKey, AuthEndpoint and ApiEndpoint are provided

  • The path to the file where the credentials are stored is provided

  • Credentials are located in default path ~/.lucidtech/credentials.cfg

Get credentials by contacting hello@lucidtech.ai

Summary

Members

Descriptions

{property} stringClientId

Client ID. Provided by Lucidtech.

{property} stringClientSecret

Client Secret. Provided by Lucidtech.

{property} stringApiKey

AWS API Gateway API key. Provided by Lucidtech.

{property} stringAuthEndpoint

AWS Authorization endpoint. Provided by Lucidtech.

{property} stringApiEndpoint

AWS API Gateway API endpoint. Provided by Lucidtech.

{property} RestClientRestSharpClient

RestClient for making request to the authorization endpoint.

public inline stringGetAccessToken()

Get Access token to API endpoint.

public inlineAmazonCredentials(string clientId,string clientSecret,string apiKey,string authEndpoint,string apiEndpoint)

Credentials constructor where ClientId, ClientSecret, ApiKey, AuthEndpoint and ApiEndpoint are provided by Lucidtech.

public inlineAmazonCredentials(string credentialsPath)

Credentials constructor where the path to the credentials config is provided.

public inlineAmazonCredentials()

Credentials constructor where the credentials are located at the default path. ~/.lucidtech/credentials.cfg for linux and USERPROFILE%.lucidtech\credentials.cfg for Windows.

protectedstring

protected inline virtual voidCommonConstructor()

Members

{property} stringClientId

Client ID. Provided by Lucidtech.

{property} stringClientSecret

Client Secret. Provided by Lucidtech.

{property} stringApiKey

AWS API Gateway API key. Provided by Lucidtech.

{property} stringAuthEndpoint

AWS Authorization endpoint. Provided by Lucidtech.

{property} stringApiEndpoint

AWS API Gateway API endpoint. Provided by Lucidtech.

{property} RestClientRestSharpClient

RestClient for making request to the authorization endpoint.

public inline stringGetAccessToken()

Get Access token to API endpoint.

public inlineAmazonCredentials(string clientId,string clientSecret,string apiKey,string authEndpoint,string apiEndpoint)

Credentials constructor where ClientId, ClientSecret, ApiKey, AuthEndpoint and ApiEndpoint are provided by Lucidtech.

Parameters

  • clientId client id

  • clientSecret client secret

  • apiKey API key

  • authEndpoint Authorization endpoint

  • apiEndpoint API endpoint

Exceptions

  • ArgumentException

public inlineAmazonCredentials(string credentialsPath)

Credentials constructor where the path to the credentials config is provided.

Parameters

  • credentialsPath Path to the file where the credentials are stored

public inlineAmazonCredentials()

Credentials constructor where the credentials are located at the default path. ~/.lucidtech/credentials.cfg for linux and USERPROFILE%.lucidtech\credentials.cfg for Windows.

protectedstring

protected inline virtual voidCommonConstructor()

class Lucidtech::Las::Core::ClientException

class Lucidtech::Las::Core::ClientException
: public Exception

A ClientException is raised if the client refuses to send request due to incorrect usage or bad request data.

Summary

Members

Descriptions

public inlineClientException(string s)

Members

public inlineClientException(string s)

class Lucidtech::Las::Core::FeedbackResponse

The structured format of the response from a send feedback request.

Summary

Members

Descriptions

{property} stringDocumentId

Document id

{property} stringConsentId

Consent id

{property} stringContentType

Content type

{property} List< Dictionary< string, string > >Feedback

The same information as was uploaded as feedback.

public inlineFeedbackResponse(object response)

public inline stringToJsonString(Formatting format)

Convert an object of this class to a string ready to be interpreted as a json object.

Members

{property} stringDocumentId

Document id

{property} stringConsentId

Consent id

{property} stringContentType

Content type

{property} List< Dictionary< string, string > >Feedback

The same information as was uploaded as feedback.

public inlineFeedbackResponse(object response)

public inline stringToJsonString(Formatting format)

Convert an object of this class to a string ready to be interpreted as a json object.

Parameters

  • format The format of the string, either Formatting.None or Formatting.Indented

Returns

A string that is formatted as a json object

class Lucidtech::Las::Core::InvalidCredentialsException

class Lucidtech::Las::Core::InvalidCredentialsException
: public Lucidtech.Las.Core.ClientException

An InvalidCredentialsException is raised if api key, access key id or secret access key is invalid.

Summary

Members

Descriptions

public inlineInvalidCredentialsException(string s)

Members

public inlineInvalidCredentialsException(string s)

class Lucidtech::Las::Core::LimitExceededException

class Lucidtech::Las::Core::LimitExceededException
: public Lucidtech.Las.Core.ClientException

A LimitExceededException is raised if you have reached the limit of total requests per month associated with your credentials.

Summary

Members

Descriptions

public inlineLimitExceededException(string s)

Members

public inlineLimitExceededException(string s)

class Lucidtech::Las::Core::Prediction

A class that contains all the necessary information regarding a prediction performed by ApiClient.

Summary

Members

Descriptions

{property} stringConsentId

Consent id

{property} stringModelName

Upload url

{property} stringDocumentId

Document id

{property} List< Dictionary< string, object > >Fields

A list of the responses from a prediction

public inlinePrediction(string documentId,string consentId,string modelName,List< Dictionary< string, object >> predictionResponse)

Constructor of s Prediction object

public inline stringToJsonString(Formatting format)

Convert an object of this class to a string ready to be interpreted as a json object.

Members

{property} stringConsentId

Consent id

{property} stringModelName

Upload url

{property} stringDocumentId

Document id

{property} List< Dictionary< string, object > >Fields

A list of the responses from a prediction

public inlinePrediction(string documentId,string consentId,string modelName,List< Dictionary< string, object >> predictionResponse)

Constructor of s Prediction object

Parameters

  • documentId The id of the document used in the prediction

  • consentId The consent id

  • modelName The name of the model used

  • predictionResponse The response from prediction

public inline stringToJsonString(Formatting format)

Convert an object of this class to a string ready to be interpreted as a json object.

Parameters

  • format The format of the string, either Formatting.None or Formatting.Indented

Returns

A string that is formatted as a json object

class Lucidtech::Las::Core::RequestException

class Lucidtech::Las::Core::RequestException
: public Lucidtech.Las.Core.ClientException

A RequestException is raised if something went wrong with the request.

Summary

Members

Descriptions

{property} IRestResponseResponse

public inlineRequestException(string s)

public inlineRequestException(IRestResponse response)

Members

{property} IRestResponseResponse

public inlineRequestException(string s)

public inlineRequestException(IRestResponse response)

class Lucidtech::Las::Core::RevokeResponse

The structured format of the response from a revoke consent request.

Summary

Members

Descriptions

{property} stringConsentId

The consent Id where documents where deleted.

{property} List< string >DocumentIds

The document Ids of the deleted documents.

public inlineRevokeResponse(object deleteConsentResponse)

public inline stringToJsonString(Formatting format)

Convert an object of this class to a string ready to be interpreted as a json object.

Members

{property} stringConsentId

The consent Id where documents where deleted.

{property} List< string >DocumentIds

The document Ids of the deleted documents.

public inlineRevokeResponse(object deleteConsentResponse)

public inline stringToJsonString(Formatting format)

Convert an object of this class to a string ready to be interpreted as a json object.

Parameters

  • format The format of the string, either Formatting.None or Formatting.Indented

Returns

A string that is formatted as a json object

class Lucidtech::Las::Core::TooManyRequestsException

class Lucidtech::Las::Core::TooManyRequestsException
: public Lucidtech.Las.Core.ClientException

A TooManyRequestsException is raised if you have reached the number of requests per second limit associated with your credentials.

Summary

Members

Descriptions

public inlineTooManyRequestsException(string s)

Members

public inlineTooManyRequestsException(string s)

namespace Lucidtech::Las::Utils

Summary

Members

Descriptions

classLucidtech::Las::Utils::FileType

Help determine the type of a file, inspired by pythons imghdr.what().

classLucidtech::Las::Utils::JsonSerialPublisher

A Json publishes that allows the user to serialize and deserialize back and forth between serialized json objects and deserialized general objects and specific Dictionaries.

class Lucidtech::Las::Utils::FileType

Help determine the type of a file, inspired by pythons imghdr.what().

Summary

Members

Descriptions

Members

class Lucidtech::Las::Utils::JsonSerialPublisher

class Lucidtech::Las::Utils::JsonSerialPublisher
: public ISerializer
: public IDeserializer

A Json publishes that allows the user to serialize and deserialize back and forth between serialized json objects and deserialized general objects and specific Dictionaries.

Summary

Members

Descriptions

{property} stringContentType

public inlineJsonSerialPublisher(Newtonsoft.Json.JsonSerializer serializer)

public inline stringSerialize(object obj)

Serialize a general object.

public inline TDeserialize< T >(IRestResponse response)

Deserialize the content of an IRestResponse.

Members

{property} stringContentType

public inlineJsonSerialPublisher(Newtonsoft.Json.JsonSerializer serializer)

public inline stringSerialize(object obj)

Serialize a general object.

Parameters

  • obj A general object to be serialized

Returns

A string ready to be interpreted as a json file

public inline TDeserialize< T >(IRestResponse response)

Deserialize the content of an IRestResponse.

Parameters

  • response The response from a request performed by RestSharp.RestClient

Parameters

  • T The type of the output, e.g. Dictionary or a List of some sort

Returns

A deserialized object of type T

Generated by Moxygen