Skip to content

Commit

Permalink
Remove Laravel dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
gehrisandro committed Dec 5, 2023
1 parent 561c624 commit b31e48c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"require-dev": {
"guzzlehttp/guzzle": "^7.8.0",
"guzzlehttp/psr7": "^2.6.1",
"illuminate/contracts": "^9.0|^10.0",
"laravel/pint": "^1.13.6",
"mockery/mockery": "^1.6.6",
"nunomaduro/collision": "^7.10.0",
Expand Down
3 changes: 1 addition & 2 deletions src/Events/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

namespace OpenAI\Events;

use Illuminate\Contracts\Events\Dispatcher as LaravelDispatcher;
use OpenAI\Contracts\DispatcherContract;
use Psr\EventDispatcher\EventDispatcherInterface;

class Dispatcher implements DispatcherContract
{
public function __construct(
private readonly LaravelDispatcher|EventDispatcherInterface|null $events
private readonly ?EventDispatcherInterface $events
) {
}

Expand Down
5 changes: 2 additions & 3 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Exception;
use GuzzleHttp\Client as GuzzleClient;
use Http\Discovery\Psr18ClientDiscovery;
use Illuminate\Contracts\Events\Dispatcher as LaravelDispatcher;
use OpenAI\Events\Dispatcher;
use OpenAI\Transporters\HttpTransporter;
use OpenAI\ValueObjects\ApiKey;
Expand Down Expand Up @@ -57,7 +56,7 @@ final class Factory

private ?Closure $streamHandler = null;

private LaravelDispatcher|EventDispatcherInterface|null $events = null;
private ?EventDispatcherInterface $events = null;

/**
* Sets the API key for the requests.
Expand Down Expand Up @@ -134,7 +133,7 @@ public function withQueryParam(string $name, string $value): self
/**
* Set the event dispatcher instance.
*/
public function withEventDispatcher(LaravelDispatcher|EventDispatcherInterface $events): self
public function withEventDispatcher(EventDispatcherInterface $events): self
{
$this->events = $events;

Expand Down
1 change: 0 additions & 1 deletion tests/Arch.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
'Http\Discovery\Psr17Factory',
'Http\Discovery\Psr18ClientDiscovery',
'Http\Message\MultipartStream\MultipartStreamBuilder',
'Illuminate\Contracts\Events\Dispatcher',
'OpenAI\Contracts',
'OpenAI\Resources',
'Psr\EventDispatcher\EventDispatcherInterface',
Expand Down

0 comments on commit b31e48c

Please sign in to comment.