Skip to content

CharactersManager

Pathos edited this page Jan 28, 2025 · 4 revisions

Characters Manager

The Characters Manager ./src/characters_manager.py is a class that manages the currently active characters in the conversation after they've been loaded from the Character Database. The Characters Manager class has the following methods and properties:

  • __init__(self, conversation_manager): Initializes the Characters Manager. The conversation_manager parameter is the conversation manager that the character manager is associated with.
  • active_characters_list: Returns a list of all active characters.
  • bios: Returns a paragraph comprised of all active characters bios.
  • names: Returns a list of all active characters names.
  • names_w_player: Returns a list of all active characters names with the player's name included.
  • relationship_summary: Returns a paragraph comprised of all active characters relationship summaries.
  • prompt_style: Returns the prompt style for the current conversation.
  • language: Returns the language for the current conversation.
  • replacement_dict: Returns a dictionary of replacement values for the current context.
  • render_game_event(self, line): Render a game event line using the language file.
  • active_character_count: Returns the number of active characters as an int.
  • get_raw_prompt: Return the current context for the given active characters as a string.
  • get_system_prompt: Return the current context for the given active characters as a string.
  • get_character(self, info): Return a character object from the current character manager.
  • add_message(self, msg): Add a message to all active characters.
  • remove_from_conversation(self, character): Remove a character from the conversation.
  • after_step(self): Perform an after step in the memory manager. Triggers this step in all active characters.
  • before_step(self): Perform a before step in the memory manager. Triggers this step in all active characters.
  • reached_conversation_limit(self): Perform an end of conversation step in the memory manager. Triggers this step in all active characters.
  • get_memories(self): Return the memories for the current conversation. Gets the memories from all active characters.
  • add_character(self, character_info): Add a character to the active characters list.
  • memory_offset: Return the memory depth of the character.
  • memory_offset_direction: Return the memory offset direction of the character.

Method Details

__init__(self, conversation_manager) Method

Initializes the Characters Manager. The conversation_manager parameter is the conversation manager that the character manager is associated with. When creating a new Characters Manager, you should call the parent class's __init__ method to ensure that the default Characters Manager is loaded.

active_characters_list Property

Return a list of all active characters.

bios Property

Return a paragraph comprised of all active characters bios.

names Property

Return a list of all active characters names.

names_w_player Property

Return a list of all active characters names with the player's name included.

relationship_summary Property

Return a paragraph comprised of all active characters relationship summaries.

prompt_style Property

Return the prompt style for the current conversation.

language Property

Return the language for the current conversation.

replacement_dict Property

Return a dictionary of replacement values for the current context.

render_game_event(self, line) Method

Render a game event line using the language file.

active_character_count Property

Return the number of active characters as an int.

get_raw_prompt Method

Return the current context for the given active characters as a string.

get_system_prompt Method

Return the current context for the given active characters as a string.

get_character(self, info) Method

Return a character object from the current character manager.

add_message(self, msg) Method

Add a message to all active characters.

remove_from_conversation(self, character) Method

Remove a character from the conversation.

after_step(self) Method

Perform an after step in the memory manager. Triggers this step in all active characters.

before_step(self) Method

Perform a before step in the memory manager. Triggers this step in all active characters.

reached_conversation_limit(self) Method

Perform an end of conversation step in the memory manager. Triggers this step in all active characters.

get_memories(self) Method

Return the memories for the current conversation. Gets the memories from all active characters.

add_character(self, character_info) Method

Add a character to the active characters list.

memory_offset Property

Return the memory depth of the character.

memory_offset_direction Property

Return the memory offset direction of the character.

Clone this wiki locally