Search code examples
openai-apiazure-openai

How to make Azure OpenAI Service use default system message in API calls?


I have created an Azure OpenAI Service and set a default system message. I want to create a chatbot by sending API calls to the endpoint and integrating it into an existing React App as a component.

My aim is to allow other team members to modify and fine tune the system message and examples. However, whenever I call the OpenAI Service through API Calls, I must always send the system message and examples with the request. It seems that the API responses disregard the system message unless I send it with the request.

I assumed that the default system message gets saved to the deployment and I would not have to send it on every request. Is there a way to configure the Azure OpenAI Service to always use the default system message that is configured in the Azure OpenAI Studio?


Solution

  • The current 'state of the art' does not support that, as it works on the basis of stateless interaction. What you can do is place a system prompt in a variable and include it in the OpenAI SDK call, or you can build a facade class around it. This makes it part of a class's default prompt, especially useful if you're leveraging it from multiple places, ensuring it's not 'forgotten'.