From 6e1894b5ee6a40acb00eb047b3a4a13cbd345669 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Fri, 12 Sep 2025 12:39:31 +0200 Subject: [PATCH] [Store] Support `\Stringable` in `VectorizerInterface::vectorize` --- src/store/src/Document/Vectorizer.php | 6 +++--- src/store/src/Document/VectorizerInterface.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/store/src/Document/Vectorizer.php b/src/store/src/Document/Vectorizer.php index 01792f024..c212e91ff 100644 --- a/src/store/src/Document/Vectorizer.php +++ b/src/store/src/Document/Vectorizer.php @@ -67,11 +67,11 @@ public function vectorizeTextDocuments(array $documents): array return $vectorDocuments; } - public function vectorize(string $string): Vector + public function vectorize(string|\Stringable $string): Vector { - $this->logger->debug('Vectorizing string', ['string' => $string]); + $this->logger->debug('Vectorizing string', ['string' => (string) $string]); - $result = $this->platform->invoke($this->model, $string); + $result = $this->platform->invoke($this->model, (string) $string); $vectors = $result->asVectors(); if (!isset($vectors[0])) { diff --git a/src/store/src/Document/VectorizerInterface.php b/src/store/src/Document/VectorizerInterface.php index 21d144236..375472d63 100644 --- a/src/store/src/Document/VectorizerInterface.php +++ b/src/store/src/Document/VectorizerInterface.php @@ -29,7 +29,7 @@ interface VectorizerInterface public function vectorizeTextDocuments(array $documents): array; /** - * Vectorizes a single string into a Vector. + * Vectorizes a single string or Stringable object into a Vector. */ - public function vectorize(string $string): Vector; + public function vectorize(string|\Stringable $string): Vector; }