Skip to content

FormattingHelpers

psengine.helpers.helpers.FormattingHelpers

Helpers for formatting related functions.

cleanup_ai_insights staticmethod

cleanup_ai_insights(ai_insights: str) -> str

Clean up Recorded Future AI Insights to avoid markdown rendering issues.

PARAMETER DESCRIPTION
ai_insights

AI Insights string to clean.

TYPE: str

RETURNS DESCRIPTION
str

Cleaned-up AI Insights string.

Source code in psengine/helpers/helpers.py
@staticmethod
def cleanup_ai_insights(
    ai_insights: Annotated[str, Doc('AI Insights string to clean.')],
) -> Annotated[str, Doc('Cleaned-up AI Insights string.')]:
    """Clean up Recorded Future AI Insights to avoid markdown rendering issues."""
    return ai_insights.replace('\n', ' ').replace('1. ', '1.')

cleanup_rf_id staticmethod

cleanup_rf_id(entity: str) -> str

Remove the Recorded Future ID prefix from an entity.

PARAMETER DESCRIPTION
entity

entity string to clean up.

TYPE: str

RETURNS DESCRIPTION
str

Entity string without the Recorded Future ID prefix.

Source code in psengine/helpers/helpers.py
@staticmethod
def cleanup_rf_id(
    entity: Annotated[str, Doc('entity string to clean up.')],
) -> Annotated[str, Doc('Entity string without the Recorded Future ID prefix.')]:
    """Remove the Recorded Future ID prefix from an entity."""
    for id_ in IDS:
        if id_ in entity:
            return entity.replace(id_, '')
    return entity