Skip to content

Commit

Permalink
Replace io.fileReadBytes with a byte array
Browse files Browse the repository at this point in the history
  • Loading branch information
KATTA-00 committed Aug 9, 2024
1 parent 95229c7 commit 868ea36
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
4 changes: 0 additions & 4 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.value"}
]
modules = [
{org = "ballerina", packageName = "io", moduleName = "io"}
]

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -321,7 +318,6 @@ name = "openai.finetunes"
version = "1.0.5"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "log"},
{org = "ballerina", name = "mime"},
{org = "ballerina", name = "test"},
Expand Down
13 changes: 4 additions & 9 deletions ballerina/tests/test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// under the License.

import ballerina/test;
import ballerina/io;
// import ballerina/io;

configurable boolean isLiveServer = ?;
configurable string token = ?;
Expand All @@ -27,7 +27,10 @@ configurable string apiKey = isLiveServer ? token : "";

final ConnectionConfig config = {auth: {token: apiKey}};
final Client baseClient = check new Client(config, serviceUrl);

final string fileName = "sample.jsonl";
const string fileId = "file-1";
const byte[] fileContent = [123,13,10,32,32,32,32,34,112,114,111,109,112,116,34,58,32,34,87,104,97,116,32,105,115,32,116,104,101,32,97,110,115,119,101,114,32,116,111,32,50,43,50,34,44,13,10,32,32,32,32,34,99,111,109,112,108,101,116,105,111,110,34,58,32,34,52,34,13,10,125];

// Models

Expand Down Expand Up @@ -109,8 +112,6 @@ isolated function testListFiles() returns error? {
}
isolated function testCreateFile() returns error? {

byte[] fileContent = check io:fileReadBytes(fileName);

CreateFileRequest fileRequest = {
file: {fileContent, fileName},
purpose: "fine-tune"
Expand Down Expand Up @@ -149,8 +150,6 @@ isolated function testRetrieveFile() returns error? {
}
isolated function testDownloadFile() returns error? {

byte[] fileContent = check io:fileReadBytes(fileName);

CreateFileRequest fileRequest = {
file: {fileContent, fileName},
purpose: "fine-tune"
Expand All @@ -168,8 +167,6 @@ isolated function testDownloadFile() returns error? {
}
isolated function testDeleteFile() returns error? {

byte[] fileContent = check io:fileReadBytes(fileName);

CreateFileRequest fileRequest = {
file: {fileContent, fileName},
purpose: "fine-tune"
Expand Down Expand Up @@ -201,8 +198,6 @@ isolated function testListPaginatedFineTuningJobs() returns error? {
}
isolated function testCreateFineTuningJob() returns error? {

byte[] fileContent = check io:fileReadBytes(fileName);

CreateFileRequest fileRequest = {
file: {fileContent, fileName},
purpose: "fine-tune"
Expand Down
File renamed without changes.

0 comments on commit 868ea36

Please sign in to comment.