I am trying to use GPT-4 APIs for getting some responses. Using custom instructions we can set the personality of the model which it will consider when answering our questions. The custom instructions in ChatGPT are the same as ‘system’ role in APIs.
Everytime I make a request, I set this system prompt and using the following code:
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
)
Is there a way I can set this system prompt at once, and then in subsequent requests I can just sent the user content. I am expecting something like:
engine = openaiChatCompletion.set(
model="gpt-4",
system_content="You are a helpful assitant."
)
# and then use this engine to get the responses as
completion = engine.get_response(
{"role": "user", "content": "Hello!"}
)
Is there something that can help me achieve the same of do I have to set this custom instruction everytime I make a request?
Thank you for your time!