EditChatMessage edits an existing user message in a chat and re-runs from there.
( ctx context.Context, chatID uuid.UUID, messageID int64, req EditChatMessageRequest, )
| 3190 | |
| 3191 | // EditChatMessage edits an existing user message in a chat and re-runs from there. |
| 3192 | func (c *ExperimentalClient) EditChatMessage( |
| 3193 | ctx context.Context, |
| 3194 | chatID uuid.UUID, |
| 3195 | messageID int64, |
| 3196 | req EditChatMessageRequest, |
| 3197 | ) (EditChatMessageResponse, error) { |
| 3198 | res, err := c.Request( |
| 3199 | ctx, |
| 3200 | http.MethodPatch, |
| 3201 | fmt.Sprintf("/api/experimental/chats/%s/messages/%d", chatID, messageID), |
| 3202 | req, |
| 3203 | ) |
| 3204 | if err != nil { |
| 3205 | return EditChatMessageResponse{}, err |
| 3206 | } |
| 3207 | if res.StatusCode != http.StatusOK { |
| 3208 | return EditChatMessageResponse{}, readBodyAsChatUsageLimitError(res) |
| 3209 | } |
| 3210 | defer res.Body.Close() |
| 3211 | var resp EditChatMessageResponse |
| 3212 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 3213 | } |
| 3214 | |
| 3215 | // InterruptChat cancels an in-flight chat run and leaves it waiting. |
| 3216 | func (c *ExperimentalClient) InterruptChat(ctx context.Context, chatID uuid.UUID) (Chat, error) { |