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

Class: LLMSingleSelector

A selector that uses the LLM to select a single choice from a list of choices.

Hierarchy

Constructors

constructor

new LLMSingleSelector(init): LLMSingleSelector

Parameters

NameType
initObject
init.llmLLMPredictorType
init.outputParser?BaseOutputParser<StructuredOutput<Answer[]>>
init.prompt?(numChoices: number, contextList: string, queryStr: string) => string

Returns

LLMSingleSelector

Overrides

BaseSelector.constructor

Defined in

packages/core/src/selectors/llmSelectors.ts:122

Properties

llm

llm: LLMPredictorType

Defined in

packages/core/src/selectors/llmSelectors.ts:118


outputParser

outputParser: BaseOutputParser<StructuredOutput<Answer[]>>

Defined in

packages/core/src/selectors/llmSelectors.ts:120


prompt

prompt: (numChoices: number, contextList: string, queryStr: string) => string

Type declaration

▸ (numChoices, contextList, queryStr): string

Parameters
NameType
numChoicesnumber
contextListstring
queryStrstring
Returns

string

Defined in

packages/core/src/selectors/llmSelectors.ts:119

Methods

_getPromptModules

_getPromptModules(): Record<string, any>

Returns

Record<string, any>

Inherited from

BaseSelector._getPromptModules

Defined in

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


_getPrompts

_getPrompts(): Record<string, (numChoices: number, contextList: string, queryStr: string) => string>

Returns

Record<string, (numChoices: number, contextList: string, queryStr: string) => string>

Overrides

BaseSelector._getPrompts

Defined in

packages/core/src/selectors/llmSelectors.ts:133


_select

_select(choices, queryBundle): Promise<SelectorResult>

Selects a single choice from a list of choices.

Parameters

NameType
choicesToolMetadataOnlyDescription[]
queryBundleQueryBundle

Returns

Promise<SelectorResult>

Overrides

BaseSelector._select

Defined in

packages/core/src/selectors/llmSelectors.ts:146


_updatePrompts

_updatePrompts(prompts): void

Parameters

NameType
promptsRecord<string, (numChoices: number, contextList: string, queryStr: string) => string>

Returns

void

Overrides

BaseSelector._updatePrompts

Defined in

packages/core/src/selectors/llmSelectors.ts:137


asQueryComponent

asQueryComponent(): unknown

Returns

unknown

Defined in

packages/core/src/selectors/llmSelectors.ts:173


getPrompts

getPrompts(): PromptsDict

Returns all prompts from the mixin and its modules

Returns

PromptsDict

Inherited from

BaseSelector.getPrompts

Defined in

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


select

select(choices, query): Promise<SelectorResult>

Parameters

NameType
choicesMetadataType[]
queryMessageContent | QueryBundle

Returns

Promise<SelectorResult>

Inherited from

BaseSelector.select

Defined in

packages/core/src/selectors/base.ts:28


updatePrompts

updatePrompts(promptsDict): void

Updates the prompts in the mixin and its modules

Parameters

NameType
promptsDictPromptsDict

Returns

void

Inherited from

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

BaseSelector.validatePrompts

Defined in

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