Azure OpenAI ChatGPT returns incorrect date

I have the following code written in blazor .net 8. i am using “gpt-35-turbo” in Azure OpenAI
whenever i ask a question like “What date is today?”
ChatGPT answer Today is October 15, 2021.
firstly i was expecting that it will respond with ‘I don’t know’, but instead it returned incorrect date.
on other instance it returns Today is [current date]

Question: why is it returning incoreect information ? How can i prevent it ?

kernel = Kernel.CreateBuilder()
     .AddAzureOpenAIChatCompletion(aoaiModel, aoaiEndpoint, aoaiApiKey)
      .Build();

 const string skPrompt = @"
 ChatBot can have a conversation with you about any topic.
 It can give explicit instructions or say 'I don't know' if it does not have an answer.
 Please do not guess or make up information.
 {{$history}}
 User: {{$userInput}}
 Assitant:";

 var executionSettings = new OpenAIPromptExecutionSettings
 {
     MaxTokens = 2000, //lgenth of the ressponse
     Temperature = 0.0, //variation in response, higher the value, more variation you will get
     TopP = 0.5, //reduce likely hood of strange word choices
     FrequencyPenalty = 0.0,
     PresencePenalty=0.5,
     ToolCallBehavior = ToolCallBehavior.AutoInvokeKernelFunctions, //let AI find out which plugin to invoke
   
 };

   
 chatFunction = kernel.CreateFunctionFromPrompt(skPrompt, executionSettings);

in the button click event, i have the following code.

  // Get chat response
  var chatResult = kernel.InvokeStreamingAsync<StreamingChatMessageContent>(
      chatFunction!,
          new() {
                  { "userInput", model.InputValue },
                  { "history", string.Join("\n", history.Select(x => x.Role + ": " + x.Content)) }
              }
      );


  string message = "";
  await foreach (var chunk in chatResult)
  {
      if (chunk.Role.HasValue) Console.Write(chunk.Role + " > ");
      message += chunk;
      answer = message;
      StateHasChanged();
      Console.Write(chunk);
  }
 
  // Append to history
  history.AddUserMessage(model.InputValue!);
  history.AddAssistantMessage(message);

Leave a Comment