Constructor
new FileIngestPipeline(nameopt, kwargsopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string |
<optional> |
null | The name of this pipeline. Will be used to reference this pipeline if this pipeline is used as a Node inside another pipeline. |
kwargs |
Object |
<optional> |
Include other needed properties like apiKey |
Methods
(async) call(user, file, normalizeopt, execution_codeopt) → {Promise.<object>}
Start the pipeline processes.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
user |
string | The ID of the user accessing the Soffos API. Soffos assumes that the owner of the api is an application (app) and that app has users. Soffos API will accept any string. | ||
file |
Blob | The byte stream of the file. The file should not exceed 50Mb in size. | ||
normalize |
string |
<optional> |
'0' | Whether to perform normalization. |
execution_code |
string |
<optional> |
null | If this process should be tracked so it can be terminated via terminate() method, execution_code should be provided to reference this pipeline call. |
Returns:
- An object containing the results of the file conversion and its reference document_id
{
file_converter: {"text":, "tagged_elements": }
doc_ingest: {document_id:}
}
{
file_converter: {"text":
doc_ingest: {document_id:
}
- Type
- Promise.<object>
Example
// provided you have a file input with id="myFile", a text input with id="executionCode",
// and a <pre> element with id="response1":
import {SoffosPipelines} from "soffosai";
async function fileIngest() {
response1.textContent = "";
const file1 = document.getElementById("myFile").files[0];
const execution_code = document.getElementById("executionCode").value;
let pipe = new SoffosPipelines.FileIngestPipeline("my_pipe", {apiKey: my_apiKey});
let response = await pipe.call("client_id", file1, 0, execution_code);
response1.textContent = JSON.stringify(response, null, 2);
}