انتقل إلى المحتوى الرئيسي

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?

refineTemplate?

Returns

Refine

Overrides

PromptMixin . constructor

Source

packages/core/src/synthesizers/builders.ts:88

Properties

llm

llm: LLM<object, object>

Source

packages/core/src/synthesizers/builders.ts:83


promptHelper

promptHelper: PromptHelper

Source

packages/core/src/synthesizers/builders.ts:84


refineTemplate()

refineTemplate: (__namedParameters) => string

Parameters

__namedParameters

__namedParameters.context: undefined | string= ""

__namedParameters.existingAnswer: undefined | string= ""

__namedParameters.query: undefined | string= ""

Returns

string

Source

packages/core/src/synthesizers/builders.ts:86


textQATemplate()

textQATemplate: (__namedParameters) => string

Parameters

__namedParameters

__namedParameters.context: undefined | string= ""

__namedParameters.query: undefined | string= ""

Returns

string

Source

packages/core/src/synthesizers/builders.ts:85

Methods

_getPromptModules()

protected _getPromptModules(): Record<string, any>

Returns

Record<string, any>

Inherited from

PromptMixin . _getPromptModules

Source

packages/core/src/prompts/Mixin.ts:82


_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

Overrides

PromptMixin . _getPrompts

Source

packages/core/src/synthesizers/builders.ts:101


_updatePrompts()

protected _updatePrompts(prompts): void

Parameters

prompts

prompts.refineTemplate

prompts.textQATemplate

Returns

void

Overrides

PromptMixin . _updatePrompts

Source

packages/core/src/synthesizers/builders.ts:111


complete()

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

Parameters

params

params.prompt: string

params.stream: boolean

Returns

Promise<string | AsyncIterable<string>>

Source

packages/core/src/synthesizers/builders.ts:224


getPrompts()

getPrompts(): PromptsDict

Returns all prompts from the mixin and its modules

Returns

PromptsDict

Implementation of

ResponseBuilder . getPrompts

Inherited from

PromptMixin . getPrompts

Source

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


getResponse()

getResponse(params)

getResponse(params): Promise<AsyncIterable<string>>

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

Parameters

params: ResponseBuilderParamsStreaming

Returns

Promise<AsyncIterable<string>>

Implementation of

ResponseBuilder . getResponse

Source

packages/core/src/synthesizers/builders.ts:124

getResponse(params)

getResponse(params): Promise<string>

Parameters

params: ResponseBuilderParamsNonStreaming

Returns

Promise<string>

Implementation of

ResponseBuilder . getResponse

Source

packages/core/src/synthesizers/builders.ts:127


giveResponseSingle()

private giveResponseSingle(queryStr, textChunk, stream): Promise<undefined | string | AsyncIterable<string>>

Parameters

queryStr: string

textChunk: string

stream: boolean

Returns

Promise<undefined | string | AsyncIterable<string>>

Source

packages/core/src/synthesizers/builders.ts:162


refineResponseSingle()

private refineResponseSingle(initialReponse, queryStr, textChunk, stream): Promise<string | AsyncIterable<string>>

Parameters

initialReponse: string

queryStr: string

textChunk: string

stream: boolean

Returns

Promise<string | AsyncIterable<string>>

Source

packages/core/src/synthesizers/builders.ts:197


updatePrompts()

updatePrompts(promptsDict): void

Updates the prompts in the mixin and its modules

Parameters

promptsDict: PromptsDict

Returns

void

Implementation of

ResponseBuilder . updatePrompts

Inherited from

PromptMixin . updatePrompts

Source

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


validatePrompts()

validatePrompts(promptsDict, moduleDict): void

Validates the prompt keys and module keys

Parameters

promptsDict: PromptsDict

moduleDict: ModuleDict

Returns

void

Implementation of

ResponseBuilder . validatePrompts

Inherited from

PromptMixin . validatePrompts

Source

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