v0.123.0
Added
-
classify
model function (docs) for classifying values. TheSemanticClassifier
has been renamed toEmbeddingSimilarityClassifier
and can be used in conjunction withclassify
: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?", });