Multi-turn conversation best practice

Just append the chat history between the system and last user inquiry.

To put simply:

const messages = [
{ role: "system", content: "system prompt..." },
{ role: "assistant", content: "..."},
{ role: "user", content: "..."},
{ role: "assistant", content: "..."},
...
{ role: "user", content: "user inquiry..."}
]
1 Like