diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1c2c9fe..819434f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,6 +3,5 @@ # See: https://help.github.com/articles/about-codeowners/ -# TODO: Add code owners # These owners will be the default owners for everything in the repo. -* +* @NipunaRanasinghe diff --git a/README.md b/README.md index 026530b..318c49b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [OpenAI](https://openai.com/), an AI research organization focused on creating friendly AI for humanity, offers the [OpenAI API](https://platform.openai.com/docs/api-reference/introduction) to access its powerful AI models for tasks like natural language processing and image generation. -The `ballarinax/openai.finetunes` package offers APIs to connect and interact with [the fine-tuning related endpoints of OpenAI REST API v1](https://platform.openai.com/docs/guides/fine-tuning) allowing users to customize OpenAI's AI models to meet specific needs. +The `ballarinax/openai.finetunes` package offers APIs to connect and interact with [the fine-tuning related endpoints of OpenAI REST API v1](https://platform.openai.com/docs/api-reference/fine-tuning) allowing users to customize OpenAI's AI models to meet specific needs. ## Setup guide @@ -50,11 +50,11 @@ import ballerina/io; Create a `finetunes:ConnectionConfig` with the obtained API Key and initialize the connector. ```ballerina -configurable string apiKey = ?; +configurable string token = ?; final finetunes:Client openAIFinetunes = check new({ auth: { - token: apiKey + token } }); ``` @@ -97,11 +97,11 @@ bal run ## Examples -The `OpenAI Finetunes` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/module-ballerinax-openai.finetunes/tree/main/examples/), covering the following use cases: +The `OpenAI Finetunes` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples), covering the following use cases: -1. [Sarcastic bot](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/Sarcastic-bot) - Fine-tune the GPT-3.5-turbo model to generate sarcastic responses +1. [Sarcastic bot](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/sarcastic-bot) - Fine-tune the GPT-3.5-turbo model to generate sarcastic responses -2. [Sports headline analyzer](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/Sports-headline-analyzer) - Fine-tune the GPT-4o-mini model to extract structured information (player, team, sport, and gender) from sports headlines. +2. [Sports headline analyzer](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/sports-headline-analyzer) - Fine-tune the GPT-4o-mini model to extract structured information (player, team, sport, and gender) from sports headlines. ## Build from the source diff --git a/ballerina/Module.md b/ballerina/Module.md index 85a8f0a..6b7186f 100644 --- a/ballerina/Module.md +++ b/ballerina/Module.md @@ -3,7 +3,7 @@ [OpenAI](https://openai.com/), an AI research organization focused on creating friendly AI for humanity, offers the [OpenAI API](https://platform.openai.com/docs/api-reference/introduction) to access its powerful AI models for tasks like natural language processing and image generation. -The `ballarinax/openai.finetunes` package offers APIs to connect and interact with [the fine-tuning related endpoints of OpenAI REST API v1](https://platform.openai.com/docs/guides/fine-tuning) allowing users to customize OpenAI's AI models to meet specific needs. +The `ballarinax/openai.finetunes` package offers APIs to connect and interact with [the fine-tuning related endpoints of OpenAI REST API v1](https://platform.openai.com/docs/api-reference/fine-tuning) allowing users to customize OpenAI's AI models to meet specific needs. ## Setup guide @@ -43,11 +43,11 @@ import ballerina/io; Create a `finetunes:ConnectionConfig` with the obtained API Key and initialize the connector. ```ballerina -configurable string apiKey = ?; +configurable string token = ?; final finetunes:Client openAIFinetunes = check new({ auth: { - token: apiKey + token } }); ``` @@ -90,8 +90,8 @@ bal run ## Examples -The `OpenAI Finetunes` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/module-ballerinax-openai.finetunes/tree/main/examples/), covering the following use cases: +The `OpenAI Finetunes` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples), covering the following use cases: -1. [Sarcastic bot](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/Sarcastic-bot) - Fine-tune the GPT-3.5-turbo model to generate sarcastic responses +1. [Sarcastic bot](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/sarcastic-bot) - Fine-tune the GPT-3.5-turbo model to generate sarcastic responses -2. [Sports headline analyzer](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/Sports-headline-analyzer) - Fine-tune the GPT-4o-mini model to extract structured information (player, team, sport, and gender) from sports headlines. +2. [Sports headline analyzer](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/sports-headline-analyzer) - Fine-tune the GPT-4o-mini model to extract structured information (player, team, sport, and gender) from sports headlines. diff --git a/ballerina/Package.md b/ballerina/Package.md index 85a8f0a..6b7186f 100644 --- a/ballerina/Package.md +++ b/ballerina/Package.md @@ -3,7 +3,7 @@ [OpenAI](https://openai.com/), an AI research organization focused on creating friendly AI for humanity, offers the [OpenAI API](https://platform.openai.com/docs/api-reference/introduction) to access its powerful AI models for tasks like natural language processing and image generation. -The `ballarinax/openai.finetunes` package offers APIs to connect and interact with [the fine-tuning related endpoints of OpenAI REST API v1](https://platform.openai.com/docs/guides/fine-tuning) allowing users to customize OpenAI's AI models to meet specific needs. +The `ballarinax/openai.finetunes` package offers APIs to connect and interact with [the fine-tuning related endpoints of OpenAI REST API v1](https://platform.openai.com/docs/api-reference/fine-tuning) allowing users to customize OpenAI's AI models to meet specific needs. ## Setup guide @@ -43,11 +43,11 @@ import ballerina/io; Create a `finetunes:ConnectionConfig` with the obtained API Key and initialize the connector. ```ballerina -configurable string apiKey = ?; +configurable string token = ?; final finetunes:Client openAIFinetunes = check new({ auth: { - token: apiKey + token } }); ``` @@ -90,8 +90,8 @@ bal run ## Examples -The `OpenAI Finetunes` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/module-ballerinax-openai.finetunes/tree/main/examples/), covering the following use cases: +The `OpenAI Finetunes` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples), covering the following use cases: -1. [Sarcastic bot](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/Sarcastic-bot) - Fine-tune the GPT-3.5-turbo model to generate sarcastic responses +1. [Sarcastic bot](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/sarcastic-bot) - Fine-tune the GPT-3.5-turbo model to generate sarcastic responses -2. [Sports headline analyzer](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/Sports-headline-analyzer) - Fine-tune the GPT-4o-mini model to extract structured information (player, team, sport, and gender) from sports headlines. +2. [Sports headline analyzer](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/sports-headline-analyzer) - Fine-tune the GPT-4o-mini model to extract structured information (player, team, sport, and gender) from sports headlines. diff --git a/ballerina/tests/README.md b/ballerina/tests/README.md index cca0034..a818d1a 100644 --- a/ballerina/tests/README.md +++ b/ballerina/tests/README.md @@ -19,7 +19,7 @@ You can run the tests in either of these environments, and each has its own comp ## Running Tests in the Mock Server -To execute the tests on the mock server, ensure that the `isLiveServer` environment variable is either set to `false` or left unset before initiating the tests. +To execute the tests on the mock server, ensure that the `IS_LIVE_SERVER` environment variable is either set to `false` or left unset before initiating the tests. This environment variable can be configured within the `Config.toml` file located in the `tests` directory or specified as an environment variable. @@ -38,13 +38,13 @@ Alternatively, you can set the environment variable directly. For Linux or macOS: ```bash -export isLiveServer=false +export IS_LIVE_SERVER=false ``` For Windows: ```bash -setx isLiveServer false +setx IS_LIVE_SERVER false ``` Then, run the following command to execute the tests: @@ -71,15 +71,15 @@ Alternatively, you can set your authentication credentials as environment variab For Linux or macOS: ```bash -export isLiveServer=true -export token="" +export IS_LIVE_SERVER=true +export OPENAI_API_KEY="" ``` For Windows: ```bash -setx isLiveServer true -setx token +setx IS_LIVE_SERVER true +setx OPENAI_API_KEY ``` Then, run the following command to execute the tests: diff --git a/ballerina/tests/test.bal b/ballerina/tests/test.bal index 14003a1..c286cdd 100644 --- a/ballerina/tests/test.bal +++ b/ballerina/tests/test.bal @@ -17,14 +17,13 @@ import ballerina/os; import ballerina/test; -configurable boolean isLiveServer = os:getEnv("isLiveServer") == "true"; -configurable string token = isLiveServer ? os:getEnv("OPENAI_API_KEY") : "test"; +configurable boolean isLiveServer = os:getEnv("IS_LIVE_SERVER") == "true"; +configurable string token = isLiveServer ? os:getEnv("OPENAI_API_KEY") : ""; configurable string serviceUrl = isLiveServer ? "https://api.openai.com/v1" : "http://localhost:9090"; -configurable string apiKey = isLiveServer ? token : ""; final ConnectionConfig config = { auth: { - token: apiKey + token } }; final Client openAIFinetunes = check new Client(config, serviceUrl); diff --git a/docs/setup/resources/api-key-dashboard.png b/docs/setup/resources/api-key-dashboard.png index 0a66883..5239d1a 100644 Binary files a/docs/setup/resources/api-key-dashboard.png and b/docs/setup/resources/api-key-dashboard.png differ diff --git a/docs/setup/resources/create-new-secret-key.png b/docs/setup/resources/create-new-secret-key.png index 5492f4a..70daf70 100644 Binary files a/docs/setup/resources/create-new-secret-key.png and b/docs/setup/resources/create-new-secret-key.png differ diff --git a/docs/setup/resources/navigate-api-key-dashboard.png b/docs/setup/resources/navigate-api-key-dashboard.png index f42cb48..7b0d1bd 100644 Binary files a/docs/setup/resources/navigate-api-key-dashboard.png and b/docs/setup/resources/navigate-api-key-dashboard.png differ diff --git a/docs/setup/resources/saved-key.png b/docs/setup/resources/saved-key.png index 7ed28c7..87aaf88 100644 Binary files a/docs/setup/resources/saved-key.png and b/docs/setup/resources/saved-key.png differ diff --git a/docs/spec/sanitations.md b/docs/spec/sanitations.md index dcac153..27c739e 100644 --- a/docs/spec/sanitations.md +++ b/docs/spec/sanitations.md @@ -7,7 +7,8 @@ _Edition_: Swan Lake This document records the sanitation done on top of the official OpenAPI specification from OpenAI Finetune. The OpenAPI specification is obtained from the [OpenAPI specification for the OpenAI API](https://github.com/openai/openai-openapi/blob/master/openapi.yaml). These changes are implemented to enhance the overall usability and readability of the generated client. -1. **Changed the `status_details` property parameter of the `OpenAIFile` object**: +1. **Changed the `status_details` property parameter of the `OpenAIFile` object as a workaround for the issue https://github.com/ballerina-platform/ballerina-lang/issues/43304**: + - **Original**: - Deprecated: `true` - Nullable parameter: Not included @@ -16,8 +17,7 @@ This document records the sanitation done on top of the official OpenAPI specifi - Removed the `deprecated` parameter - Added the `nullable` parameter as `true` - - **Reasons**: The original configuration was generated successfully, but it caused a compile-time error. Updating the parameters resolved this error, enhancing the overall functionality and ensuring smooth compilation. - + - **Reasons**: The original configuration was generated successfully, but it caused a run-time error. 2. **Removed the `default:null` property from the following schemas**: - **Changed Schemas**: `CreateCompletionRequest`,`ChatCompletionStreamOptions`,`CreateChatCompletionRequest` @@ -28,16 +28,16 @@ This document records the sanitation done on top of the official OpenAPI specifi - **Updated**: - Removed the `default` parameter - - **Reason**: This change is done as a workaround for ballerina openapi tool not allowing to generate the client. + - **Reason**: This change is done as a temporary workaround until the Ballerina OpenAPI tool supports OpenAPI Specification version v3.1.x(Currently supported upto version 3.0.0) -3. **Removed the Required Field from the `Error` Property of `FineTuningJob` Object`** +3. **Removed the Required Field from the `Error` Property of `FineTuningJob` Object**: - **Original**: The error property of the FineTuningJob object included the code, message, and param as required. - **Updated**: Removed the required field from the error property. - **Reasons**: The response does not include the code, message, and param, causing an error of missing required fields when converting. -4. **Changed the response content type in `/files/{file_id}/content` endpoint** +4. **Changed the response content type in `/files/{file_id}/content` endpoint**: - **Original**: The response content type of the `/files/{file_id}/content` endpoint was originally `application/json`. - **Updated**: The content type has been changed to `application/octet-stream`. diff --git a/examples/README.md b/examples/README.md index 0f1d308..53b5c40 100644 --- a/examples/README.md +++ b/examples/README.md @@ -2,9 +2,9 @@ The `ballerinax/openai.finetunes` connector provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples), covering use cases like file uploading, finetuning models, getting events/checkpoints of a job and deleting files. -1. [Sarcastic Bot](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/Sarcastic-bot) - Fine-tune the GPT-3.5-turbo model to generate sarcastic responses +1. [Sarcastic Bot](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/sarcastic-bot) - Fine-tune the GPT-3.5-turbo model to generate sarcastic responses -2. [Sports Headline Analyzer](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/Sports-headline-analyzer) - Fine-tune the GPT-4o-mini model to extract structured information (player, team, sport, and gender) from sports headlines. +2. [Sports Headline Analyzer](https://github.com/ballerina-platform/module-ballerinax-openai.finetunes/tree/main/examples/sports-headline-analyzer) - Fine-tune the GPT-4o-mini model to extract structured information (player, team, sport, and gender) from sports headlines. ## Prerequisites diff --git a/examples/Sarcastic-bot/.github/README.md b/examples/sarcastic-bot/.github/README.md similarity index 100% rename from examples/Sarcastic-bot/.github/README.md rename to examples/sarcastic-bot/.github/README.md diff --git a/examples/Sarcastic-bot/Ballerina.toml b/examples/sarcastic-bot/Ballerina.toml similarity index 100% rename from examples/Sarcastic-bot/Ballerina.toml rename to examples/sarcastic-bot/Ballerina.toml diff --git a/examples/Sarcastic-bot/Sarcastic bot.md b/examples/sarcastic-bot/Sarcastic bot.md similarity index 100% rename from examples/Sarcastic-bot/Sarcastic bot.md rename to examples/sarcastic-bot/Sarcastic bot.md diff --git a/examples/Sarcastic-bot/data/training.jsonl b/examples/sarcastic-bot/data/training.jsonl similarity index 100% rename from examples/Sarcastic-bot/data/training.jsonl rename to examples/sarcastic-bot/data/training.jsonl diff --git a/examples/Sarcastic-bot/data/validation.jsonl b/examples/sarcastic-bot/data/validation.jsonl similarity index 100% rename from examples/Sarcastic-bot/data/validation.jsonl rename to examples/sarcastic-bot/data/validation.jsonl diff --git a/examples/Sarcastic-bot/main.bal b/examples/sarcastic-bot/main.bal similarity index 100% rename from examples/Sarcastic-bot/main.bal rename to examples/sarcastic-bot/main.bal diff --git a/examples/Sports-headline-analyzer/.github/README.md b/examples/sports-headline-analyzer/.github/README.md similarity index 100% rename from examples/Sports-headline-analyzer/.github/README.md rename to examples/sports-headline-analyzer/.github/README.md diff --git a/examples/Sports-headline-analyzer/Ballerina.toml b/examples/sports-headline-analyzer/Ballerina.toml similarity index 100% rename from examples/Sports-headline-analyzer/Ballerina.toml rename to examples/sports-headline-analyzer/Ballerina.toml diff --git a/examples/Sports-headline-analyzer/Sports headline analyzer.md b/examples/sports-headline-analyzer/Sports headline analyzer.md similarity index 100% rename from examples/Sports-headline-analyzer/Sports headline analyzer.md rename to examples/sports-headline-analyzer/Sports headline analyzer.md diff --git a/examples/Sports-headline-analyzer/data/training.jsonl b/examples/sports-headline-analyzer/data/training.jsonl similarity index 100% rename from examples/Sports-headline-analyzer/data/training.jsonl rename to examples/sports-headline-analyzer/data/training.jsonl diff --git a/examples/Sports-headline-analyzer/main.bal b/examples/sports-headline-analyzer/main.bal similarity index 100% rename from examples/Sports-headline-analyzer/main.bal rename to examples/sports-headline-analyzer/main.bal