core.datasets.transforms.chat_builder

core.datasets.transforms.chat_builder

This module contains a function that builds a transform that takes a row from the dataset and converts it to a Chat.

Functions

Name Description
chat_message_transform_builder Builds a transform that takes a row from the dataset and converts it to a Chat

chat_message_transform_builder

core.datasets.transforms.chat_builder.chat_message_transform_builder(
    train_on_inputs=False,
    conversations_field='conversations',
    message_field_role=None,
    message_field_content=None,
    message_field_training=None,
)

Builds a transform that takes a row from the dataset and converts it to a Chat

Parameters

Name Type Description Default
train_on_inputs bool If True, the transform will train on the inputs. If False, the transform will train on the targets. Defaults to False. False
conversations_field str The field name of the conversations. Defaults to “conversations”. 'conversations'
message_field_role str | list[str] The field name of the role. Defaults to “role”. None
message_field_content str | list[str] The field name of the message content. Defaults to “content”. None
message_field_training str | list[str] The field name of the train/weight. Defaults to “weight”. None

Returns

Name Type Description
Callable A function that takes a list of conversations and returns a list of messages.