Skip to content

Prompt Snippets

dandy.llm.prompt.snippet

BaseSnippet dataclass

Bases: ABC

triple_quote = False class-attribute instance-attribute

triple_quote_label = None class-attribute instance-attribute

__str__

Source code in dandy/llm/prompt/snippet.py
def __str__(self):
    return self.to_str()

to_str

Source code in dandy/llm/prompt/snippet.py
def to_str(self):
    if self.triple_quote:
        if self.triple_quote_label:
            return f'""" {self.triple_quote_label}\n{self._to_str()}"""\n'

        return f'"""\n{self._to_str()}"""\n'
    else:
        return self._to_str()

ArraySnippet dataclass

Bases: BaseSnippet

items instance-attribute

ArrayRandomOrderSnippet dataclass

Bases: ArraySnippet

DictionarySnippet dataclass

Bases: BaseSnippet

dictionary instance-attribute

DividerSnippet dataclass

Bases: BaseSnippet

FileSnippet dataclass

Bases: BaseSnippet

file_path instance-attribute

HeadingSnippet dataclass

Bases: BaseSnippet

heading instance-attribute

LineBreakSnippet dataclass

Bases: BaseSnippet

IntelSnippet dataclass

Bases: BaseSnippet

intel instance-attribute

IntelSchemaSnippet dataclass

Bases: BaseSnippet

intel_class instance-attribute

ModuleSourceSnippet dataclass

Bases: BaseSnippet

module_name instance-attribute

ObjectSourceSnippet dataclass

Bases: BaseSnippet

object_module_name instance-attribute

OrderedListSnippet dataclass

Bases: BaseSnippet

items instance-attribute

PromptSnippet dataclass

Bases: BaseSnippet

prompt instance-attribute

RandomChoiceSnippet dataclass

Bases: BaseSnippet

choices instance-attribute

SubHeadingSnippet dataclass

Bases: BaseSnippet

sub_heading instance-attribute

TextSnippet dataclass

Bases: BaseSnippet

label = '' class-attribute instance-attribute

text instance-attribute

TitleSnippet dataclass

Bases: BaseSnippet

title instance-attribute

UnorderedListSnippet dataclass

Bases: BaseSnippet

items instance-attribute

UnorderedRandomListSnippet dataclass