Skip to main content

Class: LlamaParseReader

Represents a reader for parsing files using the LlamaParse API. See https://github.com/run-llama/llama_parse

Extends

Constructors

new LlamaParseReader()

new LlamaParseReader(params): LlamaParseReader

Parameters

params: Partial<LlamaParseReader> = {}

Returns

LlamaParseReader

Overrides

FileReader.constructor

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:241

Properties

apiKey

apiKey: string

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:190


baseUrl

baseUrl: string = "https://api.cloud.llamaindex.ai/api/parsing"

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:192


boundingBox?

optional boundingBox: string

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:226


checkInterval

checkInterval: number = 1

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:196


doNotCache?

optional doNotCache: boolean

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:210


doNotUnrollColumns?

optional doNotUnrollColumns: boolean

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:214


fastMode?

optional fastMode: boolean

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:212


gpt4oApiKey?

optional gpt4oApiKey: string

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:224


gpt4oMode

gpt4oMode: boolean = false

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:222


ignoreErrors

ignoreErrors: boolean = true

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:230


invalidateCache?

optional invalidateCache: boolean

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:208


language

language: Language = "en"

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:202


maxTimeout

maxTimeout: number = 2000

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:198


pagePrefix?

optional pagePrefix: string

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:218


pageSeparator?

optional pageSeparator: string

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:216


pageSuffix?

optional pageSuffix: string

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:220


parsingInstruction?

optional parsingInstruction: string

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:204


resultType

resultType: ResultType = "text"

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:194


skipDiagonalText?

optional skipDiagonalText: boolean

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:206


splitByPage

splitByPage: boolean = true

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:232


targetPages?

optional targetPages: string

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:228


useVendorMultimodalModel

useVendorMultimodalModel: boolean = false

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:234


vendorMultimodalApiKey?

optional vendorMultimodalApiKey: string

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:238


vendorMultimodalModelName?

optional vendorMultimodalModelName: string

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:236


verbose

verbose: boolean = true

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:200

Methods

getImages()

getImages(jsonResult, downloadPath): Promise<Record<string, any>[]>

Downloads and saves images from a given JSON result to a specified download path. Currently only supports resultType = "json"

Parameters

jsonResult: Record<string, any>[]

The JSON result containing image information.

downloadPath: string

The path to save the downloaded images.

Returns

Promise<Record<string, any>[]>

A Promise that resolves to an array of image objects.

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:483


loadData()

loadData(filePath): Promise<Document<Metadata>[]>

Parameters

filePath: string

Returns

Promise<Document<Metadata>[]>

Inherited from

FileReader.loadData

Defined in

packages/core/dist/schema/index.d.ts:187


loadDataAsContent()

loadDataAsContent(fileContent, fileName?): Promise<Document<Metadata>[]>

Loads data from a file and returns an array of Document objects. To be used with resultType = "text" and "markdown"

Parameters

fileContent: Uint8Array

The content of the file to be loaded.

fileName?: string

The optional name of the file to be loaded.

Returns

Promise<Document<Metadata>[]>

A Promise object that resolves to an array of Document objects.

Overrides

FileReader.loadDataAsContent

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:403


loadJson()

loadJson(filePathOrContent): Promise<Record<string, any>[]>

Loads data from a file and returns an array of JSON objects. To be used with resultType = "json"

Parameters

filePathOrContent: string | Uint8Array

The file path to the file or the content of the file as a Buffer

Returns

Promise<Record<string, any>[]>

A Promise that resolves to an array of JSON objects.

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:445


addMetaData()

static addMetaData(filePath): (doc, index) => void

Parameters

filePath: string

Returns

Function

Parameters

doc: Document<Metadata>

index: number

Returns

void

Inherited from

FileReader.addMetaData

Defined in

packages/core/dist/schema/index.d.ts:188


getMimeType()

static getMimeType(data): Promise<object>

Parameters

data: Uint8Array

Returns

Promise<object>

extension

extension: string

mime

mime: string

Defined in

packages/llamaindex/src/readers/LlamaParseReader.ts:593