Class: EmbeddingSimilarityClassifier<VALUE, CLUSTERS>
Classifies values based on their distance to the values from a set of clusters. When the distance is below a certain threshold, the value is classified as belonging to the cluster, and the cluster name is returned. Otherwise, the value is classified as null.
Type parameters
Name | Type |
---|---|
VALUE | VALUE |
CLUSTERS | extends ValueCluster <VALUE , string >[] |
Implements
Classifier
<VALUE
,ClusterNames
<CLUSTERS
> |null
,EmbeddingSimilarityClassifierSettings
<VALUE
,CLUSTERS
>>
Accessors
settingsForEvent
• get
settingsForEvent(): Partial
<EmbeddingSimilarityClassifierSettings
<VALUE
, CLUSTERS
>>
Returns settings that should be recorded in observability events. Security-related settings (e.g. API keys) should not be included here.
Returns
Partial
<EmbeddingSimilarityClassifierSettings
<VALUE
, CLUSTERS
>>
Implementation of
Classifier.settingsForEvent
Defined in
packages/modelfusion/src/model-function/classify/EmbeddingSimilarityClassifier.ts:129
Constructors
constructor
• new EmbeddingSimilarityClassifier<VALUE
, CLUSTERS
>(settings
): EmbeddingSimilarityClassifier
<VALUE
, CLUSTERS
>
Type parameters
Name | Type |
---|---|
VALUE | VALUE |
CLUSTERS | extends ValueCluster <VALUE , string >[] |
Parameters
Name | Type |
---|---|
settings | EmbeddingSimilarityClassifierSettings <VALUE , CLUSTERS > |
Returns
EmbeddingSimilarityClassifier
<VALUE
, CLUSTERS
>
Defined in
packages/modelfusion/src/model-function/classify/EmbeddingSimilarityClassifier.ts:52
Methods
doClassify
▸ doClassify(value
, options
): Promise
<{ class
: null
| ClusterNames
<CLUSTERS
> ; rawResponse
: undefined
= undefined }>
Parameters
Name | Type |
---|---|
value | VALUE |
options | FunctionCallOptions |
Returns
Promise
<{ class
: null
| ClusterNames
<CLUSTERS
> ; rawResponse
: undefined
= undefined }>
Implementation of
Defined in
packages/modelfusion/src/model-function/classify/EmbeddingSimilarityClassifier.ts:90
getEmbeddings
▸ getEmbeddings(options
): Promise
<{ clusterName
: string
; clusterValue
: VALUE
; embedding
: Vector
}[]>
Parameters
Name | Type |
---|---|
options | FunctionCallOptions |
Returns
Promise
<{ clusterName
: string
; clusterValue
: VALUE
; embedding
: Vector
}[]>
Defined in
packages/modelfusion/src/model-function/classify/EmbeddingSimilarityClassifier.ts:58
withSettings
▸ withSettings(additionalSettings
): EmbeddingSimilarityClassifier
<VALUE
, CLUSTERS
>
The withSettings
method creates a new model with the same configuration as the original model, but with the specified settings changed.
Parameters
Name | Type |
---|---|
additionalSettings | Partial <EmbeddingSimilarityClassifierSettings <VALUE , CLUSTERS >> |
Returns
EmbeddingSimilarityClassifier
<VALUE
, CLUSTERS
>
Example
const model = new OpenAICompletionModel({
model: "gpt-3.5-turbo-instruct",
maxGenerationTokens: 500,
});
const modelWithMoreTokens = model.withSettings({
maxGenerationTokens: 1000,
});
Implementation of
Defined in
packages/modelfusion/src/model-function/classify/EmbeddingSimilarityClassifier.ts:148
Properties
modelInformation
• Readonly
modelInformation: Object
Type declaration
Name | Type |
---|---|
modelName | string |
provider | string |
Implementation of
Defined in
packages/modelfusion/src/model-function/classify/EmbeddingSimilarityClassifier.ts:39
settings
• Readonly
settings: EmbeddingSimilarityClassifierSettings
<VALUE
, CLUSTERS
>
Implementation of
Defined in
packages/modelfusion/src/model-function/classify/EmbeddingSimilarityClassifier.ts:37