MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / GPTChatFormatToPhind

Function GPTChatFormatToPhind

lib/queryLLM.ts:416–436  ·  view source on GitHub ↗
(chatMessages: ChatGPTMessage[])

Source from the content-addressed store, hash-verified

414}
415
416export function GPTChatFormatToPhind(chatMessages: ChatGPTMessage[]): string {
417 const roleToName = {
418 system: "System Prompt",
419 user: "User Message",
420 assistant: "Assistant",
421 function: "Function: ",
422 };
423 return `${chatMessages
424 .map(
425 (message) => `
426### ${roleToName[message.role]}${
427 message.role === "function" ? " " + message.name : ""
428 }
429${message.content}`,
430 )
431 .join("\n")}${
432 chatMessages[chatMessages.length - 1].role !== "assistant"
433 ? "\n### Assistant\n"
434 : ""
435 }`;
436}
437
438export function GPTChatFormatToClaudeInstant(
439 chatMessages: ChatGPTMessage[],

Callers 1

getLLMRequestChatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected