logo

Beta

Get Started

Introduction

Core Concepts

Utilities

Integrations

Resources

Precontext

copy markdown

Precontext allow you to access the detailed results from specialized processes that Interfaze runs internally to process your requests. These outputs provide transparency into the multi-step processing that happens behind the scenes, giving you access to intermediate results like OCR data, structured extractions etc.

Understanding the precontext Field in Responses

When Not Streaming

The precontext field contains an array of pre-processing execution results. Each entry includes the process name and its detailed output, providing visibility into the specialized steps taken before generating the final response.

When Streaming

In streaming mode, the precontext data is sent as a single chunk before the main response begins streaming. This chunk follows a structured format that encapsulates all pre-processing information upfront.

...

Examples

Note: LangChain SDK does not provide an official way to access raw API responses, so we cannot include an example for that SDK at this time.

OpenAI SDK

Vercel AI SDK

...

Understanding the Output Structure

Each index in the precontext array contains:

  • name: The name of the specialized process used (e.g., "ocr", "extraction", "analysis")
  • result: The detailed output from that process, containing structured data specific to the task

Example OCR Output Structure

...