Accessing Features
Before using the Features API, you’ll need a model variant:Methods
neighbors()
Get the nearest neighbors of a feature or group of features. Parameters:Feature | FeatureGroup
required
Feature or group of features to find neighbors for
str | VariantInterface
required
Model identifier or variant interface
int
default:10
Number of neighbors to return
FeatureGroup
Example:
search()
Search for features based on semantic similarity to a query string. Parameters:str
required
Search string to compare against feature labels
str | VariantInterface
required
Model identifier or variant interface
int
default:10
Number of features to return
FeatureGroup - Collection of matching features
Example:
Search features
inspect()
Analyzes how features are activated across the input messages. Parameters:list[ChatMessage]
required
Messages to analyze
str | VariantInterface
required
Model identifier or variant interface
Feature | FeatureGroup | None
Optional specific features to analyze. If None, inspects all features.
str
default:"frequency"
Method to aggregate feature activations across tokens: - “frequency”: Count of
tokens where feature is active - “mean”: Mean activation value across tokens -
“max”: Maximum activation value across tokens - “sum”: Sum of activation
values across tokens
ContextInspector - An inspector object that provides methods for analyzing and visualizing how features are activated in the given context.
Example:
Inspect feature activations
contrast()
Identify features that differentiate between two conversation datasets. Parameters:list[list[ChatMessage]]
required
First dataset of conversations
list[list[ChatMessage]]
required
Second dataset of conversations
str | VariantInterface
required
Model identifier or variant interface
int
default:5
Number of top features to return for each dataset
tuple[FeatureGroup, FeatureGroup] - Two FeatureGroups containing:
- Features steering towards dataset_1
- Features steering towards dataset_2
Get constrast features
rerank()
Rerank a set of features based on a query. Parameters:FeatureGroup
required
Features to rerank
str
required
Query to rerank features by
str | VariantInterface
required
Model identifier or variant interface
int
default:10
Number of top features to return
FeatureGroup
Example:
Rerank
activations()
Retrieves feature activation values for each token in the input messages. Parameters:list[ChatMessage]
required
Messages to analyze
str | VariantInterface
required
Model identifier or variant interface
Feature | FeatureGroup | None
Optional specific features to analyze. If None, analyzes all features.
NDArray[np.float64] - Sparse activation matrix of shape [n_tokens, n_features] where each element represents the activation strength of a feature at a specific token. Most values are zero due to sparsity.
Example:
Get activation matrix
lookup()
Retrieves details for a list of features by their indices. Parameters:list[int]
required
List of feature indices to fetch
str | VariantInterface
required
Model identifier or variant interface
dict[int, Feature] - Mapping of feature index to Feature object
list()
Retrieves details for a list of features by their UUIDs. Parameters:list[str]
required
List of feature UUIDs to fetch
FeatureGroup - Collection of Feature objects