Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

400 Bad Request Errors When Using Cognitive Search (AzureSearchChatData) #15

Open
scotwoodyard-csulb opened this issue Sep 19, 2024 · 2 comments

Comments

@scotwoodyard-csulb
Copy link

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ x] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Configure AzureSearchChatData source. Ask a question that returns information from a search. Ask a follow up question,

Any log messages given by the failure

The error message is "Status: 400 (Bad Request)". I have attached a transcript file with more details.

Expected/desired behavior

The follow up question would return chat completion results.

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful

The previous iteration of the project works as expected.


Thanks! We'll be in touch soon.
transcripts.txt

@scotwoodyard-csulb
Copy link
Author

Here is a code snippet from Startup.cs:

            if (configuration.GetValue("AZURE_SEARCH_API_ENDPOINT", "") != "")
            {
                services.AddSingleton(new AzureSearchChatDataSource()
                {
                    Endpoint = new Uri(configuration.GetValue<string>("AZURE_SEARCH_API_ENDPOINT")),
                    IndexName = configuration.GetValue<string>("AZURE_SEARCH_INDEX"),
                    Authentication = DataSourceAuthentication.FromApiKey(configuration.GetValue<string>("AZURE_SEARCH_API_KEY")),
                });
            }

I am injecting that into SemanctiKernelBot.cs:

        private readonly string _instructions;
        private readonly string _welcomeMessage;
        private readonly string _endpoint;
        private readonly string _deployment;
        private readonly AzureSearchChatDataSource _chatDataSource;
        private readonly string _apiKey;
        private readonly CanvasApiClient _canvasDataService;

        public SemanticKernelBot(IConfiguration config, ConversationState conversationState, UserState userState, AzureOpenAIClient aoaiClient, AzureSearchChatDataSource chatDataSource, CanvasApiClient canvasDataService, T dialog)
            : base(config, conversationState, userState, dialog)
        {
            _instructions = config["LLM_INSTRUCTIONS"];
            _welcomeMessage = config.GetValue("LLM_WELCOME_MESSAGE", "Hello and welcome to the Semantic Kernel Bot Dotnet!");
            _endpoint = config["AZURE_OPENAI_API_ENDPOINT"];
            _deployment = config["AZURE_OPENAI_DEPLOYMENT_NAME"];
            _apiKey = config["AZURE_OPENAI_API_KEY"];
            _chatDataSource = chatDataSource;
            _canvasDataService = canvasDataService;
        }

I am configuring the chat completion options like so:

            // Define prompt execution settings
            var promptExecutionSettings = new AzureOpenAIPromptExecutionSettings()
            {
                AzureChatDataSource = _chatDataSource,
                ToolCallBehavior = ToolCallBehavior.AutoInvokeKernelFunctions
            };

I've also noticed that plugins (i.e. the wikipedia plugin) are no longer responding.

@MarcoABCardoso
Copy link
Contributor

@scotwoodyard-csulb thank you for reporting!

Just dropping a comment here that this regression is confirmed - we had removed all API Key usage from the repository, and keyless auth is not yet supported by Semantic Kernel with Azure AI Search.

We've since added an explicit option to use API Keys instead of identities to support this type of scenarios, as well as users who might be limited to Contributor access. I'll work on updating the Semantic Kernel implementations to support this.

Until then, please continue to use the old version to use the Semantic Kernel bot. I expect this fix to be out by next week.
Thanks again for your support and please let us know if you have any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants