Chatbot Loader#
- class oxen.loaders.ChatLoader(prompt_file, data_file)#
Formats / templatizes data from an Oxen repository for use in chatbot training.
- __init__(prompt_file, data_file)#
Creates a new ChatLoader.
- Parameters:
prompt_file (str) – Path to a text file containing a prompt template for the chatbot.
data_file (str) – Path to a tabular file containing the chatbot training data, with “prompt” and “response” columns
- run()#
- Returns:
outputs[0] – DataFrame with columns containing the templatized prompt (“prompt”) and response (“response”)
- Return type:
pl.DataFrame
Usage#
from oxen import LocalRepo
from oxen.loaders import ChatLoader
repo = LocalRepo()
# Demo data for supervised image classification
repo.clone("https://hub.oxen.ai/ba/dataloader-chat")
loader = ChatLoader(
prompt_file = f"{repo.path}/prompt.txt",
data_file = f"{repo.path}/examples.tsv",
)
[chat_df] = loader.run()