Skip to content

Commit

Permalink
Merge branch 'fix/change_cpp_reserved_keyword_delete' into 'master'
Browse files Browse the repository at this point in the history
OpenAI: release v1.0.0 component

Closes AEGHB-645

See merge request ae_group/esp-iot-solution!997
  • Loading branch information
leeebo committed May 20, 2024
2 parents f2a2669 + c90686e commit 7dd88d7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
1 change: 0 additions & 1 deletion components/avi_player/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[![Component Registry](https://components.espressif.com/components/espressif/avi_player/badge.svg)](https://components.espressif.com/components/espressif/avi_player)

# Component: AVI Player
[Online documentation](https://docs.espressif.com/projects/esp-iot-solution/en/latest/input_device/avi_player.html)

The `avi_player` component can parse avi format data and pass the audio/video frames through callback.

Expand Down
6 changes: 6 additions & 0 deletions components/openai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ChangeLog

## v1.0.0 - 2024-5-15

### Break Changes:

* Changed C++ reserved keyword 'delete' to 'deleteResponse'

## v0.3.1 - 2023-12-29

### Enhancements
Expand Down
10 changes: 5 additions & 5 deletions components/openai/OpenAI.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static OpenAI_EmbeddingResponse_t *OpenAI_EmbeddingResponseCreate(const char *pa
_embeddingResponse->parent.getLen = &OpenAI_EmbeddingResponseGetLen;
_embeddingResponse->parent.getData = &OpenAI_EmbeddingResponseGetDate;
_embeddingResponse->parent.getError = &OpenAI_EmbeddingResponseGetError;
_embeddingResponse->parent.delete = &OpenAI_EmbeddingResponseDelete;
_embeddingResponse->parent.deleteResponse = &OpenAI_EmbeddingResponseDelete;
cJSON_Delete(json);
return &_embeddingResponse->parent;
end:
Expand Down Expand Up @@ -371,7 +371,7 @@ static OpenAI_ModerationResponse_t *OpenAI_ModerationResponseCreate(const char *
_moderationResponse->parent.getLen = &OpenAI_ModerationResponseGetLen;
_moderationResponse->parent.getData = &OpenAI_ModerationResponseGetDate;
_moderationResponse->parent.getError = &OpenAI_ModerationResponseGetError;
_moderationResponse->parent.delete = &OpenAI_ModerationResponseDelete;
_moderationResponse->parent.deleteResponse = &OpenAI_ModerationResponseDelete;
return &_moderationResponse->parent;
end:
cJSON_Delete(json);
Expand Down Expand Up @@ -503,7 +503,7 @@ OpenAI_ImageResponse_t *OpenAI_ImageResponseCreate(const char *payload)
_imageResponse->parent.getLen = &OpenAI_ImageResponseGetLen;
_imageResponse->parent.getData = &OpenAI_ImageResponseGetDate;
_imageResponse->parent.getError = &OpenAI_ImageResponseGetError;
_imageResponse->parent.delete = &OpenAI_ImageResponseDelete;
_imageResponse->parent.deleteResponse = &OpenAI_ImageResponseDelete;
return &_imageResponse->parent;
end:
cJSON_Delete(json);
Expand Down Expand Up @@ -657,7 +657,7 @@ static OpenAI_StringResponse_t *OpenAI_StringResponseCreate(char *payload)
_stringResponse->parent.getLen = &OpenAI_StringResponseGetLen;
_stringResponse->parent.getData = &OpenAI_StringResponseGetDate;
_stringResponse->parent.getError = &OpenAI_StringResponseGetError;
_stringResponse->parent.delete = &OpenAI_StringResponseDelete;
_stringResponse->parent.deleteResponse = &OpenAI_StringResponseDelete;
return &_stringResponse->parent;
end:
cJSON_Delete(json);
Expand Down Expand Up @@ -1903,7 +1903,7 @@ static OpenAI_SpeechResponse_t *OpenAI_SpeechResponseCreate(char *payload, size_

_audioSpeech->parent.getLen = &OpenAI_SpeechBufferGetLen;
_audioSpeech->parent.getData = &OpenAI_SpeechGetDate;
_audioSpeech->parent.delete = &OpenAI_SpeechResponseDelete;
_audioSpeech->parent.deleteResponse = &OpenAI_SpeechResponseDelete;
return &_audioSpeech->parent;
end:
free(payload);
Expand Down
2 changes: 1 addition & 1 deletion components/openai/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "0.3.1"
version: "1.0.0"
description: OpenAI library compatible with ESP-IDF
url: https://github.com/espressif/esp-iot-solution
repository: https://github.com/espressif/esp-iot-solution.git
Expand Down
10 changes: 5 additions & 5 deletions components/openai/include/OpenAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ typedef struct OpenAI_EmbeddingResponse {
*
* @param embeddingData[in] the point of OpenAI_EmbeddingResponse
*/
void (*delete)(struct OpenAI_EmbeddingResponse *embeddingData);
void (*deleteResponse)(struct OpenAI_EmbeddingResponse *embeddingData);
} OpenAI_EmbeddingResponse_t;

/**
Expand Down Expand Up @@ -146,7 +146,7 @@ typedef struct OpenAI_ModerationResponse {
*
* @param moderationResponse[in] the point of } OpenAI_ModerationResponse_t
*/
void (*delete)(struct OpenAI_ModerationResponse *moderationResponse);
void (*deleteResponse)(struct OpenAI_ModerationResponse *moderationResponse);
} OpenAI_ModerationResponse_t;

/**
Expand Down Expand Up @@ -185,7 +185,7 @@ typedef struct OpenAI_ImageResponse {
*
* @param imageResponse[in] the point of } OpenAI_ImageResponse_t
*/
void (*delete)(struct OpenAI_ImageResponse *imageResponse);
void (*deleteResponse)(struct OpenAI_ImageResponse *imageResponse);
} OpenAI_ImageResponse_t;

/**
Expand Down Expand Up @@ -230,7 +230,7 @@ typedef struct OpenAI_StringResponse {
*
* @param stringResponse[in] the point of OpenAI_StringResponse_t
*/
void (*delete)(struct OpenAI_StringResponse *stringResponse);
void (*deleteResponse)(struct OpenAI_StringResponse *stringResponse);
} OpenAI_StringResponse_t;

/**
Expand Down Expand Up @@ -259,7 +259,7 @@ typedef struct OpenAI_SpeechResponse {
*
* @param SpeechResponse[in] the point of OpenAI_SpeechResponse_t
*/
void (*delete)(struct OpenAI_SpeechResponse *SpeechResponse);
void (*deleteResponse)(struct OpenAI_SpeechResponse *SpeechResponse);

} OpenAI_SpeechResponse_t;

Expand Down
6 changes: 3 additions & 3 deletions components/openai/test_apps/main/test_openai.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ TEST_CASE("test ChatCompletion", "[ChatCompletion]")
} else {
ESP_LOGE(TAG, "Unknown error!");
}
result->delete (result);
result->deleteResponse(result);
// english
result = chatCompletion->message(chatCompletion, "tell me a joke", false);
TEST_ASSERT_NOT_NULL(result);
Expand All @@ -90,7 +90,7 @@ TEST_CASE("test ChatCompletion", "[ChatCompletion]")
ESP_LOGE(TAG, "Unknown error!");
}

result->delete (result);
result->deleteResponse(result);
openai->chatDelete(chatCompletion);
OpenAIDelete(openai);
example_disconnect();
Expand Down Expand Up @@ -187,7 +187,7 @@ TEST_CASE("test AudioSpeech", "[AudioSpeech]")
free(giventext);
free(finaltext);
openai->audioTranscriptionDelete(audioTranscription);
speechresult->delete (speechresult);
speechresult->deleteResponse(speechresult);
openai->audioSpeechDelete(audioSpeech);
OpenAIDelete(openai);
example_disconnect();
Expand Down

0 comments on commit 7dd88d7

Please sign in to comment.