跳到主要内容

Class: VectorIndexRetriever

VectorIndexRetriever retrieves nodes from a VectorIndex.

Implements

Constructors

constructor

new VectorIndexRetriever(«destructured»)

Parameters

NameType
«destructured»Object
› indexVectorStoreIndex
› similarityTopK?number

Defined in

packages/core/src/indices/vectorStore/VectorIndexRetriever.ts:24

Properties

index

index: VectorStoreIndex

Defined in

packages/core/src/indices/vectorStore/VectorIndexRetriever.ts:20


serviceContext

Private serviceContext: ServiceContext

Defined in

packages/core/src/indices/vectorStore/VectorIndexRetriever.ts:22


similarityTopK

similarityTopK: number

Defined in

packages/core/src/indices/vectorStore/VectorIndexRetriever.ts:21

Methods

buildNodeListFromQueryResult

Protected buildNodeListFromQueryResult(result): NodeWithScore<Metadata>[]

Parameters

NameType
resultVectorStoreQueryResult

Returns

NodeWithScore<Metadata>[]

Defined in

packages/core/src/indices/vectorStore/VectorIndexRetriever.ts:102


buildVectorStoreQuery

Protected buildVectorStoreQuery(embedModel, query): Promise<VectorStoreQuery>

Parameters

NameType
embedModelBaseEmbedding
querystring

Returns

Promise<VectorStoreQuery>

Defined in

packages/core/src/indices/vectorStore/VectorIndexRetriever.ts:89


getServiceContext

getServiceContext(): ServiceContext

Returns

ServiceContext

Implementation of

BaseRetriever.getServiceContext

Defined in

packages/core/src/indices/vectorStore/VectorIndexRetriever.ts:120


retrieve

retrieve(query, parentEvent?, preFilters?): Promise<NodeWithScore<Metadata>[]>

Parameters

NameType
querystring
parentEvent?Event
preFilters?unknown

Returns

Promise<NodeWithScore<Metadata>[]>

Implementation of

BaseRetriever.retrieve

Defined in

packages/core/src/indices/vectorStore/VectorIndexRetriever.ts:37


sendEvent

Protected sendEvent(query, nodesWithScores, parentEvent): void

Parameters

NameType
querystring
nodesWithScoresNodeWithScore<Metadata>[]
parentEventundefined | Event

Returns

void

Defined in

packages/core/src/indices/vectorStore/VectorIndexRetriever.ts:72


textRetrieve

Protected textRetrieve(query, preFilters?): Promise<NodeWithScore<Metadata>[]>

Parameters

NameType
querystring
preFilters?unknown

Returns

Promise<NodeWithScore<Metadata>[]>

Defined in

packages/core/src/indices/vectorStore/VectorIndexRetriever.ts:50


textToImageRetrieve

Private textToImageRetrieve(query, preFilters?): Promise<NodeWithScore<Metadata>[]>

Parameters

NameType
querystring
preFilters?unknown

Returns

Promise<NodeWithScore<Metadata>[]>

Defined in

packages/core/src/indices/vectorStore/VectorIndexRetriever.ts:59