From 1f38fe578bc954f76453587642f0b53db0dd8605 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 29 May 2026 16:22:42 +0530 Subject: [PATCH] refactor: initialize adapter in action method and remove TODO comment --- .../Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php index ea49709b3b..41fafd8460 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php @@ -87,6 +87,7 @@ class Create extends CreateDocumentAction public function action(array $texts, string $model, UtopiaResponse $response, Document $project, Agent $embeddingAgent, Context $usage, Log $log, ?Logger $logger): void { + $adapter = $embeddingAgent->getAdapter(); $adapter->setModel($model); $dimension = $adapter->getEmbeddingDimension(); @@ -97,7 +98,6 @@ class Create extends CreateDocumentAction foreach (array_chunk($texts, APP_EMBEDDING_BATCH_LIMIT) as $batch) { try { - // TODO: Have the interface in the agents lib itself $embedResult = $embeddingAgent->bulkEmbed($batch); $totalDuration += $embedResult['totalDuration'] ?? 0; $totalTokens += $embedResult['tokensProcessed'] ?? 0;