Skip to content

v0.123.0

Compare
Choose a tag to compare
@lgrammel lgrammel released this 13 Jan 18:15

Added

  • classify model function (docs) for classifying values. The SemanticClassifier has been renamed to EmbeddingSimilarityClassifier and can be used in conjunction with classify:

    import { classify, EmbeddingSimilarityClassifier, openai } from "modelfusion";
    
    const classifier = new EmbeddingSimilarityClassifier({
      embeddingModel: openai.TextEmbedder({ model: "text-embedding-ada-002" }),
      similarityThreshold: 0.82,
      clusters: [
        {
          name: "politics" as const,
          values: [
            "they will save the country!",
            // ...
          ],
        },
        {
          name: "chitchat" as const,
          values: [
            "how's the weather today?",
            // ...
          ],
        },
      ],
    });
    
    // strongly typed result:
    const result = await classify({
      model: classifier,
      value: "don't you love politics?",
    });