Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Use an environment variable by default to help guide users towards a …
Browse files Browse the repository at this point in the history
…"secure by default" configuration
  • Loading branch information
om4james committed Oct 31, 2022
1 parent 9c7d426 commit 80b87dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ use Tectalic\OpenAi\Client;
use Tectalic\OpenAi\Manager;

// Build a Tectalic OpenAI REST API Client globally.
$auth = new Authentication('token');
$auth = new Authentication(getenv('OPENAI_API_KEY'));
$httpClient = new Psr18Client();
Manager::build($httpClient, $auth);

// or

// Build a Tectalic OpenAI REST API Client manually.
$auth = new Authentication('token');
$auth = new Authentication(getenv('OPENAI_API_KEY'));
$httpClient = new Psr18Client();
$client = new Client($httpClient, $auth, Manager::BASE_URI);
```
Expand All @@ -61,7 +61,7 @@ Authentication to the **OpenAI API** is by HTTP Bearer authentication.

Please see the OpenAI API documentation for more details on obtaining your authentication credentials.

In the **Usage** code above, customize the `Authentication` constructor to your needs. For example, you may wish to define your credentials in an environment variable and pass it to the constructor.
In the **Usage** code above, customize the `Authentication` constructor to your needs. For example, will likely need to add a `OPENAI_API_KEY` environment variable to your system.

### Client Class

Expand Down

0 comments on commit 80b87dc

Please sign in to comment.