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

Source

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

Properties

apiKey

apiKey: string

Source

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


baseUrl

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

Source

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


boundingBox?

optional boundingBox: string

Source

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


checkInterval

checkInterval: number = 1

Source

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


doNotCache?

optional doNotCache: boolean

Source

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


doNotUnrollColumns?

optional doNotUnrollColumns: boolean

Source

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


fastMode?

optional fastMode: boolean

Source

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


gpt4oApiKey?

optional gpt4oApiKey: string

Source

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


gpt4oMode

gpt4oMode: boolean = false

Source

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


ignoreErrors

ignoreErrors: boolean = true

Source

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


invalidateCache?

optional invalidateCache: boolean

Source

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


language

language: Language = "en"

Source

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


maxTimeout

maxTimeout: number = 2000

Source

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


pageSeparator?

optional pageSeparator: string

Source

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


parsingInstruction?

optional parsingInstruction: string

Source

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


resultType

resultType: ResultType = "text"

Source

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


skipDiagonalText?

optional skipDiagonalText: boolean

Source

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


targetPages?

optional targetPages: string

Source

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


verbose

verbose: boolean = true

Source

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

Methods

createJob()

private createJob(data, fileName?): Promise<string>

Parameters

data: Uint8Array

fileName?: string

Returns

Promise<string>

Source

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


fetchAndSaveImage()

private fetchAndSaveImage(imageName, imagePath, jobId): Promise<void>

Parameters

imageName: string

imagePath: string

jobId: string

Returns

Promise<void>

Source

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


getImagePath()

private getImagePath(downloadPath, jobId, imageName): Promise<string>

Parameters

downloadPath: string

jobId: string

imageName: string

Returns

Promise<string>

Source

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


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.

Source

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


getJobResult()

private getJobResult(jobId, resultType): Promise<any>

Parameters

jobId: string

resultType: string

Returns

Promise<any>

Source

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


loadData()

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

Parameters

filePath: string

Returns

Promise <Document <Metadata>[]>

Inherited from

FileReader . loadData

Source

packages/llamaindex/src/readers/type.ts:20


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

Source

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


loadJson()

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

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

Parameters

file: string

The path to the file to be loaded.

Returns

Promise<Record<string, any>[]>

A Promise that resolves to an array of JSON objects.

Source

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


addMetaData()

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

Parameters

filePath: string

Returns

Function

Parameters

doc: Document <Metadata>

index: number

Returns

void

Inherited from

FileReader . addMetaData

Source

packages/llamaindex/src/readers/type.ts:29


getMimeType()

static getMimeType(data): Promise<object>

Parameters

data: Uint8Array

Returns

Promise<object>

extension

extension: string

mime

mime: string

Source

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