Skip to content

Commit

Permalink
Merge pull request #15 from G5andeepD/post-review-corrections
Browse files Browse the repository at this point in the history
Post review corrections
  • Loading branch information
NipunaRanasinghe authored Aug 21, 2024
2 parents f998bc8 + 3f485de commit 6cf8a9e
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 31 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ import ballerinax/openai.images;
Create a `images:ConnectionConfig` with the obtained API Key and initialize the connector.

```ballerina
configurable string apiKey = ?;
configurable string token= ?;
final images:Client openAIImages = check new ({
auth: {
token: apiKey
token
}
});
```
Expand Down
4 changes: 2 additions & 2 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ import ballerinax/openai.images;
Create a `images:ConnectionConfig` with the obtained API Key and initialize the connector.

```ballerina
configurable string apiKey = ?;
configurable string token = ?;
final images:Client openAIImages = check new ({
auth: {
token: apiKey
token
}
});
```
Expand Down
4 changes: 2 additions & 2 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ import ballerinax/openai.images;
Create a `images:ConnectionConfig` with the obtained API Key and initialize the connector.

```ballerina
configurable string apiKey = ?;
configurable string token = ?;
final images:Client openAIImages = check new ({
auth: {
token: apiKey
token
}
});
```
Expand Down
2 changes: 1 addition & 1 deletion ballerina/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Create a `Config.toml` file in the `tests` directory and add your authentication

```toml
isLiveServer = true
apiKey = "<your-openAI-api-key>"
token = "<your-openAI-api-key>"
```

### Using Environment Variables
Expand Down
4 changes: 2 additions & 2 deletions ballerina/tests/tests.bal
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import ballerina/os;
import ballerina/test;

configurable boolean isLiveServer = os:getEnv("IS_LIVE_SERVER") == "true";
configurable string apiKey = isLiveServer ? os:getEnv("OPENAI_API_KEY") : "test";
configurable string token = isLiveServer ? os:getEnv("OPENAI_API_KEY") : "test";
configurable string serviceUrl = isLiveServer ? "https://api.openai.com/v1" : "http://localhost:9090";

ConnectionConfig config = {
auth: {
token: apiKey
token
}
};

Expand Down
Binary file modified docs/setup/resources/api-key-dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/setup/resources/create-new-secret-key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/setup/resources/navigate-api-key-dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/setup/resources/saved-key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/spec/sanitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ 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)

2. **Removed the `nullable: true` property of the field `n` from the below schemas**

Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To get started, you'll need to have an OpenAI account and obtain an API key. Ref
Create a `Config.toml` file in the example's root directory and provide your OpenAI account-related configurations as follows:

```toml
apiKey = "<Your OpenAI API Key>"
token = "<Your OpenAI API Key>"
```

## Running an example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To get started, you'll need to have an OpenAI account and obtain an API key. Ref
Create a `Config.toml` file in the example's root directory and provide your OpenAI account-related configurations as follows:

```toml
apiKey = "<Your OpenAI API Key>"
token = "<Your OpenAI API Key>"
```

## Run the example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To get started, you'll need to have an OpenAI account and obtain an API key. Ref
Create a `Config.toml` file in the example's root directory and provide your OpenAI account-related configurations as follows:

```toml
apiKey = "<Your OpenAI API Key>"
token = "<Your OpenAI API Key>"
```

## Run the example
Expand Down
15 changes: 7 additions & 8 deletions examples/personalized-visual-content-generator/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@ import ballerina/io;
import ballerina/mime;
import ballerinax/openai.images;

configurable string apiKey = ?;

// Initialize the OpenAI Images client with your API key
final images:Client openaiClient = check new ({
auth: {
token: apiKey
}
});
configurable string token = ?;

public function main() returns error? {
// Initialize the OpenAI Images client with your API key
final images:Client openaiClient = check new ({
auth: {
token
}
});

io:println("Generating an image using the OpenAI API...");
// Generate a base image using the `images/generation` API
Expand Down
2 changes: 1 addition & 1 deletion examples/rapid-product-visualizer/.github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To get started, you'll need to have an OpenAI account and obtain an API key. Ref
Create a `Config.toml` file in the example's root directory and provide your OpenAI account-related configurations as follows:

```toml
apiKey = "<Your OpenAI API Key>"
token = "<Your OpenAI API Key>"
```

## Run the example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To get started, you'll need to have an OpenAI account and obtain an API key. Ref
Create a `Config.toml` file in the example's root directory and provide your OpenAI account-related configurations as follows:

```toml
apiKey = "<Your OpenAI API Key>"
token = "<Your OpenAI API Key>"
```

## Run the example
Expand Down
16 changes: 8 additions & 8 deletions examples/rapid-product-visualizer/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ import ballerina/io;
import ballerina/mime;
import ballerinax/openai.images;

configurable string apiKey = ?;

// Initialize the OpenAI Images client with your API key
final images:Client openaiClient = check new ({
auth: {
token: apiKey
}
});
configurable string token = ?;

public function main() returns error? {

// Initialize the OpenAI Images client with your API key
final images:Client openaiClient = check new ({
auth: {
token
}
});

io:println("Generating a product image using the OpenAI API...");
// Generate a base product image using the `images/generation` API
string generationPrompt = "a sleek and modern smartphone with a curved screen and minimalist design";
Expand Down

0 comments on commit 6cf8a9e

Please sign in to comment.