Skip to content

Commit eac5146

Browse files
committed
refactor: simplifies Tool::fromArray
1 parent 5bef6fb commit eac5146

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Tools/DTO/Tool.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,13 @@ public static function fromArray(array $array): Tool
183183
return FunctionDeclaration::fromArray($declarationData);
184184
}, $declarationsData);
185185
return new self($declarations);
186-
} elseif ($type->isWebSearch()) {
186+
} else {
187+
// Web search is the only remaining option
187188
if (!isset($array['webSearch'])) {
188189
throw new \InvalidArgumentException('Web search tool requires webSearch field.');
189190
}
190191
$webSearchData = $array['webSearch'];
191192
return new self(WebSearch::fromArray($webSearchData));
192193
}
193-
194-
throw new \InvalidArgumentException(sprintf('Unknown tool type: %s', $array['type']));
195194
}
196195
}

0 commit comments

Comments
 (0)