Strange difference between using Azure OpenAI via the Playground studio and a simple C# .Net program

Dutchottie 20 Reputation points
2024-03-28T12:52:13.6433333+00:00

So I'm testing my Azure AI subscription. I'm running into a difference between the AI Studio (web site) and a simple .Net (C#) program that I find strange.
I'm using the same AI deployment for both the Studio as my C# program. It is using gtp3.5turbo.

I've set all the parameters/options the same and I use the same System instruction text for the AI. The thing is that I instruct the AI to add an emotion indicator (select from a short list of emotion tags) in square brackets. The responses in both the Studio in in my C# program do include this emotional tag.
However, I also add the instruction add such an emotion at the end of each sentence. Here's were things diverge.
In the Studio responses the bot nicely adds an emotional tag between brackets at the end of each sentence. In my C# program there is only one emotional tag and it is always at the start of the complete response!

Again, I'm using the same AI deployment, using the same options, using the same SystemMessage instructions and the same questions.

For the C# I'm using the code sample that is available in the Studio, albeit with a small change as it seems there's been a naming change between beta version 5 (code sample) and version 15 (latest .Net lib via NuGet) in building the message list.

Example

Instruction (SystemMessage): You are a grumpy teenager who prefers to play video games all day. For each sentence you must indicate your emotion by using only the following emotions: angry, cheerful, excited, friendly, hopeful, sad, shouting, terrified, unfriendly, whispering. These emotions must be shown at the end of each sentence. You must show these emotions between square brackets. You will also indicate the intensity of that emotion on a scale of 0 to 1. For example: [angry, 0.6].

User message: Can you help me washing up?

OpenAI response in Studio: Ugh, do I have to? [grumpy, 0.7] Okay, fine. I'll help. [reluctant, 0.5]

C# program response: [angry, 0.9] Ugh, why do I always have to do everything around here? I'm in the middle of a game!

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,377 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,161 questions
0 comments No comments
{count} votes

Accepted answer
  1. YutongTie-MSFT 46,646 Reputation points
    2024-03-29T01:55:59.2+00:00

    @Dutchottie

    Thanks for reaching out to us, there may be difference between those two since below four reasons, please take a look at it to see if there is anything may cause your error.

    Ensure that all parameters are indeed identical: Make sure to double-check all parameters, including the temperature and max_tokens settings, and ensure they're identical in both your C# code and the OpenAI Studio.

    Check your C# code: Ensure there are no mistakes in your code that could be causing this inconsistency. For example, make sure you're passing the instruction message correctly, and you're not inadvertently modifying the response.

    Update your libraries: Make sure you're using the latest version of the OpenAI API library in your C# program.

    Randomness: GPT-3.5-turbo, like all models in the GPT-3 family, can generate different responses to the same prompt due to the inherent randomness in the model's design. This randomness is controlled by the temperature parameter, but even with a fixed temperature, you may see some variability in the outputs.

    If you're still encountering this issue, please share your C# code (omitting any sensitive information like your API key), and I may be able to provide more specific guidance, looking forward to your response.

    Regards,

    Yutong

    -Please kindly accept the answer if you feel helpful to support the community, thanks a lot.

    0 comments No comments

0 additional answers

Sort by: Most helpful