diff --git a/docs/code_samples/workflow_ots_rag.txt b/docs/code_samples/workflow_ots_rag.txt new file mode 100644 index 000000000..782b89dc7 --- /dev/null +++ b/docs/code_samples/workflow_ots_rag.txt @@ -0,0 +1,32 @@ +const mindee = require("mindee"); +// for TS or modules: +// import * as mindee from "mindee"; + +const workflowId: string = "workflow-id"; + +// Init a new client +const mindeeClient = new mindee.Client({ apiKey: "my-api-key" }); + +// Load a file from disk +const inputSource = mindeeClient.docFromPath( + "/path/to/the/file.ext" +); + +// Configure the RAG-enabled workflow +const workflowParams = { + rag: true, + workflowId: workflowId +}; + +// Parse the file asynchronously on a workflow queue +const asyncApiResponse = mindeeClient.enqueueAndParse( + mindee.product.FinancialDocumentV1, + inputSource, + workflowParams +); + +// Handle the response Promise +asyncApiResponse.then((resp) => { + // print a string summary + console.log(resp.document?.toString()); +}); diff --git a/docs/code_samples/workflow_polling.txt b/docs/code_samples/workflow_polling.txt index e0e01cfaa..81cb0883b 100644 --- a/docs/code_samples/workflow_polling.txt +++ b/docs/code_samples/workflow_polling.txt @@ -18,6 +18,7 @@ const customEndpoint = mindeeClient.createEndpoint( "my-version" // Defaults to "1" ); +// Configure the RAG-enabled workflow const workflowParams = { rag: true, workflowId: workflowId, @@ -29,12 +30,10 @@ const asyncApiResponse = mindeeClient.enqueueAndParse( mindee.product.GeneratedV1, inputSource, workflowParams - // Optionally: send an alias & priority - // { alias: "my-alias", priority: ExecutionPriority.low } ); // Handle the response Promise asyncApiResponse.then((resp) => { // print a string summary console.log(resp.document?.toString()); -}); \ No newline at end of file +});