(
self,
input: EmbedderInputType,
model_kwargs: Optional[Dict] = {},
)
| 705 | return output |
| 706 | |
| 707 | async def acall( |
| 708 | self, |
| 709 | input: EmbedderInputType, |
| 710 | model_kwargs: Optional[Dict] = {}, |
| 711 | ) -> EmbedderOutputType: |
| 712 | log.debug(f"Calling {self.__class__.__name__} with input: {input}") |
| 713 | api_kwargs = self.model_client.convert_inputs_to_api_kwargs( |
| 714 | input=input, |
| 715 | model_kwargs=self._compose_model_kwargs(**model_kwargs), |
| 716 | model_type=self.model_type, |
| 717 | ) |
| 718 | output: EmbedderOutputType = None |
| 719 | try: |
| 720 | response = await self.model_client.acall( |
| 721 | api_kwargs=api_kwargs, model_type=self.model_type |
| 722 | ) |
| 723 | output = self.model_client.parse_embedding_response(response) |
| 724 | except Exception as e: |
| 725 | log.error(f"Error calling the DashScope model: {e}") |
| 726 | output = EmbedderOutput(error=str(e)) |
| 727 | |
| 728 | output.input = [input] if isinstance(input, str) else input |
| 729 | log.debug(f"Output from {self.__class__.__name__}: {output}") |
| 730 | return output |
| 731 | |
| 732 | def _compose_model_kwargs(self, **model_kwargs) -> Dict[str, object]: |
| 733 | return F.compose_model_kwargs(self.model_kwargs, model_kwargs) |
nothing calls this directly
no test coverage detected