implement embedding generation in supported inference providers

This commit is contained in:
Dinesh Yeduguru 2024-12-09 12:48:56 -08:00
parent b896be2311
commit e167e9eb93
16 changed files with 383 additions and 29 deletions

View file

@ -253,4 +253,9 @@ class TogetherInferenceAdapter(
model_id: str,
contents: List[InterleavedTextMedia],
) -> EmbeddingsResponse:
raise NotImplementedError()
model = await self.model_store.get_model(model_id)
r = self._get_client().embeddings.create(
model=model.provider_resource_id, input=contents
)
embeddings = [item.embedding for item in r.data]
return EmbeddingsResponse(embeddings=embeddings)