1212namespace Symfony \AI \Platform \Bridge \Azure \OpenAI ;
1313
1414use Symfony \AI \Platform \Bridge \OpenAI \Embeddings ;
15+ use Symfony \AI \Platform \Exception \InvalidArgumentException ;
1516use Symfony \AI \Platform \Model ;
1617use Symfony \AI \Platform \ModelClientInterface ;
1718use Symfony \Component \HttpClient \EventSourceHttpClient ;
1819use Symfony \Contracts \HttpClient \HttpClientInterface ;
1920use Symfony \Contracts \HttpClient \ResponseInterface ;
20- use Webmozart \Assert \Assert ;
2121
2222/**
2323 * @author Christopher Hertel <mail@christopher-hertel.de>
@@ -34,11 +34,11 @@ public function __construct(
3434 #[\SensitiveParameter] private string $ apiKey ,
3535 ) {
3636 $ this ->httpClient = $ httpClient instanceof EventSourceHttpClient ? $ httpClient : new EventSourceHttpClient ($ httpClient );
37- Assert:: notStartsWith ( $ baseUrl , 'http:// ' , 'The base URL must not contain the protocol. ' );
38- Assert:: notStartsWith ( $ baseUrl , 'https:// ' , 'The base URL must not contain the protocol. ' );
39- Assert:: stringNotEmpty ( $ deployment, 'The deployment must not be empty. ' );
40- Assert:: stringNotEmpty ( $ apiVersion, 'The API version must not be empty. ' );
41- Assert:: stringNotEmpty ( $ apiKey, 'The API key must not be empty. ' );
37+ ! str_starts_with ( $ this -> baseUrl , 'http:// ' ) || throw new InvalidArgumentException ( 'The base URL must not contain the protocol. ' );
38+ ! str_starts_with ( $ this -> baseUrl , 'https:// ' ) || throw new InvalidArgumentException ( 'The base URL must not contain the protocol. ' );
39+ '' !== $ deployment || throw new InvalidArgumentException ( 'The deployment must not be empty. ' );
40+ '' !== $ apiVersion || throw new InvalidArgumentException ( 'The API version must not be empty. ' );
41+ '' !== $ apiKey || throw new InvalidArgumentException ( 'The API key must not be empty. ' );
4242 }
4343
4444 public function supports (Model $ model ): bool
0 commit comments