[BREAKING_CHANGES] Fix update message payload #699
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the change
Resolves #692
The ModifyMessage endpoint improperly wraps the payload. Including the expected map[string]any object into the method will result in an API error as the API requires it to be wrapped in "metadata".
This is a breaking change because to have successfully used this endpoint, developers would have run into this API error, debugged it and realized that the payload isn't being wrapped by the underlying code as expected by the API.
Provide OpenAI documentation link
https://platform.openai.com/docs/api-reference/messages/modifyMessage
Describe your solution
This simply wraps the payload as expected by the API and as assumed by the interface. The interface accepts a metadata object, either the interface needs to change to accept a generic payload object (which would be equally misleading). Or we update the underlying code to properly wrap the payload as expected
Tests
Unit tests
Additional context
We will need to inform that anyone who figured out how to use this endpoint will need to update their code to remove the manual wrapping of the payload.
Issue: #692
Alternatively I can avoid the breaking change by only wrapping the payload if it's not already wrapped. I think this will create complexity down the road, but it is an option