Files
wehub-resource-sync bbfc60cd69
Publish BFCL to PyPI / build_and_publish (push) Has been cancelled
Update API Zoo Data / send-updates (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:37:27 +08:00

32 lines
1011 B
Python

from bfcl_eval.model_handler.local_inference.base_oss_handler import OSSHandler
from overrides import override
class MiniCPMHandler(OSSHandler):
def __init__(
self,
model_name,
temperature,
registry_name,
is_fc_model,
dtype="bfloat16",
**kwargs,
) -> None:
super().__init__(model_name, temperature, registry_name, is_fc_model, **kwargs)
@override
def _format_prompt(self, messages, function):
"""
"chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}"
"""
formatted_prompt = ""
for message in messages:
formatted_prompt += (
f"<|im_start|>{message['role']}\n{message['content']}<|im_end|>\n"
)
formatted_prompt += f"<|im_start|>assistant\n"
return formatted_prompt