diff --git a/griptape/artifacts/text_artifact.py b/griptape/artifacts/text_artifact.py index 7a3b62e3b..da8a7cd9a 100644 --- a/griptape/artifacts/text_artifact.py +++ b/griptape/artifacts/text_artifact.py @@ -31,11 +31,12 @@ def to_bytes(self) -> bytes: return str(self.value).encode(encoding=self.encoding, errors=self.encoding_error_handler) def generate_embedding(self, driver: BaseEmbeddingDriver) -> list[float]: + embedding = driver.embed_string(str(self.value)) + if self.embedding is None: self.embedding = [] - self.embedding.clear() - self.embedding.extend(driver.embed_string(str(self.value))) + self.embedding.extend(embedding) return self.embedding