Skip to main content

Class: CompactAndRefine

CompactAndRefine is a slight variation of Refine that first compacts the text chunks into the smallest possible number of chunks.

Extends

Constructors

new CompactAndRefine()

new CompactAndRefine(serviceContext?, textQATemplate?, refineTemplate?): CompactAndRefine

Parameters

serviceContext?: ServiceContext

textQATemplate?

refineTemplate?

Returns

CompactAndRefine

Inherited from

Refine.constructor

Defined in

packages/llamaindex/src/synthesizers/builders.ts:81

Properties

llm

llm: LLM<object, object>

Inherited from

Refine.llm

Defined in

packages/llamaindex/src/synthesizers/builders.ts:76


promptHelper

promptHelper: PromptHelper

Inherited from

Refine.promptHelper

Defined in

packages/llamaindex/src/synthesizers/builders.ts:77


refineTemplate()

refineTemplate: (__namedParameters) => string

Parameters

__namedParameters

__namedParameters.context: undefined | string = ""

__namedParameters.existingAnswer: undefined | string = ""

__namedParameters.query: undefined | string = ""

Returns

string

Inherited from

Refine.refineTemplate

Defined in

packages/llamaindex/src/synthesizers/builders.ts:79


textQATemplate()

textQATemplate: (__namedParameters) => string

Parameters

__namedParameters

__namedParameters.context: undefined | string = ""

__namedParameters.query: undefined | string = ""

Returns

string

Inherited from

Refine.textQATemplate

Defined in

packages/llamaindex/src/synthesizers/builders.ts:78

Methods

_getPromptModules()

protected _getPromptModules(): Record<string, any>

Returns

Record<string, any>

Inherited from

Refine._getPromptModules

Defined in

packages/llamaindex/src/prompts/Mixin.ts:83


_getPrompts()

protected _getPrompts(): object

Returns

object

refineTemplate()

refineTemplate: (__namedParameters) => string

Parameters

__namedParameters

__namedParameters.context: undefined | string = ""

__namedParameters.existingAnswer: undefined | string = ""

__namedParameters.query: undefined | string = ""

Returns

string

textQATemplate()

textQATemplate: (__namedParameters) => string

Parameters

__namedParameters

__namedParameters.context: undefined | string = ""

__namedParameters.existingAnswer: undefined | string = ""

__namedParameters.query: undefined | string = ""

Returns

string

Inherited from

Refine._getPrompts

Defined in

packages/llamaindex/src/synthesizers/builders.ts:94


_updatePrompts()

protected _updatePrompts(prompts): void

Parameters

prompts

prompts.refineTemplate

prompts.textQATemplate

Returns

void

Inherited from

Refine._updatePrompts

Defined in

packages/llamaindex/src/synthesizers/builders.ts:104


complete()

complete(params): Promise<string | AsyncIterable<string>>

Parameters

params

params.prompt: string

params.stream: boolean

Returns

Promise<string | AsyncIterable<string>>

Inherited from

Refine.complete

Defined in

packages/llamaindex/src/synthesizers/builders.ts:212


getPrompts()

getPrompts(): PromptsDict

Returns all prompts from the mixin and its modules

Returns

PromptsDict

Inherited from

Refine.getPrompts

Defined in

packages/llamaindex/src/prompts/Mixin.ts:27


getResponse()

getResponse(query, stream)

getResponse(query, stream): Promise<AsyncIterable<string>>

Get the response from a query and a list of text chunks.

Parameters

query: ResponseBuilderQuery

stream: true

Returns

Promise<AsyncIterable<string>>

Overrides

Refine.getResponse

Defined in

packages/llamaindex/src/synthesizers/builders.ts:230

getResponse(query, stream)

getResponse(query, stream?): Promise<string>

Get the response from a query and a list of text chunks.

Parameters

query: ResponseBuilderQuery

stream?: false

Returns

Promise<string>

Overrides

Refine.getResponse

Defined in

packages/llamaindex/src/synthesizers/builders.ts:234


updatePrompts()

updatePrompts(promptsDict): void

Updates the prompts in the mixin and its modules

Parameters

promptsDict: PromptsDict

Returns

void

Inherited from

Refine.updatePrompts

Defined in

packages/llamaindex/src/prompts/Mixin.ts:48


validatePrompts()

validatePrompts(promptsDict, moduleDict): void

Validates the prompt keys and module keys

Parameters

promptsDict: PromptsDict

moduleDict: ModuleDict

Returns

void

Inherited from

Refine.validatePrompts

Defined in

packages/llamaindex/src/prompts/Mixin.ts:10