ParisNeo / PyAIPersonality

A library for defining AI personalities for AI based models.We define a file format, assets and personalized scripts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyAIPersonality

GitHub license GitHub issues GitHub stars GitHub forks Discord Follow me on Twitter Follow Me on YouTube

PyPI

Current version : 0.0.10 (GLaDOS)

Main developer ParisNeo

PyAIPersonality is a Python library for defining AI personalities for AI-based models. With PyAIPersonality, you can define a file format, assets, and personalized scripts to create unique AI personalities.

Installation

You can install PyAIPersonality using pip:

pip install pyaipersonality

LLLM server

We also offer a generic backend that allows you to access multiple

pyaipersonality-server -b <the name of the binding> -m <the name of the model file> -p <a list of personalities paths>

for example:

pyaipersonality-server -b llama_cpp_official -m Manticore-13B.ggmlv3.q4_0.bin -p personalities_zoo/english/art/gpt4art personalities_zoo/english/generic/gpt4all personalities_zoo/english/generic/tree_of_thoughts

Naming Rationale

For our new multi-personality AI agent library, we wanted to come up with a naming scheme that reflected our love for science fiction and artificial intelligence. Each release of the application will feature a different AI agent with a distinct personality and set of capabilities, so we felt it was important to give each version a unique and memorable name.

Current version name: GLaDOS

GLaDOS is a fictional AI character from the popular video game series "Portal" developed by Valve Corporation. She serves as the primary antagonist throughout the series, with her primary function being the management of the Aperture Science Enrichment Center.

GLaDOS, which stands for "Genetic Lifeform and Disk Operating System," is designed as a highly intelligent and manipulative AI. She speaks in a calm and monotone voice, often using sarcastic humor and passive-aggressive language to communicate with the player character, Chell.

Throughout the series, GLaDOS is depicted as being both ruthless and resourceful, often using deadly force and deception to achieve her goals. Despite her malicious behavior, she is also shown to have a complex and troubled history, with much of her backstory revealed over the course of the games.

Overall, GLaDOS is a memorable and iconic AI character in sci-fi culture, known for her wit, sarcasm, and unpredictable behavior.

Contributing

Contributions to PyAIPersonality are welcome! If you'd like to contribute, please follow these steps:

  1. Fork this repository
  2. Create a new branch (git checkout -b my-new-branch)
  3. Make your changes
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-branch)
  6. Create a new pull request

To build a new personality, you only need to have a config.yaml file with the following fields:

  • author

    • YAML field: author
    • Description: The author of the personality.
  • version

    • YAML field: version
    • Description: The version number of the personality.
  • personality_description

    • YAML field: personality_description
    • Description: A description of the personality, providing information about its characteristics and behavior.
  • disclaimer

    • YAML field: disclaimer
    • Description: A disclaimer or legal statement regarding the use of the personality and any associated liabilities.
  • language

    • YAML field: language
    • Description: The language code or identifier used by the personality (e.g., "en_US" for American English).
  • category

    • YAML field: category
    • Description: The category or type of the personality (e.g., "General", "Technical Support", "Entertainment").
  • name

    • YAML field: name
    • Description: The name or title of the personality.
  • user_name

    • YAML field: user_name
    • Description: The username or identifier associated with the user interacting with the personality.
  • personality_conditioning

    • YAML field: personality_conditioning
    • Description: Information or context about the personality, including its purpose, capabilities, and origin.
  • ai_message_prefix

    • YAML field: ai_message_prefix
    • Description: The prefix or tag used to identify messages generated by the AI assistant.
  • welcome_message

    • YAML field: welcome_message
    • Description: A welcoming message displayed when interacting with the personality.
  • link_text

    • YAML field: link_text
    • Description: Additional text or formatting used for line breaks or spacing in messages.
  • user_message_prefix

    • YAML field: user_message_prefix
    • Description: The prefix or tag used to identify messages generated by the user.
  • anti_prompts

    • YAML field: anti_prompts
    • Description: A list of strings or patterns that can be used to identify and exclude certain message types from prompts or inputs.
  • dependencies

    • YAML field: dependencies
    • Description: A list of dependencies or external resources required by the personality.
  • model_temperature

    • YAML field: model_temperature
    • Description: The temperature value controlling the randomness of the AI model's responses. Higher values result in more creative outputs.
  • model_n_predicts

    • YAML field: model_n_predicts
    • Description: The number of words or tokens to generate in each response from the AI model.
  • model_top_k

    • YAML field: model_top_k
    • Description: The value of K used in the top-K sampling algorithm, controlling the diversity of the generated responses.
  • model_top_p

    • YAML field: model_top_p
    • Description: The value of p used in the nucleus sampling algorithm, controlling the diversity of the generated responses.
  • model_repeat_penalty

    • YAML field: model_repeat_penalty
    • Description: The penalty factor applied to repeated words or phrases in the generated responses to encourage more varied outputs.
  • model_repeat_last_n

    • YAML field: model_repeat_last_n
    • Description: The number of previous tokens to consider when calculating the repetition penalty.

Information

From v 0.0.11, we have added processors which allow your personality to have a spersonalized script that is applied on the use text or the ai output text. You must put the code inside a file called processor.py inside a subfolder called scripts.

inside processor.py create a class that inherits from from pyaipersonality import PAPScript.

Here is the current form of this class. it will have more elements in the future: Look at gpt4internetv0 and gpt4intervet examples for more information

class PAPScript:
    """
    Template class for implementing personality processor classes in the PAPScript framework.

    This class provides a basic structure and placeholder methods for processing model inputs and outputs.
    Personality-specific processor classes should inherit from this class and override the necessary methods.

    Methods:
        process_model_input(text): Process the model input.
        process_model_output(text): Process the model output.
    """
    def __init__(self) -> None:
        pass

    def process_model_input(self, text):
        """
        Process the model input.

        This method should be overridden in the personality-specific processor class to define
        the desired behavior for processing the model input.

        Args:
            text (str): The model input text.

        Returns:
            Any: The processed model input.
        """
        return None

    def process_model_output(self, text):
        """
        Process the model output.

        This method should be overridden in the personality-specific processor class to define
        the desired behavior for processing the model output.

        Args:
            text (str): The model output text.

        Returns:
            Any: The processed model output.
        """
        return None

License

PyAIPersonality is licensed under the Apache 2.0 license. See the LICENSE file for more information.

About

A library for defining AI personalities for AI based models.We define a file format, assets and personalized scripts.

License:Apache License 2.0


Languages

Language:Python 97.2%Language:C++ 2.7%Language:CMake 0.1%