Skip to main content

Class: LLMSingleSelector

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

Extends

Constructors

new LLMSingleSelector()

new LLMSingleSelector(init): LLMSingleSelector

Parameters

init

init.llm: LLM<object, object>

init.outputParser?: BaseOutputParser<StructuredOutput<Answer[]>>

init.prompt?: SingleSelectPrompt

Returns

LLMSingleSelector

Overrides

BaseSelector.constructor

Defined in

packages/llamaindex/src/selectors/llmSelectors.ts:127

Properties

llm

llm: LLM<object, object>

Defined in

packages/llamaindex/src/selectors/llmSelectors.ts:123


outputParser

outputParser: BaseOutputParser<StructuredOutput<Answer[]>>

Defined in

packages/llamaindex/src/selectors/llmSelectors.ts:125


prompt

prompt: SingleSelectPrompt

Defined in

packages/llamaindex/src/selectors/llmSelectors.ts:124

Methods

_getPromptModules()

protected _getPromptModules(): object

Return a dictionary of sub-modules within the current module that also implement PromptMixin (so that their prompts can also be get/set).

Can be blank if no sub-modules.

Returns

object

Overrides

BaseSelector._getPromptModules

Defined in

packages/llamaindex/src/selectors/llmSelectors.ts:184


_getPrompts()

_getPrompts(): Record<string, SingleSelectPrompt>

Returns

Record<string, SingleSelectPrompt>

Overrides

BaseSelector._getPrompts

Defined in

packages/llamaindex/src/selectors/llmSelectors.ts:138


_select()

_select(choices, query): Promise<SelectorResult>

Selects a single choice from a list of choices.

Parameters

choices: ToolMetadataOnlyDescription[]

query: QueryBundle

Returns

Promise<SelectorResult>

Overrides

BaseSelector._select

Defined in

packages/llamaindex/src/selectors/llmSelectors.ts:153


_updatePrompts()

_updatePrompts(prompts): void

Parameters

prompts: Record<string, SingleSelectPrompt>

Returns

void

Overrides

BaseSelector._updatePrompts

Defined in

packages/llamaindex/src/selectors/llmSelectors.ts:142


asQueryComponent()

asQueryComponent(): unknown

Returns

unknown

Defined in

packages/llamaindex/src/selectors/llmSelectors.ts:180


getPrompts()

getPrompts(): PromptsRecord

Returns

PromptsRecord

Inherited from

BaseSelector.getPrompts

Defined in

packages/core/dist/prompts/index.d.ts:58


select()

select(choices, query): Promise<SelectorResult>

Parameters

choices: MetadataType[]

query: QueryType

Returns

Promise<SelectorResult>

Inherited from

BaseSelector.select

Defined in

packages/llamaindex/src/selectors/base.ts:27


updatePrompts()

updatePrompts(prompts): void

Parameters

prompts: PromptsRecord

Returns

void

Inherited from

BaseSelector.updatePrompts

Defined in

packages/core/dist/prompts/index.d.ts:59


validatePrompts()

validatePrompts(promptsDict, moduleDict): void

Parameters

promptsDict: PromptsRecord

moduleDict: ModuleRecord

Returns

void

Inherited from

BaseSelector.validatePrompts

Defined in

packages/core/dist/prompts/index.d.ts:57