Ana içeriğe geç

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/core/src/readers/LlamaParseReader.ts:135

Properties

apiKey

apiKey: string

Source

packages/core/src/readers/LlamaParseReader.ts:110


baseUrl

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

Source

packages/core/src/readers/LlamaParseReader.ts:112


checkInterval

checkInterval: number = 1

Source

packages/core/src/readers/LlamaParseReader.ts:116


gpt4oApiKey?

optional gpt4oApiKey: string

Source

packages/core/src/readers/LlamaParseReader.ts:132


gpt4oMode

gpt4oMode: boolean = false

Source

packages/core/src/readers/LlamaParseReader.ts:130


invalidateCache

invalidateCache: boolean = false

Source

packages/core/src/readers/LlamaParseReader.ts:128


language

language: Language = "en"

Source

packages/core/src/readers/LlamaParseReader.ts:122


maxTimeout

maxTimeout: number = 2000

Source

packages/core/src/readers/LlamaParseReader.ts:114


parsingInstruction

parsingInstruction: string = ""

Source

packages/core/src/readers/LlamaParseReader.ts:124


resultType

resultType: ResultType = "text"

Source

packages/core/src/readers/LlamaParseReader.ts:120


skipDiagonalText

skipDiagonalText: boolean = false

Source

packages/core/src/readers/LlamaParseReader.ts:126


verbose

verbose: boolean = true

Source

packages/core/src/readers/LlamaParseReader.ts:118

Methods

createJob()

private createJob(data): Promise<string>

Parameters

data: Buffer

Returns

Promise<string>

Source

packages/core/src/readers/LlamaParseReader.ts:155


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/core/src/readers/LlamaParseReader.ts:302


getJobResult()

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

Parameters

jobId: string

resultType: string

Returns

Promise<any>

Source

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


getMimeType()

private getMimeType(data): Promise<string>

Parameters

data: Buffer

Returns

Promise<string>

Source

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


loadData()

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

Parameters

filePath: string

Returns

Promise <Document <Metadata>[]>

Inherited from

FileReader . loadData

Source

packages/core/src/readers/type.ts:17


loadDataAsContent()

loadDataAsContent(fileContent): 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: Buffer

The content 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/core/src/readers/LlamaParseReader.ts:257


loadJson()

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

Loads data from a file and returns its contents as a JSON object. 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 the JSON object.

Source

packages/core/src/readers/LlamaParseReader.ts:279


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/core/src/readers/type.ts:24