promptmeteo.parsers package#

Submodules#

promptmeteo.parsers.api_parser module#

class promptmeteo.parsers.api_parser.ApiParser(prompt_labels: List[str])#

Bases: BaseParser

Dummy parser, returns what it receives.

run(text: str) str#

Given a response string from an LLM, returns the response expected for the task.

promptmeteo.parsers.base module#

class promptmeteo.parsers.base.BaseParser(prompt_labels: List[str])#

Bases: ABC

Parser class interface.

abstract run(text: str) List[str]#

Given a response string from an LLM, returns the response expected for the task.

exception promptmeteo.parsers.base.ParserException#

Bases: Exception

promptmeteo.parsers.classification_parser module#

class promptmeteo.parsers.classification_parser.ClassificationParser(prompt_labels: List[str])#

Bases: BaseParser

Parser for the classification task.

run(text: str) List[str]#

Given a response string from an LLM, returns the response expected for the task.

promptmeteo.parsers.dummy_parser module#

class promptmeteo.parsers.dummy_parser.DummyParser(prompt_labels: List[str])#

Bases: BaseParser

Dummy parser, returns what it receives.

run(text: str) List[str]#

Given a response string from an LLM, returns the response expected for the task.

promptmeteo.parsers.json_parser module#

class promptmeteo.parsers.json_parser.JSONParser(prompt_labels: List[str])#

Bases: BaseParser

Parser for potential JSON outputs

run(text: str) List[str]#

Given a response string from an LLM, returns the response expected for the task.

Module contents#

class promptmeteo.parsers.ParserFactory#

Bases: object

Factory of Parsers.

classmethod factory_method(task_type: str, prompt_labels: List[str])#

Returns and instance of a BaseParser object depending on the task_type.

class promptmeteo.parsers.ParserTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: str, Enum

Enum of availables parsers.

PARSER_1: str = 'classification'#
PARSER_2: str = 'ner'#
PARSER_3: str = 'qa'#
PARSER_4: str = 'code-generation'#
PARSER_5: str = 'api-generation'#
PARSER_6: str = 'api-correction'#
PARSER_7: str = 'json-info-extraction'#
PARSER_8: str = 'summarization'#