Skip to content

base_canonical

Base canonical module

Attributes

T module-attribute

T = TypeVar('T')

Classes

BaseCanonical

BaseCanonical(env: Environment)

Bases: ABC

Attributes

env instance-attribute
env = env
name abstractmethod property
name: str
name_pattern class-attribute instance-attribute
name_pattern = compile(
    "^([a-zA-Z_\\-]{0,25})?: ?(.*)", MULTILINE
)

Functions

normalize_name
normalize_name(name: Optional[str]) -> Optional[str]

Some clients such as ST send chracter names with underscores instead of spaces. This is a common method that can normalize input names from clients to the name format compatible with the Eleanor framework.

Parameters:

  • name (str | None) –

    The name to be normalized.

Returns:

  • str ( Optional[str] ) –

    The normalized name with underscores replaced by spaces.

to_canonical abstractmethod
to_canonical(data: str, **kwargs) -> CanonicalChat
to_str
to_str(
    data: CanonicalChat,
    render_names: bool = False,
    append_content: str = "",
    append_eos: bool = False,
) -> str