Skip to content

Commit

Permalink
Add suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
e19166 committed Aug 21, 2024
1 parent e0d7561 commit 7327433
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import ballerinax/openai.audio;
Create a `audio:ConnectionConfig` with the obtained API Key and initialize the connector.

```ballerina
configurable string apiKey = ?;
configurable string token = ?;
final images:Client openAIAudio = check new ({
auth: {
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import ballerinax/openai.audio;
Create a `audio:ConnectionConfig` with the obtained API Key and initialize the connector.

```ballerina
configurable string apiKey = ?;
configurable string token = ?;
final images:Client openAIAudio = check new ({
auth: {
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import ballerinax/openai.audio;
Create a `audio:ConnectionConfig` with the obtained API Key and initialize the connector.

```ballerina
configurable string apiKey = ?;
configurable string token = ?;
final images:Client openAIAudio = check new ({
auth: {
Expand Down
26 changes: 6 additions & 20 deletions ballerina/tests/tests.bal
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ configurable string serviceUrl = isLiveServer ? "https://api.openai.com/v1" : "h

const AUDIO_FILE_PATH1 = "tests/resources/audioClip.mp3";

@test:Config {
groups: ["live_tests", "mock_tests"]
}
isolated function testCreateTranslation() returns error? {
final ConnectionConfig config = {
final ConnectionConfig config = {
auth: {
token: apiKey
}
};
final Client openAIAudio = check new(config,serviceUrl);
final Client openAIAudio = check new(config,serviceUrl);

@test:Config {
groups: ["live_tests", "mock_tests"]
}
isolated function testCreateTranslation() returns error? {
byte[] audioContent = check io:fileReadBytes(AUDIO_FILE_PATH1);

CreateTranslationRequest payload = {
Expand All @@ -51,13 +51,6 @@ isolated function testCreateTranslation() returns error? {
groups: ["live_tests", "mock_tests"]
}
isolated function testCreateSpeech() returns error? {
final ConnectionConfig config = {
auth: {
token: apiKey
}
};
final Client openAIAudio = check new(config,serviceUrl);

CreateSpeechRequest requestPayload = {
model: "tts-1",
input: "The",
Expand All @@ -74,13 +67,6 @@ isolated function testCreateSpeech() returns error? {
groups: ["live_tests", "mock_tests"]
}
isolated function testCreateTranscription() returns error? {
final ConnectionConfig config = {
auth: {
token: apiKey
}
};
final Client openAIAudio = check new(config,serviceUrl);

byte[] audioContent = check io:fileReadBytes(AUDIO_FILE_PATH1);

CreateTranscriptionRequest payload = {
Expand Down

0 comments on commit 7327433

Please sign in to comment.