Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Representations of emotion for use in AI systems.
There are several ways of representing emotion available in this package:
An emotion is given as a vector in a 3D space. Each dimension can have a value from -1 to 1 inclusive, and the dimensions are:
Plutchik's wheel is shown below:
Here Plutchik identifies eight primary emotions. These primary emotions can be combined to form secondary emotions, which can be combined to form tertiary emotions.
In our package, we represent an emotional state as an 8D vector with one dimension for each primary emotion. Furthermore, the length of the vector can range from 0 to 1 inclusive, representing the intensity of the emotion. The eight primary emotions are:
With inspiration from theories like James-Lange, Cannon-Bard, and Schachter-Singer, we can describe an emotional state using a physiological vector. Each dimension can range from 0 to 1 inclusive, representing the intensity of the physiological response. Here our dimensions are:
Conversion between representations requires using an LLM. This is because the emotional interpretation of a physiological reaction is context-dependent. Note that converting between different representations is also very inexact, and you will very likely not get the same vector back from doing an inverse operation.
Complex emotions may not be easily representable by a single vector. For example, a person may feel exhausted at work and want to watch some TV, but they may also know that watching TV would make them feel anxious and guilty. Simultaneously they may also feel a sense of pride from working on their project.
In this package we represent complex emotions in the following ways:
This is a simple example of how to use the package. See the examples/ folder for more complex examples.
from dotenv import load_dotenv
import os
from typing import cast
from ai_emotion.complex_emotion import ComplexEmotion
from ai_emotion.conversion import to_plutchik
from ai_emotion.simple_emotion import VectoralEmotion, PlutchikEmotion, PhysiologicalEmotion
from ai_emotion.transition import transition
vectoral_emotion = VectoralEmotion(
valence=0.1,
arousal=0.2,
control=0.8,
)
load_dotenv()
converted_plutchik_emotion = to_plutchik(
vectoral_emotion,
openai_api_key=cast(str, os.getenv("OPENAI_API_KEY")),
context="Getting prepared for a presentation.",
)
complex_emotion = ComplexEmotion([
(0.7, vectoral_emotion),
(0.3, converted_vectoral_emotion),
])
later_complex_emotion = transition(
complex_emotion,
openai_api_key=cast(str, os.getenv("OPENAI_API_KEY")),
context="Started my presentation.",
)
FAQs
Representation of emotional state for use in AI agents.
We found that ai-emotion demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.