File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ public function __construct(
3939 string $ model = self ::MODEL_EMBEDDING_GEMMA ,
4040 int $ timeout = 90
4141 ) {
42+ if (! in_array ($ model , self ::MODELS , true )) {
43+ throw new \InvalidArgumentException ("Invalid model: {$ model }. Supported models: " .implode (', ' , self ::MODELS ));
44+ }
45+
4246 $ this ->model = $ model ;
4347 $ this ->setTimeout ($ timeout );
4448 }
@@ -123,6 +127,9 @@ public function getEmbeddingDimension(): int
123127 */
124128 public function setModel (string $ model ): self
125129 {
130+ if (! in_array ($ model , self ::MODELS , true )) {
131+ throw new \InvalidArgumentException ("Invalid model: {$ model }. Supported models: " .implode (', ' , self ::MODELS ));
132+ }
126133 $ this ->model = $ model ;
127134
128135 return $ this ;
You can’t perform that action at this time.
0 commit comments