### Get Activations Request Body Example Source: https://www.neuronpedia.org/api-doc#description/introduction Example JSON body for the GET Activations API endpoint. Used to specify parameters for retrieving activations. ```JSON { "modelId": "", "source": "", "index": "" } ``` -------------------------------- ### List User's Vectors Request Example Source: https://www.neuronpedia.org/api-doc#description/introduction Example of how to list all vectors owned by the authenticated user. Requires an API key for authentication. ```Python requests.post("/api/vector/list-owned", headers={ "x-api-key": "YOUR_SECRET_TOKEN" } ) ``` -------------------------------- ### Get Vector Details Request Example Source: https://www.neuronpedia.org/api-doc#description/introduction Example of how to retrieve details for a specific vector. Requires the vector's model ID, source, and index. ```Python requests.post("/api/vector/get", headers={ "Content-Type": "application/json" }, json={ "modelId": "", "source": "", "index": "" } ) ``` -------------------------------- ### All Feature Activations in a Source/SAE Source: https://www.neuronpedia.org/api-doc#description/introduction Gets activation values for all features in a source/SAE when processing custom input text(s). It returns the activations and tokenized prompts only, without any of the dashboards or explanations. ```APIDOC ## POST /api/activation/source ### Description Gets activation values for all features in a source/SAE when processing custom input text(s). It returns the activations and tokenized prompts only, without any of the dashboards or explanations. ### Method POST ### Endpoint /api/activation/source ### Parameters #### Request Body - **customText** (string) - Required - The custom text to process. Either a single string or an array of strings. If it's a single string, the max is a 1024 token text. If it's an array, the max is 4 strings of 256 tokens max each. - **modelId** (string) - Required - The model the source is in. Default: gpt2-small - **source** (string) - Required - The source/SAE ID. Default: 9-res-jb ### Responses #### Success Response (200) Successful response, with activation data #### Error Response - **400**: Bad request, missing or invalid input - **401**: Unauthorized, user doesn't have access to the model or SAE set - **500**: Internal server error ``` -------------------------------- ### Python Requests Example Source: https://www.neuronpedia.org/api-doc#description/introduction This snippet demonstrates how to send a request to the Neuronpedia API using the Python Requests library. It shows how to access all cookies, headers, and the body of the response. ```python import requests url = "YOUR_API_ENDPOINT" headers = { "Content-Type": "application/json" } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes # Access all cookies all_cookies = response.cookies.get_dict() print("All Cookies:", all_cookies) # Access all headers all_headers = response.headers print("All Headers:", all_headers) # Access the response body response_body = response.json() # Assuming the response is JSON print("Response Body:", response_body) except requests.exceptions.RequestException as e: print(f"An error occurred: {e}") except ValueError as e: print(f"Error decoding JSON response: {e}") ``` -------------------------------- ### Delete Vector Request Example Source: https://www.neuronpedia.org/api-doc#description/introduction Example of how to delete a vector using the Neuronpedia API. Requires authentication and specifies the vector's model ID, source, and index. ```Python requests.post("/api/vector/delete", headers={ "Content-Type": "application/json", "x-api-key": "YOUR_SECRET_TOKEN" }, json={ "modelId": "", "source": "", "index": "" } ) ``` -------------------------------- ### Feature Activation for Text Source: https://www.neuronpedia.org/api-doc#description/introduction Gets activation values for a given feature when processing custom input text. Equivalent to going to a feature page and entering custom text. ```APIDOC ## POST /api/activation/new ### Description Gets activation values for a given feature when processing custom input text. Equivalent to going to a feature page and entering custom text. ### Method POST ### Endpoint /api/activation/new ### Parameters #### Request Body - **customText** (string) - Required - The custom text to process. Either a single string or an array of strings. - **feature** (object) - Required - For feature details including modelId, source, and index. - **modelId** (string) - Required - The model the source is in. Default: gpt2-small - **source** (string) - Required - The source/SAE ID. Default: 9-res-jb - **index** (string) - Required - The feature index. ### Responses #### Success Response (200) Successful response, with activation data. Response schema includes tokens, activations, and error fields. #### Error Response - **400**: Bad request, missing or invalid input - **401**: Unauthorized, user doesn't have access to the model or SAE set - **500**: Internal server error ``` -------------------------------- ### Get Vector Details Source: https://www.neuronpedia.org/api-doc#description/introduction Returns details for a specific vector by model ID, source, and index. ```APIDOC ## POST /api/vector/get ### Description Returns details for a specific vector by model ID, source and index. ### Method POST ### Endpoint /api/vector/get ### Parameters #### Request Body - **index** (string) - Required - Vector index - **modelId** (string) - Required - ID of the model - **source** (string) - Required - Source/layer identifier ### Request Example ```python requests.post("/api/vector/get", headers={ "Content-Type": "application/json" }, json={ "modelId": "", "source": "", "index": "" } ) ``` ### Response #### Success Response (200) - **vector** (object) - Vector details - **modelId** (string) - **layer** (string) - **index** (string) - **vectorLabel** (string) - **vectorDefaultSteerStrength** (number) - **hookName** (string) - **vector** (array of numbers) - **createdAt** (string) ``` -------------------------------- ### Get Feature Details Source: https://www.neuronpedia.org/api-doc#description/introduction Retrieves details for a specific feature identified by modelId, layer, and index. ```APIDOC ## GET /api/feature/{modelId}/{layer}/{index} ### Description Retrieves details for a specific feature identified by modelId, layer, and index. ### Method GET ### Endpoint /api/feature/{modelId}/{layer}/{index} ### Parameters #### Path Parameters - **modelId** (string) - Required - The ID of the model. - **layer** (string) - Required - The layer of the feature. - **index** (string) - Required - The index of the feature. ``` -------------------------------- ### Post Feature Activation Request Source: https://www.neuronpedia.org/api-doc#description/introduction Sends a POST request to the /api/activation/new endpoint to get activation values for a specific feature when processing custom input text. The request body includes feature details and the custom text. ```python requests.post("/api/activation/new", headers={ "Content-Type": "application/json" }, json={ "feature": { "modelId": "gpt2-small", "source": "9-res-jb", "index": "200" }, "customText": {} } ) ``` -------------------------------- ### Post Activation Source Request Source: https://www.neuronpedia.org/api-doc#description/introduction Sends a POST request to the /api/activation/source endpoint to retrieve activation values for all features in a source/SAE for custom input text. Ensure 'Content-Type' is set to 'application/json'. ```python requests.post("/api/activation/source", headers={ "Content-Type": "application/json" }, json={ "modelId": "gpt2-small", "source": "9-res-jb", "customText": {} } ) ``` -------------------------------- ### List User's Vectors Source: https://www.neuronpedia.org/api-doc#description/introduction Returns all vectors owned by the authenticated user. Requires authentication. ```APIDOC ## POST /api/vector/list-owned ### Description Returns all vectors owned by the authenticated user. ### Method POST ### Endpoint /api/vector/list-owned ### Request Example ```python requests.post("/api/vector/list-owned", headers={ "x-api-key": "YOUR_SECRET_TOKEN" } ) ``` ### Response #### Success Response (200) - **vectors** (array of objects) - List of user's vectors - **modelId** (string) - **layer** (string) - **index** (string) - **vectorLabel** (string) - **createdAt** (string) - **vectorDefaultSteerStrength** (number) - **hookName** (string) - **vector** (array of numbers) ``` -------------------------------- ### Activation Response Schema Source: https://www.neuronpedia.org/api-doc#description/introduction Defines the structure of a successful response from activation-related API endpoints, including tokens, activation data, and potential error messages. ```json { "tokens": [ "string" ], "activations": { "layer": "string", "index": 1, "values": [ 1 ], "maxValue": 1, "maxValueIndex": 1, "dfaValues": [ 1 ], "dfaTargetIndex": 1, "dfaMaxValue": 1 }, "error": "string" } ``` -------------------------------- ### Delete Vector Source: https://www.neuronpedia.org/api-doc#description/introduction Deletes an existing vector on Neuronpedia. Users can only delete vectors they have created. Requires authentication. ```APIDOC ## POST /api/vector/delete ### Description Deletes an existing vector on Neuronpedia. You can only delete vectors you created. ### Method POST ### Endpoint /api/vector/delete ### Parameters #### Request Body - **index** (string) - Required - Index of the vector to delete - **modelId** (string) - Required - ID of the model - **source** (string) - Required - Source identifier for the vector ### Request Example ```python requests.post("/api/vector/delete", headers={ "Content-Type": "application/json", "x-api-key": "YOUR_SECRET_TOKEN" }, json={ "modelId": "", "source": "", "index": "" } ) ``` ### Response #### Success Response (200) - **message** (string) - Vector deleted successfully ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.