Lazarus RikAI2 Async-6.930.1900

Lazarus RikAI2 Async-6.930.1900

 

 

 

 

 

 

Lazarus RikAI2

 

Author   Taiki Shimasaki

 

Primary Features

 

Lazarus RikAI2 is one of the custom models from Lazarus Forms. It is a comprehensive conversational AI focusing on document processing. The solution takes any document (PDF, JPG, PNG, or TIFF) and one or more “questions” as input and returns “question(s), answer(s)” in CSV format as standard output.  The plugin has an advanced menu where users can choose JSON and YAML as outputs for easier processing.

 

To use this plugin, you must obtain API credentials from this link

https://api.lazarusforms.com/signup

For more information, please visit Lazarus Forms API Documentation page.

https://docs.lazarusforms.com/docs/rikai-2/rikai2-overview

Need help?

Technical contact to tech@argos-labs.com

 

May you search all operations,

Input (Requirement)

  • orgId

  • authKey

  • Question (one or more)

  • Input URL or Base64 Text File

Input (Optional for additional infomation)

  • Metadata (JSON Format)

  • Webhook URL

  • Output URL

 

Return Value

  • Question and answers in a JSON format

Return Code

  • 0 Success

  • 1 misc. errors

 

 

Parameter Setting samples

 

The new API specification

- About the new API

The new API does not return answers to questions in response.
Answers are now sent per process via webhook.

For more information, please check the following :

https://docs.lazarusforms.com/docs/rikai-2/rikai2-overview

- How to use

For information on how to use the API, check the documentation at the following URL.

https://docs.lazarusforms.com/docs/rikai-2/rikai2/operations/create-a-rikai-bulk

 

- How to receive Webhook

The next method is to set up a server in Python to receive webhooks.

A sample script for a server to receive webhooks in Python looks like this :

code1
import http.server import socketserver import datetime import base64 import json class MyHandler(http.server.BaseHTTPRequestHandler): def do_POST(self): content_length = int(self.headers['content-length']) # Get Body now = datetime.datetime.now() req_body = self.rfile.read(content_length).decode("utf-8") json_body = json.loads(req_body) if json_body["status"] == "SUCCESS": # Processing docId doc_id = json_body["metadata"]["docId"] doc_id_dec = base64.b64decode(doc_id).decode('utf-8') pam_id = str(doc_id_dec).split('+')[0] # Create Output JSON file_name = pam_id + '_' + str(doc_id) + '_' + now.strftime('%Y%m%d%H%M%S') + '.json' with open(file_name, 'w', encoding='utf-8') as f: json.dump(json_body, f, indent=3, ensure_ascii=False) # Response self.send_response(200) self.send_header('Content-Type', 'text/plain; charset=utf-8') self.end_headers() with socketserver.TCPServer(("", 80), MyHandler) as httpd: httpd.serve_forever()

Can download it from the following link :

 

Here, the ”docId” is set in the ”metadata” above, and a process is built in to disassemble and process it.
The ”docId” is set to “PAMID” + “Requests sent date and time” encoded in Base64.

 

Running this as a server will allow you to receive webhooks.

All that remains is to set the published URL or IP address as the WebhookURL.

 

If you want to set up a Webhook server using Docker, please refer to here: 
https://docs.google.com/document/d/1u4moCaAa92nwkyuCn2cs40xDt92l4g6BG5QYN5rplOY/edit?usp=sharing