semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

fix issue 508

Open feiyun0112 opened this issue 2 years ago • 2 comments

Motivation and Context

fix issue #508

Description

WebSearch Results using the Bing Connector has a hard code value of count=1.

We need to return more than 1 result or should be able to pass count of result requested

Contribution Checklist

The code builds clean without any errors or warnings The PR follows SK Contribution Guidelines (https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) The code follows the .NET coding conventions (https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions) verified with dotnet format All unit tests pass, and I have added new tests where possible I didn't break anyone 😄

feiyun0112 avatar Apr 20 '23 04:04 feiyun0112

Instead of

string resultString;
if (countInt == 1)
{
    resultString = results.FirstOrDefault() ?? string.Empty;
}
else
{
    resultString = JsonSerializer.Serialize(results);
}

return resultString;

you could do something like

return countInt == 1
    ? results.FirstOrDefault() ?? string.Empty
    : JsonSerializer.Serialize(results);

MovGP0 avatar Apr 21 '23 13:04 MovGP0

LGTM - please resolve conflicts and we'll bring it in.

adrianwyatt avatar Apr 25 '23 16:04 adrianwyatt

Merged from main, updated Google connector too, as common interface changes require it.

shawncal avatar May 06 '23 05:05 shawncal

Do you have new nuget package for this fix. I downloaded the code locally and trying to run it from a console app adding local references and it is giving me build code.

Tbablani avatar May 08 '23 17:05 Tbablani

trying to test this through a console app. As latest Nuget is not available for this issue. Adding local project references to the DLL. It is not working . Getting errors when trying to run it.

Tbablani avatar May 08 '23 17:05 Tbablani