Chat
Completion
Generator
Model
JSON Serialization
Let’s build a joke pipeline and serialize the final chat into JSON.id
field to help track them in a datastore like Elastic or Pandas. We also assign a timestamp
to understand when the generation took place. We are also taking advantage of the .meta()
rigging.chat.ChatPipeline.meta to add a tracking tag for filtering later.
JSON Deserialization
The JSON has everything required to reconstruct a Chat including agenerator_id
dynamically constructed to preserve the parameters used to create the generated message(s). We can now deserialize a chat from a datastore, and immediately step back into a ChatPipeline
for exploration.
Pandas DataFrames
Rigging also has helpers in therigging.data
module for performing conversions between Chat objects and other storage formats like Pandas. In chats_to_df
the messages are flattened and stored with a chat_id
column for grouping. df_to_chats
allows you to reconstruct a list of Chat objects back from a DataFrame.