[BREAKING_CHANGES] Fix update message payload (#699)

* add custom marshaller, documentation and isolate tests

* fix linter

* wrap payload as expected from the API and update test

* modify input to accept map[string]string only
This commit is contained in:
Quest Henkart
2024-04-09 16:22:31 +08:00
committed by GitHub
parent 774fc9dd12
commit 187f4169f8
2 changed files with 9 additions and 4 deletions

View File

@@ -139,11 +139,11 @@ func (c *Client) RetrieveMessage(
func (c *Client) ModifyMessage(
ctx context.Context,
threadID, messageID string,
metadata map[string]any,
metadata map[string]string,
) (msg Message, err error) {
urlSuffix := fmt.Sprintf("/threads/%s/%s/%s", threadID, messagesSuffix, messageID)
req, err := c.newRequest(ctx, http.MethodPost, c.fullURL(urlSuffix),
withBody(metadata), withBetaAssistantV1())
withBody(map[string]any{"metadata": metadata}), withBetaAssistantV1())
if err != nil {
return
}