Primo.AI.Server
1.2.2
dotnet add package Primo.AI.Server --version 1.2.2
NuGet\Install-Package Primo.AI.Server -Version 1.2.2
<PackageReference Include="Primo.AI.Server" Version="1.2.2" />
<PackageVersion Include="Primo.AI.Server" Version="1.2.2" />
<PackageReference Include="Primo.AI.Server" />
paket add Primo.AI.Server --version 1.2.2
#r "nuget: Primo.AI.Server, 1.2.2"
#:package Primo.AI.Server@1.2.2
#addin nuget:?package=Primo.AI.Server&version=1.2.2
#tool nuget:?package=Primo.AI.Server&version=1.2.2
About
Primo.AI.Server is a set of ready-to-use activities for Primo RPA Studio designed to automate interaction with the Primo AI Server intelligent data recognition system. It addresses the need to process documents and text using OCR and NLP within automated processes. Key activities include: sending OCR requests and retrieving results, validating recognized data, sending NLP requests and retrieving results, working with document packages (creating packages, adding files, setting processing pipelines, retrieving results and documents), cancelling requests, getting processed files, and using tools for image cropping and text search. The package can be added to any Primo RPA Studio project via the built-in dependency manager.
How to Use
In Primo RPA Studio, create a project that will be executed by the Primo RPA Robot. Install this package via the ".Dependencies → Manage Dependencies" menu; the "AI" node with package elements will appear in the Elements tree.
The "Primo AI server" element is a container for all other package elements. This element is used to connect to the server and to authenticate.
In pure code projects use the element as follows:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//server - Server: [String] Server URL
//login - Login: [String] User login
//password - Password: [String] User password
//spassword - Secure password: [SecureString] Secure password
//to - Time-out: [Int32] Server interactions time-out (ms)
Primo.AI.Server.PrimoAIApp app = Primo.AI.Server.PrimoAIApp.Init(wf, server, [to], [login], [spassword], [password]);
The "Smart OCR\Create request OCR" element sends a request for document recognition. In response, it receives the request key.
In pure code projects:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//modelType - [String] Model type for document processing
//file - Document: [String] Path to document file
//orchQueue - Orchestrator queue: [String] The orchestrator's queue for sending a notification that a response is ready on request
System.Guid txt = app.CreateInference(file, modelType, [orchQueue]);
The "Smart OCR\Get result OCR" element receives the processing result from the server.
In pure code:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestKey - [System.Guid] Request key
Primo.AI.Server.Model.InferenceResult txt = app.GetInference(requestKey);
The "Smart OCR\Validate document" element validates the recognized data and allows you to correct them.
It is not used in pure code.
The "NLP\Create request NLP" element sends a request NLP. In response, it receives the request key.
In pure code projects:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//modelType - Routing key: [String] Routing key for request
//prompt - Prompt: [String] Text to be processed
//responseLength - Response length: [Int32] Maximum length of model responses in tokens
//responseSchema - Response keys: [List<String>] Parameters specific to each NLP task
//temperature - Temperature: [Double] The lower the temperature, the less variability in generation
//minP - Min p: [Double] An additional parameter that defines the threshold in the range of token selection (0 is any, 1 is the most likely)
//contextFile - Context: [String] Path to context file (.json)
//systemMessage - System message: [String] Controls the behavior of the model - how to approach the generation of the response, in what format to form it, etc.
//imageFile - Context: [String] Path to image file (jpg/png)
//matchResponseSchema - Match response schema: [Boolean] Match response keys
//orchQueue - Orchestrator queue: [String] The orchestrator's queue for sending a notification that a response is ready on request
System.Guid txt = app.CreateRequestNlp(modelType, prompt, responseLength, [responseSchema], [temperature], [minP], [contextFile], [systemMessage], [imageFile], [matchResponseSchema], [orchQueue]);
The "NLP\Get result NLP" element receives the result of the request NLP from the server.
In pure code:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestKey - [System.Guid] Request key
Primo.AI.Server.Model.NlpResult txt = app.GetRequestNlp(requestKey);
The "AgentSystem\Create request AgentSystem" element sends a request AgentSystem. In response, it receives the request key.
In pure code projects:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//routingKey - Routing key: [String] Routing key for request
//prompt - Prompt: [String] Text to be processed
//files - Response length: [List<string>] Request files
//dataKey - Response keys: [string] Data key
//orchQueue - Orchestrator queue: [String] The orchestrator's queue for sending a notification that a response is ready on request
System.Guid txt = app.CreateRequestAgentSystem(routingKey, prompt, files, [dataKey], [orchQueue]);
The "AgentSystem\Get result AgentSystem" element receives the result of the request AgentSystem from the server.
In pure code:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestKey - [System.Guid] Request key
Primo.AI.Server.Model.AgentSystem.AgentSystemResult txt = app.GetRequestAgentSystem(requestKey);
The "Packages\Create package" element creates a document package for processing. In response, it receives the package key.
In pure code projects:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestGroup - Request group: [String] Queue for processing (optional)
//orchQueue - Orchestrator queue: [String] The orchestrator's queue for sending a notification that a response is ready on request
System.Guid key = app.CreatePackage([requestGroup], [orchQueue]);
The "Packages\Add files to package" element adds files to a document package. In response, it receives the request keys.
In pure code projects:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestKey - Package key: [System.Guid] Package identifier
//files - Files: [List<String>] File paths to add to the package
var key = app.AddPackageFiles(requestKey, files);
The "Packages\Set package pipeline" element sets a processing pipeline for a document package.
In pure code projects:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestKey - Package key: [System.Guid] Package identifier
//pipeline - Pipeline: [Primo.AI.Server.Model.Packages.PackagePipeline] Processing pipeline
app.SetPackagePipeline(requestKey, pipelineJson);
The "Packages\Start package" element starts processing of a document package.
In pure code projects:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestKey - Package key: [System.Guid] Package identifier
app.StartPackage(requestKey);
The "Packages\Get package" element receives the document package processing result from the server.
In pure code:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestKey - Package key: [System.Guid] Package identifier
Primo.AI.Server.Model.Packages.PackageResult result = app.GetPackage(requestKey);
The "Packages\Get package document info" element receives recognition data of a document from a package.
In pure code:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestKey - Package key: [System.Guid] Package identifier
//documentId - Document id: [System.Guid] Document identifier from PackageResult.Documents
Primo.AI.Server.Model.Packages.PackageResultDocument json = app.GetPackageDocumentInfo(requestKey, documentId);
The "Packages\Get package document file" element downloads a PDF document file from a package.
In pure code:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestKey - Package key: [System.Guid] Package identifier
//documentId - Document id: [System.Guid] Document identifier from PackageResult.Documents
//pathSave - Path to save: [String] Path to save the PDF file (optional)
System.Byte[] file = app.GetPackageDocumentFile(requestKey, documentId, [pathSave]);
The "Cancel request" element cancels a request on the Primo AI server.
In pure code:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestKey - Request key: [System.Guid] Request identifier to cancel
//requestType - Request type: [Primo.AI.Server.Model.RequestType] Request type
app.CancelRequest(requestKey, requestType);
The "Get file" element receives the processed file from the server.
In pure code:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestKey - [System.Guid] Request key
//fileId - [System.Guid] File id
//requestType - [Primo.AI.Server.Model.RequestType] Request type
//pathSave - Path to save: [String] Path to save image
System.Byte[] txt = app.GetFile(requestKey, fileId, requestType, pathSave);
The "Get status model" element receives the status model from the server.
In pure code:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//modelType - [System.String] Model type
//requestType - [Primo.AI.Server.Model.RequestType] Request type
Primo.AI.Server.Model.IsRunningComponent txt = app.GetStatusModel(modelType, requestType);
The "Get ready requests" element receives the ready requests from the server.
In pure code:
//app - [Primo.AI.Server.PrimoAIApp] PrimoAIApp application
//requestType - [Primo.AI.Server.Model.RequestType] Request type
List<string> txt = app.GetReadyRequests(requestType);
The "Tools\Smart OCR\Crop image" element that image cropping.
In pure code:
//resultContent - Recognition result: [Primo.AI.Server.Model.InferenceResultContent] Image recognition result
//fieldTypes - Image: [String] Path to image file (jpg/jpeg/png)
//pathSave - Path to save: [String] Path to save images
//imageFile - Image: [String] Path to image file (jpg/jpeg/png)
//rectangles - Rectangles: [List<System.Drawing.Rectangle>] Rectangles for crop
//cropType - Crop type: [Primo.AI.Server.Model.CropType] Crop type
//fieldLimit - Field limit: [int] The maximum number of crops for a field of the same type. It cannot be less than 1.
//inflateCropHorizontally - Horizontal indentation: [int] How much to expand the crop horizontally. A non-negative number.
//inflateCropVertically - Vertical indentation: [int] How much to expand the crop vertically. A non-negative number.
var result = Primo.AI.Server.PrimoAIToolsApp.CropImage(wf, resultContent, cropType, rectangles, fields, pathSave, imageFile, fieldLimit, inflateCropHorizontally, inflateCropVertically) #(List<string> Images, FieldCropsExtractorResult CroppedAreas);
The "Tools\Smart OCR\Find text in area" element that searches for text in area.
In pure code:
//resultContent - Recognition result: [Primo.AI.Server.Model.InferenceResultContent] Image recognition result
//imageFile - Image: [String] Path to image file (jpg/jpeg/png)
//imageWidth - Image width: [int?] Image width
//imageHeight - Image height: [int?] Image height
//rowsCount - Rows count: [int] Rows count
//columnsCount - Columns count: [int] Columns count
//cellsToSearch - Cells to search: [List<Tuple<int, int>>] Cells to search
Primo.AI.Server.Tools.SmartOcr.TextInAreaSearcherResult result = Primo.AI.Server.PrimoAIToolsApp.FindTextArea(wf, resultContent, imageFile, imageWidth, imageHeight, rowsCount, columnsCount, cellsToSearch);
The "Tools\Smart OCR\Find text near field" that searches for text near a field.
In pure code:
//fieldName - Field name: [String] Field name
//resultContent - Recognition result: [Primo.AI.Server.Model.InferenceResultContent] Image recognition result
//horizontalDistance - Horizontal distance: [int] Horizontal distance
//verticalDistance - Vertical distance: [int] Vertical distance
Primo.AI.Server.Tools.SmartOcr.TextNearToFieldSearcherResult result = Primo.AI.Server.PrimoAIToolsApp.FindTextNearField(wf, fieldName, resultContent, horizontalDistance, verticalDistance);
Key Features
- High performance
- Supports .NET Framework 4.6.1+
Main Types
- Primo.AI.Server.Elements.WFAttachPrimoAIServer
- Primo.AI.Server.Elements.WFPrimoAIGetFile
- Primo.AI.Server.Elements.WFPrimoAICreateInference
- Primo.AI.Server.Elements.WFPrimoAICreateRequestAgentSystem
- Primo.AI.Server.Elements.WFPrimoAIGetInference
- Primo.AI.Server.Elements.WFPrimoAIValidate
- Primo.AI.Server.Elements.WFPrimoAICreateRequestNlp
- Primo.AI.Server.Elements.WFPrimoAIGetRequestNlp
- Primo.AI.Server.Elements.WFPrimoAIGetReadyRequests
- Primo.AI.Server.Elements.WFPrimoAIGetRequestAgentSystem
- Primo.AI.Server.Elements.WFPrimoAIGetStatusModel
- Primo.AI.Server.Elements.WFPrimoAICropImage
- Primo.AI.Server.Elements.WFPrimoAIFindTextArea
- Primo.AI.Server.Elements.WFPrimoAIFindTextNearField
- Primo.AI.Server.Elements.WFPrimoAICancelRequest
- Primo.AI.Server.Elements.WFPrimoAICreatePackage
- Primo.AI.Server.Elements.WFPrimoAIAddPackageFiles
- Primo.AI.Server.Elements.WFPrimoAISetPackagePipeline
- Primo.AI.Server.Elements.WFPrimoAIStartPackage
- Primo.AI.Server.Elements.WFPrimoAIGetPackage
- Primo.AI.Server.Elements.WFPrimoAIGetPackageDocumentInfo
- Primo.AI.Server.Elements.WFPrimoAIGetPackageDocumentFile
- Primo.AI.Server.PrimoAIApp
- Primo.AI.Server.PrimoAIToolsApp
- Primo.AI.Server.Model.BoundingBox
- Primo.AI.Server.Model.AgentSystem.AgentSystemResult
- Primo.AI.Server.Model.AgentSystem.AgentSystemResultContent
- Primo.AI.Server.Model.AgentSystem.AgentSystemResultFile
- Primo.AI.Server.Model.ImageTransforms
- Primo.AI.Server.Model.RectangleItemModel
- Primo.AI.Server.Model.InferenceResult
- Primo.AI.Server.Model.InferenceResultContent
- Primo.AI.Server.Model.InferenceResultFile
- Primo.AI.Server.Model.InferenceResultItem
- Primo.AI.Server.Model.InferenceResultItemRow
- Primo.AI.Server.Model.Packages.PackageResult
- Primo.AI.Server.Model.Packages.PackageResultDocument
- Primo.AI.Server.Model.Packages.PackageResultPage
- Primo.AI.Server.Model.Packages.PackageResultFile
- Primo.AI.Server.Model.Packages.PackageResultError
- Primo.AI.Server.Model.NlpResult
- Primo.AI.Server.Model.NlpResultContent
- Primo.AI.Server.Model.NlpResultFile
- Primo.AI.Server.Model.FileType
- Primo.AI.Server.Model.IsRunningComponent
- Primo.AI.Server.Model.RequestType
- Primo.AI.Server.Tools.SmartOcr.FieldCropsExtractorResult
- Primo.AI.Server.Tools.SmartOcr.FieldCrop
- Primo.AI.Server.Tools.SmartOcr.TextInAreaSearcherResult
- Primo.AI.Server.Tools.SmartOcr.TextInArea
- Primo.AI.Server.Tools.SmartOcr.TextNearToFieldSearcherResult
- Primo.AI.Server.Tools.SmartOcr.TextNearToField
Feedback
Bug reports and contributions are welcome at Primo RPA chat
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.