#AutGen DotNet - Always creates an Inner Agent of AutoGen.OpenAI.GPTAgent

1 messages · Page 1 of 1 (latest)

orchid cedar
#

Playing about with AutoGen and Azure OpenAI. I am going through the very simple example from here: https://microsoft.github.io/autogen-for-net/articles/Create-an-agent.html

Every time I post a message I get the following error: No Content.

Looking at the payload it is 100% not send the content with the request: enter image description here

I just don't know why.

Any hints?

sour violet
#

Can you share the complete code and call stack information

orchid cedar
#

Code:

#

AzureOpenAIConfig _config = new AzureOpenAIConfig(
@"https://xxxxxx.openai.azure.com/",
"gpt-35-turbo",
"REPLACED");

var aiAssistant= new AssistantAgent(
name: "assistant",
systemMessage: @"You are an assistant that help user to do some tasks.
You specialise in property within the UK and have been working in the industry for 20 years.
You have a friendly and professional communication style",
llmConfig: new ConversableAgentConfig
{
Temperature = 0,
ConfigList = [ _config]
});

    if (!string.IsNullOrWhiteSpace(newMessage))
    {

        //Get question
        UpdateChatLog(Role.User, newMessage);

        //ask question
        var reply = await aiAssistant.SendAsync(newMessage);

        UpdateChatLog(Role.Assistant, reply.GetContent());
    }
orchid cedar
#

It seems to null the messages when they try to concat in the systest message

sour violet
#

@orchid cedar The code looks fine to me, I even try the following example and it also works


using AutoGen;
using AutoGen.BasicSample;
using AutoGen.Core;

/// <summary>
/// This example shows the basic usage of <see cref="ConversableAgent"/> class.
/// </summary>
public static class Example_AssistantAgent
{
    public static async Task RunAsync()
    {
        var gpt35 = LLMConfiguration.GetAzureOpenAIGPT3_5_Turbo();
        var config = new ConversableAgentConfig
        {
            Temperature = 0,
            ConfigList = [gpt35],
        };

        // create assistant agent
        var aiAssistant = new AssistantAgent(
            name: "assistant",
            systemMessage: @"You are an assistant that help user to do some tasks. 
                            You specialise in property within the UK and have been working in the industry for 20 years.
                            You have a friendly and professional communication style",
            llmConfig: config);

        var newMessage = "hey";
        if (!string.IsNullOrWhiteSpace(newMessage))
        {
            //ask question
            var reply = await aiAssistant.SendAsync(newMessage);
        }
    }
}
#

Can you maybe create an issue on github and create a minimal reproducable sample?

orchid cedar
#

One thing to note, is I am trying to run this code from within a Blazor app, so maybe that is causing it to have a funny turn?

sour violet
#

Shouldn’t be the case if you call agents in the similar way in example. Are you using a customized message type?

orchid cedar
#

No I am not using customized types. What is odd I took the code and placed it in a console app and it worked.

#

When i try in Blazor web assembly I get the following error message: * 'Invalid value for 'content': expected a string, got null.\nStatus: 400 (Bad Request)\n\nContent:\n{\n "error": {\n "message": "Invalid value for 'content': expected a string, got null.",\n "type": "invalid_request_error",\n "param": "messages.[0].content",\n "code": null\n }\n}\n\n\nHeaders:\napim-request-id: REDACTED\nContent-Length: 188\nContent-Type: application/json\n'*

orchid cedar
#

So I am now pretty sure this relates to using autoGen within a Blazor Web Assembly application. When I try it using a Blazor Server app it functionsa as expected. How odd. I suspect this is something to do the way Blazore and .net render on the client side

sour violet
sour violet