forked from phoenix-oss/llama-stack-mirror
Fix test infra, sentence embeddings mixin
This commit is contained in:
parent
182608d4bf
commit
e7d261ef4a
4 changed files with 12 additions and 34 deletions
|
@ -14,6 +14,7 @@ from llama_stack.apis.inference import (
|
|||
ModelStore,
|
||||
TextTruncation,
|
||||
)
|
||||
from llama_stack.providers.utils.inference.prompt_adapter import interleaved_content_as_str
|
||||
|
||||
EMBEDDING_MODELS = {}
|
||||
|
||||
|
@ -34,7 +35,7 @@ class SentenceTransformerEmbeddingMixin:
|
|||
) -> EmbeddingsResponse:
|
||||
model = await self.model_store.get_model(model_id)
|
||||
embedding_model = self._load_sentence_transformer_model(model.provider_resource_id)
|
||||
embeddings = embedding_model.encode(contents)
|
||||
embeddings = embedding_model.encode([interleaved_content_as_str(content) for content in contents])
|
||||
return EmbeddingsResponse(embeddings=embeddings)
|
||||
|
||||
def _load_sentence_transformer_model(self, model: str) -> "SentenceTransformer":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue