in src/fmeval/model_runners/extractors/jumpstart_extractor.py [0:0]
def extract_embedding(self, data: Union[List, Dict], num_records: int = 1) -> List[float]:
"""
Extracts the embedding from the JumpStartModel response. This only supported for text embedding models.
:param data: The model response from the JumpStart Model
:param num_records: The number of records in the model response. Must be 1.
"""
assert num_records == 1, "Jumpstart extractor does not support batch requests"
try:
assert self._embedding_compiler, f"Unable to extract embedding from Jumpstart model: {self._model_id}"
output = self._embedding_compiler.search(data)
if output is None and not isinstance(output, str):
raise EvalAlgorithmClientError(f"Unable to extract embedding from Jumpstart model: {self._model_id}")
return output
except ValueError as e:
raise EvalAlgorithmClientError(f"Unable to extract embedding from Jumpstart model: {self._model_id}", e)