Skip to content

Commit

Permalink
Merge pull request #1 from MarcelloDuarte/1.0.4-hotfix
Browse files Browse the repository at this point in the history
Fix documentation and setting of openai api key
  • Loading branch information
MarcelloDuarte authored Sep 24, 2024
2 parents 0749a26 + 04059ba commit f7196e2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Update your `phpspec.yml` file:
```yaml
extensions:
Md\PhpSpecIntelligenceExtension\Extension:
openai_api_key: OPENAI_API_KEY
openai_api_key: ~
openai_api_model: "gpt-3.5-turbo"
openai_api_temperature: 0.7
openai_api_max_tokens: 256
Expand Down
2 changes: 1 addition & 1 deletion phpspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ suites:

extensions:
Md\PhpSpecIntelligenceExtension\Extension:
openai_api_key: YOUR_OPENAI_API_KEY
openai_api_key: ~
openai_api_model: "gpt-3.5-turbo"
openai_api_temperature: 0.7
openai_api_max_tokens: 256
3 changes: 2 additions & 1 deletion src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public function load(ServiceContainer $container, array $params)
{
$container->define('console.commands.next', function ($c) use ($params) {
$config = [
'openai_api_key' => $params['openai_api_key'] ?? getenv("OPENAI_API_KEY") ?? null,
'openai_api_key' => $params['openai_api_key'] ??
(getenv("OPENAI_API_KEY") !== false ? getenv("OPENAI_API_KEY") : null),
'openai_api_model' => $params['openai_api_model'] ?? 'gpt-3.5-turbo',
'openai_api_temperature' => $params['openai_api_temperature'] ?? 0.7,
'openai_api_max_tokens' => $params['openai_api_max_tokens'] ?? 256
Expand Down

0 comments on commit f7196e2

Please sign in to comment.