> For the complete documentation index, see [llms.txt](https://utca.knowledgator.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utca.knowledgator.com/tasks/tokensearcherqanda.md).

# TokenSearcherQandA

Textual Q\&A task

This task uses[ **TokenSearcherPredictor**](/predictors/tokensearcherpredictor.md)[ ](/predictors/comprehenditpredictor.md)by default. For more details, see:

{% content-ref url="/pages/oPEgoLxOvjGqw0yLD7eF" %}
[TokenSearcherPredictor](/predictors/tokensearcherpredictor.md)
{% endcontent-ref %}

Subclass of [**NERTask**](/tasks/task.md#nertask)**.**&#x20;

## Module: [implementation](/framework-structure.md#implementation).tasks

## Methods and properties

Main methods and properties

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**predictor**</mark>**&#x20;(**[**Predictor**](/predictors/predictor.md)**\[Any, Any], optional):** Predictor that will be used in task. If equals to None, default [**TokenSearcherPredictor**](/predictors/tokensearcherpredictor.md) will be used. Defaults to None.
* <mark style="color:orange;">**preprocess**</mark>**&#x20;(Optional\[**[**Component**](/core/component.md)**], optional):** Component executed before predictor. If equals to None, default component will be used. Defaults to None.\
  \
  Default component: \
  [**TokenSearcherQandAPreprocessor**](#tokensearcherqandapreprocessor)
* <mark style="color:orange;">**postprocess**</mark>**&#x20;(Optional\[**[**Component**](/core/component.md)**], optional):** Component executed after predictor. If equals to None, default component will be used. Defaults to None.\
  \
  Default component: \
  [**TokenSearcherQandAPostprocessor**](#tokensearcherqandapostprocessor)
* <mark style="color:orange;">**input\_class**</mark>**&#x20;(Type\[**[**Input**](/core/schemas.md#input)**], optional):** Class for input validation. Defaults to [**TokenSearcherQandAInput**](#tokensearcherqandainput)**.**
* <mark style="color:orange;">**output\_class**</mark>**&#x20;(Type\[**[**NEROutputType**](/tasks/task.md#neroutputtype)**], optional):** Class for output validation. Defaults to [**TokenSearcherQandAOutput**](#tokensearcherqandaoutput)**.**
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

***

***

## <mark style="color:green;">TokenSearcherQandAInput</mark>

Subclass of [**IOModel**](/core/schemas.md#iomodel)**.**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**text**</mark>**&#x20;(str):** Input text.
* <mark style="color:orange;">**question**</mark>**&#x20;(str):** Question to answer.

***

***

***

## <mark style="color:green;">TokenSearcherQandAOutput</mark>

Subclass of [**NEROutput**](/tasks/task.md#neroutput). Type of [**NEROutput**](/tasks/task.md#neroutput)**\[**[**Entity**](/tasks/objects.md#entity)**].**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**text**</mark>**&#x20;(str):** Input text.
* <mark style="color:orange;">**question**</mark>**&#x20;(List\[str]):** Answered question.
* <mark style="color:orange;">**output**</mark>**&#x20;(List\[**[**Entity**](/tasks/objects.md#entity)**]):** Answers.

***

***

***

## <mark style="color:green;">TokenSearcherQandAPreprocessor</mark>

Create prompt with providied text and question. Subclass of [**Action**](/core/action.md). Type of \
[**Action**](/core/action.md)**\[Dict\[str, Any], Dict\[str, Any]].**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):** \
  Expected keys:
  * <mark style="color:red;">**"text"**</mark>**&#x20;(str):** Text to process;
  * <mark style="color:red;">**"question"**</mark> **(str):** Question to answer.

#### Returns:

* **Dict\[str, Any]:** \
  Expected keys:
  * <mark style="color:red;">**"inputs"**</mark>**&#x20;(List\[str]):** Model inputs;

***

***

***

## <mark style="color:green;">TokenSearcherQandAPostprocessor</mark>

Format output. Subclass of [**Action**](/core/action.md). Type of [**Action**](/core/action.md)**\[Dict\[str, Any], Dict\[str, Any]].**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**threshold**</mark>**&#x20;(float):** Answers threshold score. Defaults to 0.
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):** \
  Expected keys:
  * <mark style="color:red;">**"output"**</mark>**&#x20;(List\[List\[Dict\[str, Any]]]):** Model output;
  * <mark style="color:red;">**"inputs"**</mark>**&#x20;(List\[str]):** Model inputs;
  * <mark style="color:red;">**"text"**</mark>**&#x20;(str):** Processed text;
  * <mark style="color:red;">**"question"**</mark> **(str):** Answered question.

#### Returns:

* **Dict\[str, Any]:** \
  Expected keys:
  * <mark style="color:red;">**"text"**</mark>**&#x20;(str):** Processed text;
  * <mark style="color:red;">**"question"**</mark> **(str):** Answered question.
  * <mark style="color:red;">**"output"**</mark>**&#x20;(List\[**[**Entity**](/tasks/objects.md#entity)**]):** Answers;

***

***
