Skip to content

Commit 10973f6

Browse files
added agent interface
1 parent 5aad21b commit 10973f6

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/Agents/Agent.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,26 @@ public function embed(string $text): array
131131

132132
return $this->adapter->embed($text);
133133
}
134+
135+
/**
136+
* Get embeddings for a batch of input texts using underlying adapter (if supported)
137+
*
138+
* @param array<int, string> $texts
139+
*
140+
* @return array{
141+
* embeddings: array<int, array<int, float>>,
142+
* tokensProcessed: int|null,
143+
* totalDuration: int|null,
144+
* }
145+
*
146+
* @throws \Exception
147+
*/
148+
public function bulkEmbed(array $texts): array
149+
{
150+
if (! $this->adapter->getSupportForEmbeddings()) {
151+
throw new \Exception('This adapter does not support embedding/embedding API.');
152+
}
153+
154+
return $this->adapter->bulkEmbed($texts);
155+
}
134156
}

0 commit comments

Comments
 (0)