Closed RockChinQ closed 1 year ago
if message["role"] == "system": formatted_messages.append(f"system: {message['content']}\n") elif message["role"] == "user": formatted_messages.append(f"user: {message['content']}\n") elif message["role"] == "assistant" and message.get("function_call"): formatted_messages.append(f"assistant: {message['function_call']}\n") elif message["role"] == "assistant" and not message.get("function_call"): formatted_messages.append(f"assistant: {message['content']}\n") elif message["role"] == "function": formatted_messages.append(f"function ({message['name']}): {message['content']}\n")
https://github.com/openai/openai-cookbook/blob/main/examples/How_to_call_functions_with_chat_models.ipynb
https://github.com/openai/openai-cookbook/blob/main/examples/How_to_call_functions_with_chat_models.ipynb