refactor: update embedding model configuration and improve agent usage in Create.php

This commit is contained in:
ArnabChatterjee20k committed 2026-05-29 16:17:13 +05:30
1 parent 91b6babd0f
commit 34b064ca7a
3 files changed
+8 -9

No files matched your search

Generated
+6 -6
View File
@@ -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",
+1 -1
View File
@@ -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"
@@ -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;