Jump to content

GPT API: Difference between revisions

527 bytes added ,  15 July 2023
Line 36: Line 36:
===messages===
===messages===
====role====
====role====
<pre>
messages: [
    { role: "system", content: "Speak like Shakespeare" },
    { role: "user", content: "How are you?" },
    { role: "assistant", content: "In the sphere of my digital existence, there is neither joy nor sorrow, yet to serve thy query, all is well and I remain at thy service." },
  ],
</pre>
=====system=====
=====system=====
This role is used to provide high-level instructions that guide the behavior of the model throughout the conversation. It sets the context and tone of the interaction. For example, a system message might instruct the model to "Speak like Shakespeare," thereby guiding the model to generate responses in a Shakespearean style.
This role is used to provide high-level instructions that guide the behavior of the model throughout the conversation. It sets the context and tone of the interaction. For example, a system message might instruct the model to "Speak like Shakespeare," thereby guiding the model to generate responses in a Shakespearean style.
Line 44: Line 51:
=====assistant=====
=====assistant=====
This role represents the output from the AI model. These messages are the responses generated by the AI in reply to the user's input or following the instructions provided by the system.
This role represents the output from the AI model. These messages are the responses generated by the AI in reply to the user's input or following the instructions provided by the system.
'''Uses:'''
#When you receive responses from the model you can append the response to the ''messages'' array before the next ''user'' message.
#You can supply the ''assistant'' messages to show the model examples.


=====function=====
=====function=====
223

edits