mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
refactor: initialize adapter in action method and remove TODO comment
This commit is contained in:
1 parent
34b064ca7a
commit
1f38fe578b
1 file changed
+1
-1
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user