Skip to main content

Use the SoMark Document Parser tool in a workflow

1

Add the SoMark Document Parser node

In the FastGPT application workflow, add the SoMark Document Parser node.Add the SoMark plugin in FastGPT
2

Activate the SoMark Document Parser tool

Click Activate and fill in the secret configuration:
  • Base URL: For SoMark API, use https://somark.ai/api/v1; for self-hosted deployment, enter the Base URL of your local deployment.
  • API Key: Required for SoMark API; not required for self-hosted deployment.
No API key yet? Go to the SoMark API workbench to get your API key. Free quota does not need to be claimed and is automatically credited to your account (500 pages/day, 2000 pages/month).
For SoMark Self-host, the plugin automatically appends the corresponding service path to Base URL. Enter the API prefix that reaches your self-hosted service, and do not append a specific service path yourself.
Activate the SoMark plugin in FastGPT
3

Build a minimal demo

Connect a file input node to the File parameter of SoMark Document Parser, then pass the parsed results to a downstream node. The plugin can parse multiple files at a time and works for uploaded PDFs, images, Word, PPT, or Excel files.Build a FastGPT workflow with SoMarkUpload files in debug or preview mode and run the workflow. The node returns one result for each input file in input order. Each item includes markdown, json, and error fields, and downstream nodes can reference them as needed.Run a FastGPT preview with SoMark

Parameters and outputs

Input parameters

ParameterTypeRequiredDefaultDescription
FileFile selectorNoneFiles to parse. You can select multiple files at a time. Supports PDFs, images, Word, PPT, and Excel files.
Output formatsMulti-select-JSON, MarkdownReturn JSON, Markdown, or both.
Image formatSingle select-URLImage element format. Supports URL, Base64, and None.
Formula formatSingle select-LaTeXFormula element format. Supports LaTeX, MathML, and ASCII.
Table formatSingle select-HTMLTable element format. Supports HTML, Markdown, and Image.
Chemical structure formatSingle select-ImageChemical structure element format. Currently only supports Image.
Text cross-page mergingSwitch-OffMerge text blocks that span pages into continuous paragraphs.
Table cross-page mergingSwitch-OffMerge tables that span pages into complete tables.
Title level recognitionSwitch-OffRecognize heading levels such as H1, H2, and H3.
Inline imagesSwitch-OffReturn images embedded in text paragraphs.
Table imagesSwitch-OnReturn images embedded in table cells.
Image understandingSwitch-OnGenerate semantic and structured descriptions for images in the document.
Keep headers and footersSwitch-OffKeep page headers and footers when enabled.

Output variables

VariableTypeDescription
Parsed resultsarrayEach input file maps to one result and results are returned in input order. Each item includes markdown, json, and error fields.

Result fields

FieldTypeDescription
markdownstringFull parsed content in Markdown format. Empty string if Markdown output is not selected or parsing fails.
jsonobjectParsed result in JSON format. Empty object if JSON output is not selected or parsing fails.
errorstringError message for the current file. Empty string when parsing succeeds.

Notes

  • FastGPT passes selected files as download URLs. The plugin downloads the file first, then sends it to the SoMark parsing service.
  • If the file URL contains a filename query parameter, the plugin uses it first to avoid losing suffixes such as .pdf and .docx from temporary download URLs.