Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

3.5.0 - JSON Serialization

Compare
Choose a tag to compare
@maxijonson maxijonson released this 01 May 01:00
· 68 commits to develop since this release

JSON Serialization

When developing different implementations of GPT Turbo, I quickly noticed that a usage pattern emerged: I wanted to persist conversations in some way or another and load them at a later time. Before, this was done by creating a conversation and manually adding each message one after the other. Additionally, the code was almost exactly the same for each implementation.

This release brings new static and instance methods to handle the serialization and deserialization of Conversation objects (and other classes):

  • conversation.toJSON() creates a JSON object from a Conversation instance.
  • Conversation.fromJSON creates a Conversation instance from a JSON object.

These were also implemented in all implementations of GPT Turbo, greatly reducing logic and repeated code.