Azure OpenAI - set system message once and then call the endpoint in a loop for all user messages.

Pahul Hallan 0 Reputation points

Hello everyone,

I'm currently utilizing the Azure OpenAI service in the following way. I have a data frame where each "feedback" requires an API call. However, the current approach involves setting the system message for each individual call, which is not the most efficient method. I wonder if there's a way to set the system message just once and then send each feedback as a user role message.

I've been searching for documentation on this matter, but I haven't found clear guidance. Interestingly, I noticed that the Azure OpenAI Studio's chat playground employs a continuous system message that is reused for each interaction. If anyone could provide assistance or insight into achieving this efficiency, I would greatly appreciate it.


response = openai.ChatCompletion.create(engine="gpt35", messages=[{"role": "system", "content": system_prompt},                                                                               {"role": "user", "content": feedback}],                                                     temperature=0, max_tokens=800, top_p=0.95, frequency_penalty=0,                                                     presence_penalty=0, stop=None)
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
977 questions
{count} votes