Skip to main content

Class: Refine

A response builder that uses the query to ask the LLM generate a better response using multiple text chunks.

Extends

Extended by

Implements

Constructors

new Refine()

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

Parameters

serviceContext?: ServiceContext

textQATemplate?: TextQAPrompt

refineTemplate?: RefinePrompt

Returns

Refine

Overrides

PromptMixin.constructor

Defined in

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

Properties

llm

llm: LLM<object, object>

Defined in

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


promptHelper

promptHelper: PromptHelper

Defined in

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


refineTemplate

refineTemplate: RefinePrompt

Defined in

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


textQATemplate

textQATemplate: TextQAPrompt

Defined in

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

Methods

_getPromptModules()

protected _getPromptModules(): ModuleRecord

Return a dictionary of sub-modules within the current module that also implement PromptMixin (so that their prompts can also be get/set).

Can be blank if no sub-modules.

Returns

ModuleRecord

Implementation of

ResponseBuilder._getPromptModules

Overrides

PromptMixin._getPromptModules

Defined in

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


_getPrompts()

protected _getPrompts(): object

Returns

object

refineTemplate

refineTemplate: RefinePrompt

textQATemplate

textQATemplate: TextQAPrompt

Implementation of

ResponseBuilder._getPrompts

Overrides

PromptMixin._getPrompts

Defined in

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


_updatePrompts()

protected _updatePrompts(prompts): void

Parameters

prompts

prompts.refineTemplate: RefinePrompt

prompts.textQATemplate: TextQAPrompt

Returns

void

Implementation of

ResponseBuilder._updatePrompts

Overrides

PromptMixin._updatePrompts

Defined in

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


complete()

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

Parameters

params

params.prompt: string

params.stream: boolean

Returns

Promise<string | AsyncIterable<string>>

Defined in

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


getPrompts()

getPrompts(): PromptsRecord

Returns

PromptsRecord

Implementation of

ResponseBuilder.getPrompts

Inherited from

PromptMixin.getPrompts

Defined in

packages/core/dist/prompts/index.d.ts:58


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>>

Implementation of

ResponseBuilder.getResponse

Defined in

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

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>

Implementation of

ResponseBuilder.getResponse

Defined in

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


updatePrompts()

updatePrompts(prompts): void

Parameters

prompts: PromptsRecord

Returns

void

Implementation of

ResponseBuilder.updatePrompts

Inherited from

PromptMixin.updatePrompts

Defined in

packages/core/dist/prompts/index.d.ts:59


validatePrompts()

validatePrompts(promptsDict, moduleDict): void

Parameters

promptsDict: PromptsRecord

moduleDict: ModuleRecord

Returns

void

Implementation of

ResponseBuilder.validatePrompts

Inherited from

PromptMixin.validatePrompts

Defined in

packages/core/dist/prompts/index.d.ts:57