Variants
Documentation for working with model variants
Variants are edits to a model that allow you to modify model behavior by adjusting feature activations and defining conditional behaviors.
Creating Variants
Basic Usage
Create a variant by instantiating the Variant
class with a base model:
Adding features to a variant
Conditional Controls
You can create variants that respond dynamically to feature activations:
Methods
set()
Set a feature modification.
Parameters:
Feature or feature group to modify
Modification value (typically between -1 and 1)
Example:
set_when()
Define conditional feature modifications.
Parameters:
Condition that triggers the modifications
Feature modifications to apply when condition is met
Example:
abort_when()
Abort generation when a condition is met.
Parameters:
Condition that triggers the abort
Example:
reset()
Remove all feature modifications.
Example:
clear()
Remove modifications for specific features.
Parameters:
Feature(s) to clear modifications for
Example:
Serialization
Variants can be serialized to and from JSON:
Using with OpenAI SDK
Variants are compatible with the OpenAI SDK:
Classes
VariantMetaData
Metadata about a model variant.
Properties:
Name of the variant
Base model identifier
Unique identifier for the variant