Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Agents/Agent.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,25 @@ public function embed(string $text): array

return $this->adapter->embed($text);
}

/**
* Get embeddings for a batch of input texts using underlying adapter (if supported)
*
* @param array<int, string> $texts
* @return array{
* embeddings: array<int, array<int, float>>,
* tokensProcessed: int|null,
* totalDuration: int|null,
* }
*
* @throws \Exception
*/
public function bulkEmbed(array $texts): array
{
if (! $this->adapter->getSupportForEmbeddings()) {
throw new \Exception('This adapter does not support embedding/embedding API.');
}

return $this->adapter->bulkEmbed($texts);
}
}
Loading