promptmeteo.tasks package#

Submodules#

promptmeteo.tasks.task module#

class promptmeteo.tasks.task.Task(language: str, task_type: str, verbose: bool = False)#

Bases: object

Base Task interface.

property language: str#

Get Task Language.

property model: BaseModel#

Get Task Model.

property parser: BaseParser#

Get Task Parser.

property prompt: BasePrompt#

Get Task Prompt.

run(example: str) str#

Given a text sample, return the text predicted by Promptmeteo.

property selector: BaseSelector#

Get Task Selector.

property task_type: str#

Get Task type.

promptmeteo.tasks.task_builder module#

class promptmeteo.tasks.task_builder.TaskBuilder(language: str, task_type: str, verbose: bool = False)#

Bases: object

Builder of Tasks.

build_model(model_name: str = '', model_provider_name: str = '', model_provider_token: str | None = '', model_params: Dict | None = None) Self#

Builds a model for the task.

build_parser(prompt_labels: List[str]) Self#

Builds the parser for the task.

build_prompt(model_name: str, prompt_domain: str, prompt_labels: List[str], prompt_detail: str) Self#

Builds a prompt for the task.

build_selector_by_load(model_path: str, selector_k: int, selector_type: str, selector_algorithm: str, **kwargs) Self#

Builds the selector for the task by loading a pretrained selector.

build_selector_by_train(examples: List[str], annotations: List[str], selector_k: int, selector_type: str, selector_algorithm: str) Self#

Builds the selector for the task by training a new selector.

property task: Task#

Task to build.

class promptmeteo.tasks.task_builder.TaskTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: str, Enum

Enum with all the available task types.

API_CORRECTION: str = 'api-correction'#
API_GENERATION: str = 'api-generation'#
CLASSIFICATION: str = 'classification'#
CODE_GENERATION: str = 'code-generation'#
QA: str = 'qa'#
SUMMARIZATION: str = 'summarization'#

Module contents#