TokenSearcherQandA

Textual Q&A task

This task uses TokenSearcherPredictor by default. For more details, see:

TokenSearcherPredictor

Subclass of NERTask.

Module: implementation.tasks

Methods and properties

Main methods and properties


__init__

Arguments:

  • predictor (Predictor[Any, Any], optional): Predictor that will be used in task. If equals to None, default TokenSearcherPredictor will be used. Defaults to None.

  • preprocess (Optional[Component], optional): Component executed before predictor. If equals to None, default component will be used. Defaults to None. Default component: TokenSearcherQandAPreprocessor

  • postprocess (Optional[Component], optional): Component executed after predictor. If equals to None, default component will be used. Defaults to None. Default component: TokenSearcherQandAPostprocessor

  • input_class (Type[Input], optional): Class for input validation. Defaults to TokenSearcherQandAInput.

  • output_class (Type[NEROutputType], optional): Class for output validation. Defaults to TokenSearcherQandAOutput.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.




TokenSearcherQandAInput

Subclass of IOModel.


__init__

Arguments:

  • text (str): Input text.

  • question (str): Question to answer.




TokenSearcherQandAOutput

Subclass of NEROutput. Type of NEROutput[Entity].


__init__

Arguments:

  • text (str): Input text.

  • question (List[str]): Answered question.

  • output (List[Entity]): Answers.




TokenSearcherQandAPreprocessor

Create prompt with providied text and question. Subclass of Action. Type of Action[Dict[str, Any], Dict[str, Any]].


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "text" (str): Text to process;

    • "question" (str): Question to answer.

Returns:

  • Dict[str, Any]: Expected keys:

    • "inputs" (List[str]): Model inputs;




TokenSearcherQandAPostprocessor

Format output. Subclass of Action. Type of Action[Dict[str, Any], Dict[str, Any]].


__init__

Arguments:

  • threshold (float): Answers threshold score. Defaults to 0.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "output" (List[List[Dict[str, Any]]]): Model output;

    • "inputs" (List[str]): Model inputs;

    • "text" (str): Processed text;

    • "question" (str): Answered question.

Returns:

  • Dict[str, Any]: Expected keys:

    • "text" (str): Processed text;

    • "question" (str): Answered question.

    • "output" (List[Entity]): Answers;



Last updated