Pular para o conteúdo principal

Class: Refine

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

Hierarchy

Implements

Constructors

constructor

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

Parameters

NameType
serviceContext?ServiceContext
textQATemplate?(__namedParameters: { context: undefined | string = ""; query: undefined | string = "" }) => string
refineTemplate?(__namedParameters: { context: undefined | string = ""; existingAnswer: undefined | string = ""; query: undefined | string = "" }) => string

Returns

Refine

Overrides

PromptMixin.constructor

Defined in

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

Properties

llm

llm: LLM<Record<string, unknown>>

Defined in

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


promptHelper

promptHelper: PromptHelper

Defined in

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


refineTemplate

refineTemplate: (__namedParameters: { context: undefined | string = ""; existingAnswer: undefined | string = ""; query: undefined | string = "" }) => string

Type declaration

▸ («destructured»): string

Parameters
NameTypeDefault value
«destructured»Objectundefined
› contextundefined | string""
› existingAnswerundefined | string""
› queryundefined | string""
Returns

string

Defined in

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


textQATemplate

textQATemplate: (__namedParameters: { context: undefined | string = ""; query: undefined | string = "" }) => string

Type declaration

▸ («destructured»): string

Parameters
NameTypeDefault value
«destructured»Objectundefined
› contextundefined | string""
› queryundefined | string""
Returns

string

Defined in

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

Methods

_getPromptModules

_getPromptModules(): Record<string, any>

Returns

Record<string, any>

Inherited from

PromptMixin._getPromptModules

Defined in

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


_getPrompts

_getPrompts(): Object

Returns

Object

NameType
refineTemplate(__namedParameters: { context: undefined | string = ""; existingAnswer: undefined | string = ""; query: undefined | string = "" }) => string
textQATemplate(__namedParameters: { context: undefined | string = ""; existingAnswer: undefined | string = ""; query: undefined | string = "" }) => string

Overrides

PromptMixin._getPrompts

Defined in

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


_updatePrompts

_updatePrompts(prompts): void

Parameters

NameType
promptsObject
prompts.refineTemplate(__namedParameters: { context: undefined | string = ""; existingAnswer: undefined | string = ""; query: undefined | string = "" }) => string
prompts.textQATemplate(__namedParameters: { context: undefined | string = ""; existingAnswer: undefined | string = ""; query: undefined | string = "" }) => string

Returns

void

Overrides

PromptMixin._updatePrompts

Defined in

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


complete

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

Parameters

NameType
paramsObject
params.promptstring
params.streamboolean

Returns

Promise<string | AsyncIterable<string>>

Defined in

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

Defined in

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


getResponse

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

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

Parameters

NameType
paramsResponseBuilderParamsStreaming

Returns

Promise<AsyncIterable<string>>

Implementation of

ResponseBuilder.getResponse

Defined in

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

getResponse(params): Promise<string>

Parameters

NameType
paramsResponseBuilderParamsNonStreaming

Returns

Promise<string>

Implementation of

ResponseBuilder.getResponse

Defined in

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


giveResponseSingle

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

Parameters

NameType
queryStrstring
textChunkstring
streamboolean

Returns

Promise<undefined | string | AsyncIterable<string>>

Defined in

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


refineResponseSingle

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

Parameters

NameType
initialReponsestring
queryStrstring
textChunkstring
streamboolean

Returns

Promise<string | AsyncIterable<string>>

Defined in

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


updatePrompts

updatePrompts(promptsDict): void

Updates the prompts in the mixin and its modules

Parameters

NameType
promptsDictPromptsDict

Returns

void

Implementation of

ResponseBuilder.updatePrompts

Inherited from

PromptMixin.updatePrompts

Defined in

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


validatePrompts

validatePrompts(promptsDict, moduleDict): void

Validates the prompt keys and module keys

Parameters

NameType
promptsDictPromptsDict
moduleDictModuleDict

Returns

void

Implementation of

ResponseBuilder.validatePrompts

Inherited from

PromptMixin.validatePrompts

Defined in

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