-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert ChatMessage to enum #87
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Apologies for misnaming the Clippy step, should've taken a closer look at the copy-paste 😂
You may also want to update DeltaChatMessage
; I think you'd be able to delete the Role
enum then?
I converted the |
Hmm, yeah, that's not ideal. If you don't mind doing some bookkeeping on the user's behalf, you could store the last role received in the stream, and then when you receive the next message, you could deserialize the JSON to a Alternatively, you could leave it as-is, but provide a stream adapter that does the above. This would allow users to opt-in to the simplified API as desired, but it does mean you'd still have an A tough choice; I'd lean towards the first, because it does simplify things, even if it obscures what the API is actually returning. |
let stream = client.chat().create_stream(parameters).await.unwrap();
let mut tracked_stream = RoleTrackingStream::new(stream);
while let Some(response) = tracked_stream.next().await { @philpax I've added a role tracking stream that that adds the 'role' so the |
Seems pretty reasonable to me! I'd go with this for now and see how people feel about it. We're not currently using streaming, so I don't have a strong preference, but this looks like a good solution. The only thing I'd suggest is adding documentation to clarify what it's for on both |
No description provided.