Skip to content

Commit f8363ea

Browse files
authored
KnowPRO.NET Bug fixes (#1774)
* AI Client not sending temperature * Fixed bug in Lookup filtering
1 parent e79255a commit f8363ea

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

dotnet/typeagent/examples/knowProConsole/TestCommands.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ private async Task AnswerAsync(ParseResult args)
407407
}
408408
if (namedArgs.Get<bool>("debug"))
409409
{
410-
var searchResults = await conversation.SearchAsync(query);
410+
LangSearchDebugContext? debugContext = new LangSearchDebugContext();
411+
var searchResults = await conversation.SearchAsync(query, null, null, debugContext);
412+
KnowProWriter.WriteLine(ConsoleColor.Green, debugContext.ToJson());
411413
foreach (var searchResult in searchResults)
412414
{
413415
AnswerContext context = await AnswerContext.FromSearchResultAsync(conversation, searchResult);

dotnet/typeagent/src/aiclient/OpenAIChatModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ CancellationToken cancellationToken
5858
var request = Create(prompt, format);
5959
if (translationSettings is not null)
6060
{
61-
if (translationSettings.Temperature > 0)
61+
if (translationSettings.Temperature >= 0)
6262
{
6363
request.temperature = translationSettings.Temperature;
6464
}

dotnet/typeagent/src/knowpro/Lang/LangSearchDebugContext.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ public class LangSearchDebugContext
1515

1616
// Indicates per expression whether similarity fallback was used
1717
public List<bool>? UsedSimilarityFallback { get; set; }
18+
19+
public string ToJson()
20+
{
21+
return Serializer.ToJsonIndented(this);
22+
}
1823
}

dotnet/typeagent/src/knowpro/Query/LookupExtensions.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ internal static class LookupExtensions
4545
scoreBooster
4646
).ConfigureAwait(false);
4747

48-
return filtered ?? scoredOrdinals;
48+
return filtered;
4949
}
5050

5151
public static async ValueTask<IList<ScoredSemanticRefOrdinal>?> FilterAsync(
@@ -81,8 +81,9 @@ internal static class LookupExtensions
8181
scoredOrdinals[i] = scoreBooster(semanticRef, scoredOrdinal);
8282
}
8383
}
84-
return filtered ?? scoredOrdinals;
85-
84+
return (filter is not null)
85+
? filtered
86+
: scoredOrdinals;
8687
}
8788

8889
public static ValueTask<IList<ScoredSemanticRefOrdinal>?> LookupTermAsync(

0 commit comments

Comments
 (0)