Input transformer chain
Defines a wrapper to chain a list of input transformers.
InputTransformerChain(transformers)
A wrapper to chain a list of input transformers.
The InputTransformerChain class defines the interface for transforming
the input of language models using a chain of input transformers.
Attributes:
| Name | Type | Description |
|---|---|---|
transformers |
list[BaseInputTransformer]
|
The list of input transformers to use. |
Initializes a new instance of the InputTransformerChain class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transformers
|
list[BaseInputTransformer]
|
The list of input transformers to use. |
required |
from_configs(configs)
classmethod
Create an input transformer chain from configs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configs
|
list[InputTransformerConfig]
|
The list of input transformer configs to use. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
InputTransformerChain |
InputTransformerChain
|
The input transformer chain. |
transform(messages)
Transforms the input messages of a language model.
This method transforms the input messages using the chain of input transformers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
messages
|
list[Message]
|
The input messages to transform. |
required |
Returns:
| Type | Description |
|---|---|
list[Message]
|
list[Message]: The transformed input messages of a language model. |