MCPcopy Index your code
hub / github.com/abetlen/llama-cpp-python / format_open_orca

Function format_open_orca

llama_cpp/llama_chat_format.py:1267–1290  ·  view source on GitHub ↗
(
    messages: List[llama_types.ChatCompletionRequestMessage],
    **kwargs: Any,
)

Source from the content-addressed store, hash-verified

1265
1266@register_chat_format("open-orca")
1267def format_open_orca(
1268 messages: List[llama_types.ChatCompletionRequestMessage],
1269 **kwargs: Any,
1270) -> ChatFormatterResponse:
1271 system_template = "{system_message}"
1272 system_message = (
1273 "You are a helpful assistant. Please answer truthfully and write out your "
1274 "thinking step by step to be sure you get the right answer. If you make a mistake or encounter "
1275 "an error in your thinking, say so out loud and attempt to correct it. If you don't know or "
1276 "aren't sure about something, say so clearly. You will act as a professional logician, mathematician, "
1277 "and physicist. You will also act as the most appropriate type of expert to answer any particular "
1278 "question or solve the relevant problem; state which expert type your are, if so. Also think of "
1279 "any particular named expert that would be ideal to answer the relevant question or solve the "
1280 "relevant problem; name and act as them, if appropriate."
1281 )
1282 roles = ("User", "Assistant")
1283 sep = "<|end_of_turn|>\n"
1284 # stop_token_ids=[32000, 32001], # "<|end_of_turn|>"
1285 stop_str = "User"
1286 system_message = system_template.format(system_message=system_message)
1287 _messages = _map_roles(messages, dict(zip(roles, roles)))
1288 _messages.append((roles[1], None))
1289 _prompt = _format_add_colon_space_single(system_message, _messages, sep)
1290 return ChatFormatterResponse(prompt=_prompt, stop=stop_str)
1291
1292
1293@register_chat_format("mistrallite")

Callers

nothing calls this directly

Calls 5

_map_rolesFunction · 0.85
formatMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…