|Input||Depends on the function used|
|Output||Depends on the function used|
To initialize the Shaper, specify the function to use for modifying your variables. In this example, the node takes the value
query, and creates a list that contains this value as many times as it takes to match the length of the
documents list. This list is passed down the pipeline under the key
from haystack.nodes import Shaper mapper = Shaper( func="expand_value_to_list" value="query", target_list=[Documents], output=questions )
components: - name: mapper type: Shaper params: func: expand_value_to_list inputs: value: query target_list: documents outputs: - questions
When initializing Shaper, you specify the function you want it to invoke. The supported functions are:
Renames values without changing them.
- name: shaper type: Shaper params: func: rename inputs: value: query output: [question]
Outputs the current time and/or date.
- name: shaper type: Shaper params: func: current_datetime params: format: "%H:%M:%S %d/%m/%y" outputs: - date_time
Changes a value into a list. The value is repeated in the list to match the length of the list. For example, if you set the list length to five, the value is repeated in this list five times.
- name:QuestionsShaper type: Shaper params: func: value_to_list inputs: value: query outputs: - questions params: target_list: 
Joins multiple lists into a single list.
Takes a list of strings and changes it into a list that contains a single string. The new list contains all the original strings separated by the specified delimiter.
Takes a list of documents and changes it into a list containing a single document. The new list contains all the original documents separated by the specified delimiter. You can use the
patternparameter to control how each document is represented.
Takes a list of documents containing scores in their metadata and changes them into a list containing a single document. The resulting document contains both the content of the original
Replaces values in a string.
Changes a document into a string. You can control how the document is represented using the
Changes an answer into a single string. You can control how the answer is represented using the
Takes a list of documents and changes them into a single string. The resulting string is the joined results of all original documents separated by the delimiter you specify. You can control how each document is represented using the
Transforms a string into an answer. You can populate the answer's document IDs by extracting document references from the string.
Parses an answer string for document references and returns the document ids of the referenced documents.
Extracts the content field of Answers and returns a list of strings.
Changes a list of strings into a list of documents.
contentfield of each document you pass to it and puts it in a list of strings. Each item in this list is the content of the
contentfield of one document.
In a pipeline, after performing a function, Shaper passes the new or modified values further down the pipeline.
Updated 5 months ago