From 34b064ca7a3e1cdb793fbd7698ea2eaae78bb586 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 29 May 2026 16:17:13 +0530 Subject: [PATCH] refactor: update embedding model configuration and improve agent usage in Create.php --- composer.lock | 12 ++++++------ docker-compose.yml | 2 +- .../Http/VectorsDB/Embeddings/Text/Create.php | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 2823faf618..1bdcb81140 100644 --- a/composer.lock +++ b/composer.lock @@ -3411,16 +3411,16 @@ }, { "name": "utopia-php/agents", - "version": "1.2.3", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/utopia-php/agents.git", - "reference": "47fb6282909fb8dfbb196f1a9834e4d858e41dcb" + "reference": "c9785833948639c09c8ccc3e954178c66ed9a896" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/agents/zipball/47fb6282909fb8dfbb196f1a9834e4d858e41dcb", - "reference": "47fb6282909fb8dfbb196f1a9834e4d858e41dcb", + "url": "https://api.github.com/repos/utopia-php/agents/zipball/c9785833948639c09c8ccc3e954178c66ed9a896", + "reference": "c9785833948639c09c8ccc3e954178c66ed9a896", "shasum": "" }, "require": { @@ -3458,9 +3458,9 @@ ], "support": { "issues": "https://github.com/utopia-php/agents/issues", - "source": "https://github.com/utopia-php/agents/tree/1.2.3" + "source": "https://github.com/utopia-php/agents/tree/1.2.4" }, - "time": "2026-05-28T11:22:16+00:00" + "time": "2026-05-29T10:44:54+00:00" }, { "name": "utopia-php/analytics", diff --git a/docker-compose.yml b/docker-compose.yml index 7f9ec55eb3..ccced2670d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1361,7 +1361,7 @@ services: appwrite-embedding: image: appwrite/embedding environment: - EMBEDDING_MODELS: "nomic" + EMBEDDING_MODELS: ${_APP_EMBEDDING_MODELS:-nomic} container_name: appwrite-embedding ports: - "11430:11434" 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 d71715b921..ea49709b3b 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,7 +87,6 @@ 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(); @@ -99,7 +98,7 @@ 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 = $adapter->bulkEmbed($batch); + $embedResult = $embeddingAgent->bulkEmbed($batch); $totalDuration += $embedResult['totalDuration'] ?? 0; $totalTokens += $embedResult['tokensProcessed'] ?? 0;