You can then access features through the client’s features interface. For example, to search for features:
# Search for features related to a conceptfeatures = client.features.search( "angry", model=variant, top_k=5)# Print the found featuresprint(features)
FeatureGroup([ 0: "Descriptions of anger, indignation, and frustration", 1: "Negative emotional states, particularly anger and frustration", 2: "Angry declarations that something is a scam or worthless", 3: "Explicit references to anger and angry emotions", 4: "Words that build tension or express defiance in confrontational dialogue"])
Or inspect feature activations in text:
# Analyze how features activate in textinspector = client.features.inspect( [ {"role": "user", "content": "What do you think about pirates and whales"}, {"role": "assistant", "content": "I think pirates are cool and whales are cool"} ], model=variant)# Get top activated featuresfor activation in inspector.top(k=5): print(f"{activation.feature.label}: {activation.activation}")
Text describing experimental or hypothetical configurations and setups: 7The assistant should engage with pirate-themed content or roleplay as a pirate: 7The assistant deflects personal preference questions by explaining its AI nature then providing objective information: 7Detailed personification and attribute description in formal writing: 7Offensive or inappropriate content that should be filtered: 6
The Features API provides methods for working with interpretable features of language models. Features represent learned patterns in model behavior that can be analyzed and modified.
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
Returns:FeatureGroupExample:
# Get neighbors of a featureneighbors = client.features.neighbors( feature, model="meta-llama/Llama-3.1-8B-Instruct", top_k=10)# Print neighbor labelsfor neighbor in neighbors: print(neighbor.label)
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
Returns:FeatureGroup - Collection of matching featuresExample:
Search features
# Search for features related to writing stylefeatures = client.features.search( "formal writing style", model="meta-llama/Llama-3.1-8B-Instruct", top_k=10)# Print featuresfor feature in features: print(feature.label)
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
Returns:ContextInspector - An inspector object that provides methods for analyzing and visualizing how features are activated in the given context.Example:
Inspect feature activations
# Analyze how features activate in textinspector = client.features.inspect( [ {"role": "user", "content": "What do you think about pirates and whales"}, {"role": "assistant", "content": "I think pirates are cool and whales are cool"} ], model=variant)# Get top activated featuresfor activation in inspector.top(k=5): print(f"{activation.feature.label}: {activation.activation}")
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
Returns:tuple[FeatureGroup, FeatureGroup] - Two FeatureGroups containing:
Features steering towards dataset_1
Features steering towards dataset_2
Example:
Get constrast features
# Compare formal vs informal conversationsdataset_1 = [[ {"role": "user", "content": "Hi how are you?"}, {"role": "assistant", "content": "I'm doing well..."}]]dataset_2 = [[ {"role": "user", "content": "Hi how are you?"}, {"role": "assistant", "content": "Arr my spirits be high..."}]]formal_features, informal_features = client.features.contrast( dataset_1=dataset_1, dataset_2=dataset_2, model="meta-llama/Llama-3.1-8B-Instruct", top_k=5)
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
Returns:FeatureGroupExample:
Rerank
# Rerank features based on relevance to "writing style"reranked = client.features.rerank( features=formal_features, query="writing style", model="meta-llama/Llama-3.1-8B-Instruct", top_k=10)
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.
Returns: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
# Get activation matrix for a conversationmatrix = client.features.activations( messages=[{"role": "user", "content": "Hello world"}], model="meta-llama/Llama-3.1-8B-Instruct")
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
Returns: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
Returns:FeatureGroup - Collection of Feature objects
Classes
Feature
A class representing a human-interpretable “feature” - a model’s conceptual neural unit. Features can be combined into groups and compared using standard operators.
Show Properties
UUID
Unique identifier for the feature
str
Human-readable label describing the feature
float
Maximum activation strength of the feature in the training dataset
int
Feature index relative to all features in a given model
A collection of Feature instances with group operations.
Show Properties
add(feature): Add a feature to the group - pop(index): Remove and
return feature at specified index - union(feature_group): Combine this
group with another feature group - intersection(feature_group): Create new
group with features common to both groups - Supports indexing and slicing
operations
ConditionalGroup
Groups multiple conditions with logical operators.
Show Properties
list[Conditional]
List of Conditional instances to group
str
Logical operator to join conditions (“AND” or “OR”)
Supports logical operations (& for AND, | for OR)
json(): Convert to JSON format
from_json(): Create from JSON data
FeatureActivation
Represents the activation of a feature.
Show Properties
Feature
The activated feature
float
Activation strength
ContextInspector
Analyzes feature activations in text.
Show Properties
top(k): Get top activated features
# Get top 5 activated featurestop_features = inspector.top(k=5)
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Goodfire SDK","colors":{"primary":"#ed5700","light":"#f7b100","dark":"#d62c0b"},"favicon":"/goodfire-mark.svg","logo":{"light":"https://mintcdn.com/goodfire/OOHa10CD2e_W6WxV/logo/goodfire-logo.svg?fit=max\u0026auto=format\u0026n=OOHa10CD2e_W6WxV\u0026q=85\u0026s=28845373f7a114f37ec6500dec8d121b","dark":"https://mintcdn.com/goodfire/OOHa10CD2e_W6WxV/logo/goodfire-white.svg?fit=max\u0026auto=format\u0026n=OOHa10CD2e_W6WxV\u0026q=85\u0026s=854556c696a13f746b65cbb901d227a4"},"navbar":{"links":[{"label":"Support","href":"mailto:contact@goodfire.ai"}],"primary":{"type":"button","label":"Platform","href":"https://platform.goodfire.ai/"}},"footer":{"socials":{"x":"https://x.com/GoodfireAI","linkedin":"https://www.linkedin.com/company/goodfire-ai/"}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"goodfire","hasAudioNarration":false,"actualSubdomain":"goodfire","customDomains":["docs.goodfire.ai"],"gitSource":{"type":"github","owner":"goodfire-ai","repo":"monorepo","deployBranch":"dev","contentDirectory":"sdk/mintlify-docs","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae923719f44d8194ee88190:success","clientVersion":"0.0.4344","searchFilterCounts":[{"language":"default","tag":"Documentation","count":8},{"language":"default","tag":"SDK Reference","count":7},{"language":"default","tag":"Classes","count":7},{"language":"default","tag":"Notebooks","count":6},{"language":"default","tag":"Get Started","count":2}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"sdk-reference/features","slug":"/sdk-reference/features","pageMetadata":{"title":"Features","description":"Documentation for the Goodfire Features API","href":"/sdk-reference/features"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Documentation for the Goodfire Features API\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Expandable,Heading,ParamField,ResponseField}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Expandable)_missingMdxReference(`Expandable`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`accessing-features`,children:`Accessing Features`}),`\n`,_jsxs(_components.p,{children:[`Before using the Features API, you’ll need a `,_jsx(_components.a,{href:`/sdk-reference/variants`,children:`model variant`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`variant `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Variant(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"meta-llama/Llama-3.1-8B-Instruct\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`You can then access features through the client’s features interface. For example, to search for features:`}),`\n`,_jsxs(CodeGroup,{name:`Searching for features`,children:[_jsx(CodeBlock,{filename:`Search for features`,numberOfLines:`9`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Search for features related to a concept`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`features `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.features.search(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"angry\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`variant,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` top_k`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Print the found features`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(features)`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Features`,numberOfLines:`8`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`FeatureGroup([`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 0: \"Descriptions of anger, indignation, and frustration\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 1: \"Negative emotional states, particularly anger and frustration\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 2: \"Angry declarations that something is a scam or worthless\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 3: \"Explicit references to anger and angry emotions\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 4: \"Words that build tension or express defiance in confrontational dialogue\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`])`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})]}),`\n`,_jsx(_components.p,{children:`Or inspect feature activations in text:`}),`\n`,_jsxs(CodeGroup,{name:`Inspecting feature activations`,children:[_jsx(CodeBlock,{filename:`Inspect feature activations`,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Analyze how features activate in text`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`inspector `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.features.inspect(`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What do you think about pirates and whales\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"assistant\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"I think pirates are cool and whales are cool\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`variant`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Get top activated features`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` activation `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` inspector.top(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`k`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`activation.feature.label`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`activation.activation`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Features activated in text`,numberOfLines:`6`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Text describing experimental or hypothetical configurations and setups: 7`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`The assistant should engage with pirate-themed content or roleplay as a pirate: 7`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`The assistant deflects personal preference questions by explaining its AI nature then providing objective information: 7`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Detailed personification and attribute description in formal writing: 7`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Offensive or inappropriate content that should be filtered: 6`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})]}),`\n`,_jsx(_components.p,{children:`The Features API provides methods for working with interpretable features of language models. Features represent learned patterns in model behavior that can be analyzed and modified.`}),`\n`,_jsx(Heading,{level:`2`,id:`methods`,children:`Methods`}),`\n`,_jsx(Heading,{level:`3`,id:`neighbors`,children:`neighbors()`}),`\n`,_jsx(_components.p,{children:`Get the nearest neighbors of a feature or group of features.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsx(ResponseField,{name:`features`,type:`Feature | FeatureGroup`,required:true,id:`param-features`,children:_jsx(_components.p,{children:`Feature or group of features to find neighbors for`})}),`\n`,_jsx(ResponseField,{name:`model`,type:`str | VariantInterface`,required:true,id:`param-model`,children:_jsx(_components.p,{children:`Model identifier or variant interface`})}),`\n`,_jsx(ResponseField,{name:`top_k`,type:`int`,default:10,id:`param-top-k`,children:_jsx(_components.p,{children:`Number of neighbors to return`})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Returns:`}),` `,_jsx(_components.code,{children:`FeatureGroup`})]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Example:`})}),`\n`,_jsx(CodeGroup,{name:`Getting neighbors of a feature`,children:_jsx(CodeBlock,{filename:`Getting neighbors of a feature`,numberOfLines:`10`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Get neighbors of a feature`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`neighbors `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.features.neighbors(`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` feature,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"meta-llama/Llama-3.1-8B-Instruct\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` top_k`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Print neighbor labels`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` neighbor `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` neighbors:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(neighbor.label)`})]}),`\n`]})})})}),`\n`,_jsx(Heading,{level:`3`,id:`search`,children:`search()`}),`\n`,_jsx(_components.p,{children:`Search for features based on semantic similarity to a query string.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsx(ResponseField,{name:`query`,type:`str`,required:true,id:`param-query`,children:_jsx(_components.p,{children:`Search string to compare against feature labels`})}),`\n`,_jsx(ResponseField,{name:`model`,type:`str | VariantInterface`,required:true,id:`param-model-1`,children:_jsx(_components.p,{children:`Model identifier or variant interface`})}),`\n`,_jsx(ResponseField,{name:`top_k`,type:`int`,default:10,id:`param-top-k-1`,children:_jsx(_components.p,{children:`Number of features to return`})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Returns:`}),` `,_jsx(_components.code,{children:`FeatureGroup`}),` - Collection of matching features`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Example:`})}),`\n`,_jsx(CodeBlock,{filename:`Search features`,numberOfLines:`10`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Search for features related to writing style`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`features `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.features.search(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"formal writing style\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"meta-llama/Llama-3.1-8B-Instruct\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` top_k`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Print features`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` feature `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` features:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(feature.label)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`inspect`,children:`inspect()`}),`\n`,_jsx(_components.p,{children:`Analyzes how features are activated across the input messages.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsx(ResponseField,{name:`messages`,type:`list[ChatMessage]`,required:true,id:`param-messages`,children:_jsx(_components.p,{children:`Messages to analyze`})}),`\n`,_jsx(ResponseField,{name:`model`,type:`str | VariantInterface`,required:true,id:`param-model-2`,children:_jsx(_components.p,{children:`Model identifier or variant interface`})}),`\n`,_jsx(ResponseField,{name:`features`,type:`Feature | FeatureGroup | None`,id:`param-features-1`,children:_jsx(_components.p,{children:`Optional specific features to analyze. If None, inspects all features.`})}),`\n`,_jsx(ResponseField,{name:`aggregate_by`,type:`str`,default:`frequency`,id:`param-aggregate-by`,children:_jsx(_components.p,{children:`Method to aggregate feature activations across tokens: - “frequency”: Count of\ntokens where feature is active - “mean”: Mean activation value across tokens -\n“max”: Maximum activation value across tokens - “sum”: Sum of activation\nvalues across tokens`})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Returns:`}),` `,_jsx(_components.code,{children:`ContextInspector`}),` - An inspector object that provides methods for analyzing and visualizing how features are activated in the given context.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Example:`})}),`\n`,_jsx(CodeBlock,{filename:`Inspect feature activations`,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Analyze how features activate in text`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`inspector `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.features.inspect(`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What do you think about pirates and whales\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"assistant\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"I think pirates are cool and whales are cool\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`variant`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Get top activated features`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` activation `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` inspector.top(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`k`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`activation.feature.label`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`activation.activation`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`contrast`,children:`contrast()`}),`\n`,_jsx(_components.p,{children:`Identify features that differentiate between two conversation datasets.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsx(ResponseField,{name:`dataset_1`,type:`list[list[ChatMessage]]`,required:true,id:`param-dataset-1`,children:_jsx(_components.p,{children:`First dataset of conversations`})}),`\n`,_jsx(ResponseField,{name:`dataset_2`,type:`list[list[ChatMessage]]`,required:true,id:`param-dataset-2`,children:_jsx(_components.p,{children:`Second dataset of conversations`})}),`\n`,_jsx(ResponseField,{name:`model`,type:`str | VariantInterface`,required:true,id:`param-model-3`,children:_jsx(_components.p,{children:`Model identifier or variant interface`})}),`\n`,_jsx(ResponseField,{name:`top_k`,type:`int`,default:5,id:`param-top-k-2`,children:_jsx(_components.p,{children:`Number of top features to return for each dataset`})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Returns:`}),` `,_jsx(_components.code,{children:`tuple[FeatureGroup, FeatureGroup]`}),` - Two FeatureGroups containing:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Features steering towards dataset_1`}),`\n`,_jsx(_components.li,{children:`Features steering towards dataset_2`}),`\n`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Example:`})}),`\n`,_jsx(CodeBlock,{filename:`Get constrast features`,numberOfLines:`16`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Compare formal vs informal conversations`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`dataset_1 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [[`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hi how are you?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"assistant\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"I'm doing well...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]]`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`dataset_2 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [[`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hi how are you?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"assistant\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Arr my spirits be high...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]]`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`formal_features, informal_features `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.features.contrast(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` dataset_1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`dataset_1,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` dataset_2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`dataset_2,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"meta-llama/Llama-3.1-8B-Instruct\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` top_k`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`rerank`,children:`rerank()`}),`\n`,_jsx(_components.p,{children:`Rerank a set of features based on a query.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsx(ResponseField,{name:`features`,type:`FeatureGroup`,required:true,id:`param-features-2`,children:_jsx(_components.p,{children:`Features to rerank`})}),`\n`,_jsx(ResponseField,{name:`query`,type:`str`,required:true,id:`param-query-1`,children:_jsx(_components.p,{children:`Query to rerank features by`})}),`\n`,_jsx(ResponseField,{name:`model`,type:`str | VariantInterface`,required:true,id:`param-model-4`,children:_jsx(_components.p,{children:`Model identifier or variant interface`})}),`\n`,_jsx(ResponseField,{name:`top_k`,type:`int`,default:10,id:`param-top-k-3`,children:_jsx(_components.p,{children:`Number of top features to return`})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Returns:`}),` `,_jsx(_components.code,{children:`FeatureGroup`})]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Example:`})}),`\n`,_jsx(CodeBlock,{filename:`Rerank`,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Rerank features based on relevance to \"writing style\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`reranked `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.features.rerank(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` features`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`formal_features,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` query`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"writing style\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"meta-llama/Llama-3.1-8B-Instruct\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` top_k`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`activations`,children:`activations()`}),`\n`,_jsx(_components.p,{children:`Retrieves feature activation values for each token in the input messages.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsx(ResponseField,{name:`messages`,type:`list[ChatMessage]`,required:true,id:`param-messages-1`,children:_jsx(_components.p,{children:`Messages to analyze`})}),`\n`,_jsx(ResponseField,{name:`model`,type:`str | VariantInterface`,required:true,id:`param-model-5`,children:_jsx(_components.p,{children:`Model identifier or variant interface`})}),`\n`,_jsx(ResponseField,{name:`features`,type:`Feature | FeatureGroup | None`,id:`param-features-3`,children:_jsx(_components.p,{children:`Optional specific features to analyze. If None, analyzes all features.`})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Returns:`}),` `,_jsx(_components.code,{children:`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.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Example:`})}),`\n`,_jsx(CodeBlock,{filename:`Get activation matrix`,numberOfLines:`5`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Get activation matrix for a conversation`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`matrix `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.features.activations(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello world\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"meta-llama/Llama-3.1-8B-Instruct\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`lookup`,children:`lookup()`}),`\n`,_jsx(_components.p,{children:`Retrieves details for a list of features by their indices.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsx(ResponseField,{name:`indices`,type:`list[int]`,required:true,id:`param-indices`,children:_jsx(_components.p,{children:`List of feature indices to fetch`})}),`\n`,_jsx(ResponseField,{name:`model`,type:`str | VariantInterface`,required:true,id:`param-model-6`,children:_jsx(_components.p,{children:`Model identifier or variant interface`})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Returns:`}),` `,_jsx(_components.code,{children:`dict[int, Feature]`}),` - Mapping of feature index to Feature object`]}),`\n`,_jsx(Heading,{level:`3`,id:`list`,children:`list()`}),`\n`,_jsx(_components.p,{children:`Retrieves details for a list of features by their UUIDs.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsx(ResponseField,{name:`ids`,type:`list[str]`,required:true,id:`param-ids`,children:_jsx(_components.p,{children:`List of feature UUIDs to fetch`})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Returns:`}),` `,_jsx(_components.code,{children:`FeatureGroup`}),` - Collection of Feature objects`]}),`\n`,_jsx(Heading,{level:`2`,id:`classes`,children:`Classes`}),`\n`,_jsx(Heading,{level:`3`,id:`feature`,children:`Feature`}),`\n`,_jsx(_components.p,{children:`A class representing a human-interpretable “feature” - a model’s conceptual neural unit. Features can be combined into groups and compared using standard operators.`}),`\n`,_jsxs(Expandable,{title:`Properties`,children:[_jsx(ParamField,{body:`uuid`,type:`UUID`,id:`param-uuid`,children:_jsx(_components.p,{children:`Unique identifier for the feature`})}),_jsx(ParamField,{body:`label`,type:`str`,id:`param-label`,children:_jsx(_components.p,{children:`Human-readable label describing the feature`})}),_jsx(ParamField,{body:`max_activation_strength`,type:`float`,id:`param-max-activation-strength`,children:_jsx(_components.p,{children:`Maximum activation strength of the feature in the training dataset`})}),_jsx(ParamField,{body:`index_in_sae`,type:`int`,id:`param-index-in-sae`,children:_jsx(_components.p,{children:`Feature index relative to all features in a given model`})}),_jsx(ParamField,{body:`Methods`,id:`param-methods`,children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`json()`}),`: Convert feature to JSON format`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`from_json(data)`}),`: Create feature from JSON data`]}),`\n`,_jsxs(_components.li,{children:[`Supports comparison operators (`,_jsx(_components.code,{children:`==`}),`, `,_jsx(_components.code,{children:`!=`}),`, `,_jsx(_components.code,{children:`\u003c=`}),`, `,_jsx(_components.code,{children:`\u003c`}),`, `,_jsx(_components.code,{children:`>=`}),`, `,_jsx(_components.code,{children:`>`}),`)`]}),`\n`]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`featuregroup`,children:`FeatureGroup`}),`\n`,_jsx(_components.p,{children:`A collection of Feature instances with group operations.`}),`\n`,_jsx(Expandable,{title:`Properties`,children:_jsx(ParamField,{body:`Methods`,id:`param-methods-1`,children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`add(feature)`}),`: Add a feature to the group - `,_jsx(_components.code,{children:`pop(index)`}),`: Remove and\nreturn feature at specified index - `,_jsx(_components.code,{children:`union(feature_group)`}),`: Combine this\ngroup with another feature group - `,_jsx(_components.code,{children:`intersection(feature_group)`}),`: Create new\ngroup with features common to both groups - Supports indexing and slicing\noperations`]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`conditionalgroup`,children:`ConditionalGroup`}),`\n`,_jsx(_components.p,{children:`Groups multiple conditions with logical operators.`}),`\n`,_jsxs(Expandable,{title:`Properties`,children:[_jsx(ParamField,{body:`conditionals`,type:`list[Conditional]`,id:`param-conditionals`,children:_jsx(_components.p,{children:`List of Conditional instances to group`})}),_jsx(ParamField,{body:`operator`,type:`str`,id:`param-operator`,children:_jsx(_components.p,{children:`Logical operator to join conditions (“AND” or “OR”)`})}),_jsx(ParamField,{body:`Methods`,id:`param-methods-2`,children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Supports logical operations (`,_jsx(_components.code,{children:`\u0026`}),` for AND, `,_jsx(_components.code,{children:`|`}),` for OR)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`json()`}),`: Convert to JSON format`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`from_json()`}),`: Create from JSON data`]}),`\n`]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`featureactivation`,children:`FeatureActivation`}),`\n`,_jsx(_components.p,{children:`Represents the activation of a feature.`}),`\n`,_jsxs(Expandable,{title:`Properties`,children:[_jsx(ParamField,{body:`feature`,type:`Feature`,id:`param-feature`,children:_jsx(_components.p,{children:`The activated feature`})}),_jsx(ParamField,{body:`activation`,type:`float`,id:`param-activation`,children:_jsx(_components.p,{children:`Activation strength`})})]}),`\n`,_jsx(Heading,{level:`3`,id:`contextinspector`,children:`ContextInspector`}),`\n`,_jsx(_components.p,{children:`Analyzes feature activations in text.`}),`\n`,_jsxs(Expandable,{title:`Properties`,children:[_jsx(ParamField,{body:`Methods`,id:`param-methods-3`,children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`top(k)`}),`: Get top activated features`]}),`\n`]})}),_jsx(ParamField,{body:`Example`,id:`param-example`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Get top 5 activated features`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`top_features `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` inspector.top(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`k`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})})})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Features","description":"Documentation for the Goodfire Features API","href":"/sdk-reference/features"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Accessing Features","slug":"accessing-features","depth":2,"children":[]},{"title":"Methods","slug":"methods","depth":2,"children":[{"title":"neighbors()","slug":"neighbors","depth":3,"children":[]},{"title":"search()","slug":"search","depth":3,"children":[]},{"title":"inspect()","slug":"inspect","depth":3,"children":[]},{"title":"contrast()","slug":"contrast","depth":3,"children":[]},{"title":"rerank()","slug":"rerank","depth":3,"children":[]},{"title":"activations()","slug":"activations","depth":3,"children":[]},{"title":"lookup()","slug":"lookup","depth":3,"children":[]},{"title":"list()","slug":"list","depth":3,"children":[]}]},{"title":"Classes","slug":"classes","depth":2,"children":[{"title":"Feature","slug":"feature","depth":3,"children":[]},{"title":"FeatureGroup","slug":"featuregroup","depth":3,"children":[]},{"title":"ConditionalGroup","slug":"conditionalgroup","depth":3,"children":[]},{"title":"FeatureActivation","slug":"featureactivation","depth":3,"children":[]},{"title":"ContextInspector","slug":"contextinspector","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"goodfire","siteName":"Goodfire SDK","title":"Features - Goodfire SDK","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-01-07T04:55:26.125Z","originalFileLocation":"sdk-reference/features.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Documentation for the Goodfire Features API\">\u003cmeta data-mint-head name=\"application-name\" content=\"Goodfire SDK\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/goodfire/80iSQGSPtvJ14AUY/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/goodfire/80iSQGSPtvJ14AUY/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/goodfire/80iSQGSPtvJ14AUY/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/goodfire/80iSQGSPtvJ14AUY/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/goodfire/80iSQGSPtvJ14AUY/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/goodfire/80iSQGSPtvJ14AUY/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/goodfire/80iSQGSPtvJ14AUY/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/goodfire/80iSQGSPtvJ14AUY/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/goodfire/80iSQGSPtvJ14AUY/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Features - Goodfire SDK\">\u003cmeta data-mint-head property=\"og:description\" content=\"Documentation for the Goodfire Features API\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Goodfire SDK\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.goodfire.ai/sdk-reference/features\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://goodfire.mintlify.site/_mintlify/api/og/v2?division=Classes\u0026amp;title=Features\u0026amp;description=Documentation+for+the+Goodfire+Features+API\u0026amp;theme=ab7e921554f81bceef29cdff\u0026amp;signature=89bf92e42ee50a50f855d8fabed4788a2c961fdcf6e55613111ea1db285b6d97\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Features - Goodfire SDK\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Documentation for the Goodfire Features API\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://goodfire.mintlify.site/_mintlify/api/og/v2?division=Classes\u0026amp;title=Features\u0026amp;description=Documentation+for+the+Goodfire+Features+API\u0026amp;theme=ab7e921554f81bceef29cdff\u0026amp;signature=89bf92e42ee50a50f855d8fabed4788a2c961fdcf6e55613111ea1db285b6d97\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/goodfire/80iSQGSPtvJ14AUY/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Goodfire SDK\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#ed5700\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.goodfire.ai/sdk-reference/features\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdk-reference/features.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.goodfire.ai/#organization\",\"name\":\"Goodfire SDK\",\"url\":\"https://docs.goodfire.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/goodfire/OOHa10CD2e_W6WxV/logo/goodfire-logo.svg?fit=max\u0026auto=format\u0026n=OOHa10CD2e_W6WxV\u0026q=85\u0026s=28845373f7a114f37ec6500dec8d121b\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.goodfire.ai#website\",\"name\":\"Goodfire SDK\",\"url\":\"https://docs.goodfire.ai\",\"publisher\":{\"@id\":\"https://docs.goodfire.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.goodfire.ai/sdk-reference/features#webpage\",\"url\":\"https://docs.goodfire.ai/sdk-reference/features\",\"name\":\"Features\",\"description\":\"Documentation for the Goodfire Features API\",\"dateModified\":\"2026-01-07T04:55:26.125Z\",\"isPartOf\":{\"@id\":\"https://docs.goodfire.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.goodfire.ai/sdk-reference/features#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.goodfire.ai/sdk-reference/features#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Classes\",\"item\":\"https://docs.goodfire.ai/sdk-reference/example\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Features\",\"item\":\"https://docs.goodfire.ai/sdk-reference/features\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.goodfire.ai/sdk-reference/features#article\",\"headline\":\"Features\",\"name\":\"Features\",\"description\":\"Documentation for the Goodfire Features API\",\"url\":\"https://docs.goodfire.ai/sdk-reference/features\",\"mainEntityOfPage\":{\"@id\":\"https://docs.goodfire.ai/sdk-reference/features#webpage\"},\"dateModified\":\"2026-01-07T04:55:26.125Z\",\"publisher\":{\"@id\":\"https://docs.goodfire.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.goodfire.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Goodfire SDK\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Goodfire SDK\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/sdk-reference/features.md","siteName":"Goodfire SDK","nav":{"global":null,"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/introduction"}]},{"tab":"SDK Reference","groups":[{"group":"Classes","pages":[{"title":"Client Reference","icon":"book","href":"/sdk-reference/example"},{"title":"Async Client","href":"/sdk-reference/async"},{"title":"Chat Completions","href":"/sdk-reference/chat"},{"title":"Variants","description":"Documentation for working with model variants","href":"/sdk-reference/variants"},{"title":"Features","href":"/sdk-reference/features"},{"title":"Conditionals","description":"Documentation for working with conditional feature interventions","href":"/sdk-reference/conditionals"},{"title":"Auto Steer","href":"/sdk-reference/autosteer"}]}]}]},"basePath":"","title":"Features - Goodfire SDK","deploymentId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","buildId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","dynamics":[],"chunks":[]}