OpenAI Document Parser

Parses documents with OpenAI to generate schemas, validation scripts, or structured JSON output for workflow use.

Revision History

0.0.0.1 - Added the OpenAI Document Parser node with schema generation, validation script generation, structured parsing, connection settings, and templates.
0.0.0.4 - Updated templates and embedded the node icon.
0.0.0.6 - Allowed documents to be parsed without supplying a schema.
0.0.0.8 - Updated template behavior and validation script handling.
0.0.0.9 - Updated the published assembly version.
0.0.0.13 - Split the node into dedicated CreateSchema, CreateValidationScript, and ParseDocument actions, and fixed templates and icon behavior.

Connection

The connection stores the OpenAI API key and model name used by every method.

Property Type Description
API Key Masked OpenAI API key used to authenticate requests.
Model String OpenAI model name used for document parser requests, for example gpt-4.1.

Setup Notes

  • Configure an OpenAI API key with access to the model selected in the connection.
  • The node validates that API Key and Model are provided before each request.
  • The connection test validates the configured model through the OpenAI models endpoint.
  • Provide document content as a stream and pass a DocumentName that includes the file extension.

Methods

The node exposes separate methods for schema generation, validation script generation, and document parsing.

CreateSchema

Generates a JSON schema that models the supplied document structure.

Parameter Type Description
Connection Connection OpenAI API key and model configuration.
DocumentName String Source document file name, including extension. Required.
Document Stream Source document content stream. Required.
CustomProperties Object Optional prompt hints applied during schema generation.
Return Type Description
Response.status String OK or ERROR.
Response.statusMessage String Provider or operation state.
Response.errorMessage String Provider or local validation failure message when the operation cannot complete.
Response.schema Object Generated JSON schema.

CreateValidationScript

Generates a C# validation script for a supplied schema and document context. The generated script must include a Validate method.

Parameter Type Description
Connection Connection OpenAI API key and model configuration.
Schema String JSON schema that the generated script should validate. Required.
DocumentName String Source document file name, including extension. Required.
Document Stream Source document content stream. Required.
CustomProperties Object Optional prompt hints applied during script generation.
Return Type Description
Response.status String OK or ERROR.
Response.statusMessage String Provider or operation state.
Response.errorMessage String Provider or local validation failure message when the operation cannot complete.
Response.validationScript String Generated C# validation script.

ParseDocument

Parses the supplied document into structured JSON, optionally guided by a schema and validation script. For repetitive jobs or large volumes, a schema is recommended to ensure a predictable response format.

Parameter Type Description
Connection Connection OpenAI API key and model configuration.
DocumentName String Source document file name, including extension. Required.
Document Stream Source document content stream. Required.
Schema String Optional JSON schema describing the expected output.
ValidationScript String Optional C# validation script included with the parse request. When supplied, it must define a Validate method.
CustomProperties Object Prompt hints and optional dot-path validation assertions.
Return Type Description
Response.status String OK or ERROR.
Response.statusMessage String Provider or operation state.
Response.errorMessage String Provider or local validation failure message when the operation cannot complete.
Response.parsedDocument Object Parsed document in JSON format.

Usage Notes

  • DocumentName and Document are required for all methods.
  • Schema is required for CreateValidationScript and optional for ParseDocument.
  • ValidationScript, when provided, must include a C# Validate method. The node checks the method contract but does not execute the script locally.
  • CustomProperties can add prompt guidance with prompt.schema.append, prompt.script.append, prompt.parse.append, or prompt.system.append.
  • For ParseDocument, non-prompt. custom property keys are treated as dot-path assertions against the parsed output. A failed assertion raises an error.
  • All methods return a single Response object with standard status, statusMessage, and errorMessage fields.