Nhảy tới nội dung

Class: CompactAndRefine

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

Hierarchy

Constructors

constructor

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

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

CompactAndRefine

Inherited from

Refine.constructor

Defined in

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

Properties

llm

llm: LLM<Record<string, unknown>>

Inherited from

Refine.llm

Defined in

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


promptHelper

promptHelper: PromptHelper

Inherited from

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

Inherited from

Refine.refineTemplate

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

Inherited from

Refine.textQATemplate

Defined in

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

Methods

_getPromptModules

_getPromptModules(): Record<string, any>

Returns

Record<string, any>

Inherited from

Refine._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

Inherited from

Refine._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

Inherited from

Refine._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>>

Inherited from

Refine.complete

Defined in

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


getPrompts

getPrompts(): PromptsDict

Returns all prompts from the mixin and its modules

Returns

PromptsDict

Inherited from

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

Overrides

Refine.getResponse

Defined in

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

getResponse(params): Promise<string>

Parameters

NameType
paramsResponseBuilderParamsNonStreaming

Returns

Promise<string>

Overrides

Refine.getResponse

Defined in

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


updatePrompts

updatePrompts(promptsDict): void

Updates the prompts in the mixin and its modules

Parameters

NameType
promptsDictPromptsDict

Returns

void

Inherited from

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

Inherited from

Refine.validatePrompts

Defined in

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