Skip to main content

Prompt

Simple prompt record with built-in token estimation.

Attributes

AttributeTypeDescription
textstrThe prompt text.

Constructor

Signature

def Prompt(
text: str
) - > null

Parameters

NameTypeDescription
textstrThe prompt text to be stored.

Methods


estimate_tokens()

@classmethod
def estimate_tokens() - > int

Rough token estimate (~4 chars per token).

Returns

TypeDescription
intThe calculated approximate number of tokens based on the length of the prompt text.