Class SemanticSimilarityExampleSelector<V>

Class that selects examples based on semantic similarity. It extends the BaseExampleSelector class.

Type Parameters

Hierarchy

Constructors

Properties

vectorStoreRetriever: VectorStoreRetriever<V>
exampleKeys?: string[]
inputKeys?: string[]

Methods

  • Static method that creates a new instance of SemanticSimilarityExampleSelector. It takes a list of examples, an instance of Embeddings, a VectorStore class, and an options object as parameters. It converts the examples to strings, creates a VectorStore from the strings and the embeddings, and returns a new SemanticSimilarityExampleSelector with the created VectorStore and the options provided.

    Type Parameters

    Parameters

    • examples: Record<string, string>[]

      The list of examples to be used.

    • embeddings: Embeddings

      The instance of Embeddings to be used.

    • vectorStoreCls: C

      The VectorStore class to be used.

    • options: {
          inputKeys?: string[];
          k?: number;
      } & Parameters<C["fromTexts"]>[3] = {}

      The options object for the SemanticSimilarityExampleSelector.

    Returns Promise<SemanticSimilarityExampleSelector<VectorStore>>

    Promise that resolves with a new instance of SemanticSimilarityExampleSelector.

Generated using TypeDoc