MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / common_chat_tool_choice_parse_oaicompat

Function common_chat_tool_choice_parse_oaicompat

smallthinker/common/chat.cpp:145–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143};
144
145common_chat_tool_choice common_chat_tool_choice_parse_oaicompat(const std::string & tool_choice) {
146 if (tool_choice == "auto") {
147 return COMMON_CHAT_TOOL_CHOICE_AUTO;
148 }
149 if (tool_choice == "none") {
150 return COMMON_CHAT_TOOL_CHOICE_NONE;
151 }
152 if (tool_choice == "required") {
153 return COMMON_CHAT_TOOL_CHOICE_REQUIRED;
154 }
155 throw std::runtime_error("Invalid tool_choice: " + tool_choice);
156}
157
158template <>
159std::vector<common_chat_msg> common_chat_msgs_parse_oaicompat(const json & messages) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected