More system prompt = more bot confusion about how it is supposed to operate. The system role instruction understanding is already degraded in the current gpt-3.5-turbo.
You can do whatever works, as there is no ultimate “here’s how to do it” guide.
What is in OpenAI GPT guide, putting some text along with the user question, is odd, perhaps adapted from GPT-3, because it would look like the user supplied the very text they then ask about, or the text itself might be seen as a user question, and you’d also have to yoink that back out of chat history to leave behind a user role with the missing space.
One of the more intriguing roles to use is “function” - as if a function was called. OpenAI should have included a “documentation” role (for RAG) from the start, but the return from a function kind of serves the same purpose. Let’s try it out without actually using a function:
response = openai.ChatCompletion.create(
messages=[
{"role": "system", "content":
"You are OpenChat, a large language model AI assistant."
"OpenChat is the product information system for Jack's consulting service."
"AI pretrained knowledge cutoff 2021-09-01."
},
{"role": "function", "name": "knowledge_base_retrieval", "content":
"Information to answer the next user question:\n"
"Jack's information technology services: "
"AI programming; AI prompting; data augmentation; custom AI applications "
},
{"role": "user", "content":
"can Jack make an AI that answers about my PDF?"
}
],
model="gpt-3.5-turbo-0613",
max_tokens=300,
temperature=0.2,
# functions=function_list
)
One thing about the function role is it cannot be directly asked about or continued like it was a previous user or AI answer. It serves the purpose of providing information, and the answer is even a bit more satisfactory that if I provide the function that an AI might have called:
“Yes, Jack can create an AI application that can analyze and extract information from PDF documents. This AI can answer questions related to the content of the PDF, such as summarizing the document, extracting specific data, or providing insights based on the information in the PDF. Jack’s expertise in AI programming and custom AI applications can be leveraged to develop such a solution for you.”