| 281 | return max(self.cfg.text_length, length) |
| 282 | |
| 283 | def completion(self, prompt: str, generation_config: GenerationConfig, |
| 284 | is_print_speed: bool = True) -> ModelResponse: |
| 285 | log_generation_config(generation_config) |
| 286 | |
| 287 | output = self.__get_model_response( |
| 288 | self.model, |
| 289 | self.tokenizer, |
| 290 | prompt, |
| 291 | self.cfg.model_version, |
| 292 | generation_config, |
| 293 | is_print_speed) |
| 294 | |
| 295 | return output |
| 296 | |
| 297 | def completion_stream(self, messages: list[dict[str, str]], generation_config: GenerationConfig, |
| 298 | is_print_speed: bool = True) -> ModelResponse: |