What shape should the chat thread in Promptbook have? #156
hejny
started this conversation in
Polls (Promptbook asking community)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Advice, I'm solving the integration of native conversation threads in chat completion models for @promptbook. So far we couldn't hold threads, we only summarized the previous conversation in the prompt and always started a new conversation. Now we'd like to add the ability to send the previous conversation to the model for completion as well, as the models allow: however, I have a dilemma how to technically handle this. In principle, two possibilities come to mind:
Array
Messages are represented as an array where it goes zig-zag assistant, user, assistant, user, assistant, user.
Chains
Each message can contain a link to the previous message, or null if it is the first message in the conversation. At the same time, each message has a unique UUID or hash, which is computed from both the content of the message itself and the hash of the previous message it links to.
Both have advantages and disadvantages. The former is technically simpler and also conforms to the much more direct format that APIs typically require. At the same time, purely from a programming point of view, the second solution strikes me as much more elegant. While it's a bit harder to implement, it has a lot of advantages, especially in complex branching conversations where multiple messages can reference the same source conversation, but I only keep each unique message in memory and cache.
I'd be glad for an opinion, some insight, insight on how others solve this, or how you solve it when integrating language models.
Array
Chain
0 votes ·
Beta Was this translation helpful? Give feedback.
All reactions