Skip to content

ngdb.prompts

Provides a class that is the base for a prompt collection.

PromptCollection

PromptCollection()

Base class for classes that contain prompt/offset collections.

MAX_PROMPT_LENGTH class-attribute instance-attribute

MAX_PROMPT_LENGTH = 128

The maximum length of a prompt in a guide.

offsets property

offsets

The offsets into the guide for each prompt.

prompts property

prompts

The prompts in the collection.

__bool__

__bool__()

Test if there are any prompts in the collection.

Returns:

Type Description
bool

True if there are prompts, False if not.

__getitem__

__getitem__(prompt)

Get a prompt/offset pair.

Parameters:

Name Type Description Default

prompt

int

The prompt to get the details for.

required

Returns:

Type Description
Link

The requested prompt and its offset.

__iter__

__iter__()

Get an iterator of prompt and offset pairs.

Yields:

Type Description
Link

A link containing the prompt/offset, from the collection.

__len__

__len__()

Get the number of prompts in the collection.

Returns:

Type Description
int

The count of prompts.