sammo.instructions

sammo.instructions#

Module Contents#

Classes#

Renderer

Section

Paragraph

MetaPrompt

FewshotExamples

RandomFewshotExamples

EmbeddingFewshotExamples

InputData

API#

class sammo.instructions.Renderer(content, name: str | None = None)#

Bases: sammo.base.Component

class sammo.instructions.Section(name, content, id=None)#

Bases: sammo.instructions.Renderer

static_text(sep='\n')#
set_static_text(text)#
render_as_markdown(data, alternative_headings=False, depth=0, **kwargs)#
render_as_xml(content, depth=0)#
render_as_raw(content)#
class sammo.instructions.Paragraph(content, id=None)#

Bases: sammo.instructions.Section

render_as_markdown(data, alternative_headings=False, depth=0)#
class sammo.instructions.MetaPrompt(child: list[sammo.instructions.Paragraph | sammo.instructions.Section] | sammo.instructions.Paragraph | sammo.instructions.Section, render_as: beartype.typing.Literal[raw, xml, markdown, markdown - alt] = 'markdown', data_formatter: sammo.dataformatters.DataFormatter | None = None, name: str | None = None, seed: int = 0)#

Bases: sammo.instructions.Renderer

render_as_markdown(data, alternative_headings=False, depth=0)#
render_as_xml(data, depth=0)#
render_as_raw(data)#
with_extractor(on_error: beartype.typing.Literal[raise, empty_result] = 'raise')#
class sammo.instructions.FewshotExamples(data: sammo.data.DataTable, n_examples: int | None = None, name: str | None = None)#

Bases: sammo.base.ScalarComponent

class sammo.instructions.RandomFewshotExamples(data: sammo.data.DataTable, n_examples: int | None = None, name: str | None = None, seed: int = 0)#

Bases: sammo.instructions.FewshotExamples

class sammo.instructions.EmbeddingFewshotExamples(embedder: sammo.base.Runner, data: sammo.data.DataTable, n_examples: int | None = None, name: str | None = None, aggregate: beartype.typing.Literal[roundrobin, max] = 'roundrobin', filter_exact_matches: bool = True, budget: beartype.typing.Literal[absolute, relative] = 'absolute')#

Bases: sammo.instructions.FewshotExamples

MAX_BATCH_SIZE = 1000#
class sammo.instructions.InputData(id_offset: int = 0, name: str | None = None)#

Bases: sammo.base.ScalarComponent