ai-utils.js
Version:
Build AI applications, chatbots, and agents with JavaScript and TypeScript.
22 lines (21 loc) • 524 B
JavaScript
export const OpenAIChatMessage = {
system(content) {
return { role: "system", content };
},
user(content) {
return { role: "user", content };
},
assistant(content) {
return { role: "assistant", content };
},
functionCall(content, functionCall) {
return {
role: "assistant",
content,
function_call: functionCall,
};
},
functionResult(name, content) {
return { role: "function", name, content };
},
};