Set custom instructions once and then use it automatically for subsequent messages

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(
    {"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(
  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!

1 Like

System prompt needs to be sent every time. There’s no prompt storage sort of thing. But you can certainly wrap the API calls with your own logic to handle this easily.

@novaphil Thank you for the information. Understood.