Skip to content

Commit

Permalink
Merge pull request #22 from KATTA-00/example
Browse files Browse the repository at this point in the history
Change the client init in examples
  • Loading branch information
NipunaRanasinghe authored Aug 21, 2024
2 parents b5e40f2 + bcb83bc commit d43ff2d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions examples/sarcastic-bot/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ const VALIDATION_FILENAME = "validation.jsonl";
const TRAINING_FILEPATH = "./data/" + TRAINING_FILENAME;
const VALIDATION_FILEPATH = "./data/" + VALIDATION_FILENAME;

final finetunes:ConnectionConfig config = {auth: {token}};
final finetunes:Client openAIFinetunes = check new finetunes:Client(config, SERVICE_URL);

public function main() returns error? {

final finetunes:ConnectionConfig config = {
auth: {
token
}
};
final finetunes:Client openAIFinetunes = check new finetunes:Client(config, SERVICE_URL);

byte[] trainingFileContent = check io:fileReadBytes(TRAINING_FILEPATH);
byte[] validationFileContent = check io:fileReadBytes(VALIDATION_FILEPATH);

Expand Down
10 changes: 7 additions & 3 deletions examples/sports-headline-analyzer/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ string SERVICE_URL = "https://api.openai.com/v1";
string TRAINING_FILENAME = "training.jsonl";
string TRAINING_FILEPATH = "./data/" + TRAINING_FILENAME;

final finetunes:ConnectionConfig config = {auth: {token}};
final finetunes:Client openAIFinetunes = check new finetunes:Client(config, SERVICE_URL);

public function main() returns error? {

final finetunes:ConnectionConfig config = {
auth: {
token
}
};
final finetunes:Client openAIFinetunes = check new finetunes:Client(config, SERVICE_URL);

byte[] trainingFileContent = check io:fileReadBytes(TRAINING_FILEPATH);

finetunes:CreateFileRequest trainingFileRequest = {
Expand Down

0 comments on commit d43ff2d

Please sign in to comment.