Class: Refine
A response builder that uses the query to ask the LLM generate a better response using multiple text chunks.
Hierarchy
-
↳
Refine
Implements
Constructors
constructor
• new Refine(serviceContext?
, textQATemplate?
, refineTemplate?
): Refine
Parameters
Name | Type |
---|---|
serviceContext? | ServiceContext |
textQATemplate? | (__namedParameters : { context : undefined | string = ""; query : undefined | string = "" }) => string |
refineTemplate? | (__namedParameters : { context : undefined | string = ""; existingAnswer : undefined | string = ""; query : undefined | string = "" }) => string |
Returns
Overrides
Defined in
packages/core/src/synthesizers/builders.ts:89
Properties
llm
• llm: LLM
<Record
<string
, unknown
>>
Defined in
packages/core/src/synthesizers/builders.ts:84
promptHelper
• promptHelper: PromptHelper
Defined in
packages/core/src/synthesizers/builders.ts:85
refineTemplate
• refineTemplate: (__namedParameters
: { context
: undefined
| string
= ""; existingAnswer
: undefined
| string
= ""; query
: undefined
| string
= "" }) => string
Type declaration
▸ («destructured»
): string
Parameters
Name | Type | Default value |
---|---|---|
«destructured» | Object | undefined |
› context | undefined | string | "" |
› existingAnswer | undefined | string | "" |
› query | undefined | string | "" |
Returns
string
Defined in
packages/core/src/synthesizers/builders.ts:87
textQATemplate
• textQATemplate: (__namedParameters
: { context
: undefined
| string
= ""; query
: undefined
| string
= "" }) => string
Type declaration
▸ («destructured»
): string
Parameters
Name | Type | Default value |
---|---|---|
«destructured» | Object | undefined |
› context | undefined | string | "" |
› query | undefined | string | "" |
Returns
string
Defined in
packages/core/src/synthesizers/builders.ts:86
Methods
_getPromptModules
▸ _getPromptModules(): Record
<string
, any
>
Returns
Record
<string
, any
>
Inherited from
Defined in
packages/core/src/prompts/Mixin.ts:83
_getPrompts
▸ _getPrompts(): Object
Returns
Object
Name | Type |
---|---|
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
Defined in
packages/core/src/synthesizers/builders.ts:102
_updatePrompts
▸ _updatePrompts(prompts
): void
Parameters
Name | Type |
---|---|
prompts | Object |
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
Defined in
packages/core/src/synthesizers/builders.ts:112
complete
▸ complete(params
): Promise
<string
| AsyncIterable
<string
>>
Parameters
Name | Type |
---|---|
params | Object |
params.prompt | string |
params.stream | boolean |
Returns
Promise
<string
| AsyncIterable
<string
>>
Defined in
packages/core/src/synthesizers/builders.ts:225
getPrompts
▸ getPrompts(): PromptsDict
Returns all prompts from the mixin and its modules
Returns
PromptsDict
Implementation of
Inherited from
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
Name | Type |
---|---|
params | ResponseBuilderParamsStreaming |
Returns
Promise
<AsyncIterable
<string
>>
Implementation of
Defined in
packages/core/src/synthesizers/builders.ts:125
▸ getResponse(params
): Promise
<string
>
Parameters
Name | Type |
---|---|
params | ResponseBuilderParamsNonStreaming |
Returns
Promise
<string
>
Implementation of
Defined in
packages/core/src/synthesizers/builders.ts:128
giveResponseSingle
▸ giveResponseSingle(queryStr
, textChunk
, stream
): Promise
<undefined
| string
| AsyncIterable
<string
>>
Parameters
Name | Type |
---|---|
queryStr | string |
textChunk | string |
stream | boolean |
Returns
Promise
<undefined
| string
| AsyncIterable
<string
>>
Defined in
packages/core/src/synthesizers/builders.ts:163
refineResponseSingle
▸ refineResponseSingle(initialReponse
, queryStr
, textChunk
, stream
): Promise
<string
| AsyncIterable
<string
>>
Parameters
Name | Type |
---|---|
initialReponse | string |
queryStr | string |
textChunk | string |
stream | boolean |
Returns
Promise
<string
| AsyncIterable
<string
>>
Defined in
packages/core/src/synthesizers/builders.ts:198
updatePrompts
▸ updatePrompts(promptsDict
): void
Updates the prompts in the mixin and its modules
Parameters
Name | Type |
---|---|
promptsDict | PromptsDict |
Returns
void
Implementation of
Inherited from
Defined in
packages/core/src/prompts/Mixin.ts:48
validatePrompts
▸ validatePrompts(promptsDict
, moduleDict
): void
Validates the prompt keys and module keys
Parameters
Name | Type |
---|---|
promptsDict | PromptsDict |
moduleDict | ModuleDict |
Returns
void
Implementation of
ResponseBuilder.validatePrompts