(
self,
*,
messages: List[ChatCompletionRequestMessage],
media_marker: Optional[str] = None,
functions: Optional[List[ChatTemplateFunctionDefinition]] = None,
function_call: Optional[Union[str, ChatTemplateFunctionCall]] = None,
tools: Optional[List[ChatTemplateTool]] = None,
tool_choice: Optional[Union[str, ChatTemplateToolChoice]] = None,
reasoning_effort: Optional[str] = None,
add_generation_prompt: bool,
strftime_now: Callable[[str], str],
)
| 3644 | return converted |
| 3645 | |
| 3646 | def _render( |
| 3647 | self, |
| 3648 | *, |
| 3649 | messages: List[ChatCompletionRequestMessage], |
| 3650 | media_marker: Optional[str] = None, |
| 3651 | functions: Optional[List[ChatTemplateFunctionDefinition]] = None, |
| 3652 | function_call: Optional[Union[str, ChatTemplateFunctionCall]] = None, |
| 3653 | tools: Optional[List[ChatTemplateTool]] = None, |
| 3654 | tool_choice: Optional[Union[str, ChatTemplateToolChoice]] = None, |
| 3655 | reasoning_effort: Optional[str] = None, |
| 3656 | add_generation_prompt: bool, |
| 3657 | strftime_now: Callable[[str], str], |
| 3658 | ) -> str: |
| 3659 | def raise_exception(message: str) -> None: |
| 3660 | raise ValueError(message) |
| 3661 | |
| 3662 | return cast( |
| 3663 | str, |
| 3664 | self._template.render( |
| 3665 | messages=self._messages_for_template(messages, media_marker), |
| 3666 | eos_token=self._eos_token, |
| 3667 | bos_token=self._bos_token, |
| 3668 | raise_exception=raise_exception, |
| 3669 | add_generation_prompt=add_generation_prompt, |
| 3670 | functions=functions, |
| 3671 | function_call=function_call, |
| 3672 | tools=tools, |
| 3673 | tool_choice=tool_choice, |
| 3674 | reasoning_effort=reasoning_effort, |
| 3675 | strftime_now=strftime_now, |
| 3676 | ), |
| 3677 | ) |
| 3678 | |
| 3679 | def format( |
| 3680 | self, |
no test coverage detected