Skip to content

Commit

Permalink
Add ignoreCase parameter to ToLLamaSharpChatHistory extension method
Browse files Browse the repository at this point in the history
  • Loading branch information
kidkych committed Nov 11, 2023
1 parent 1b4659d commit aa5e1ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions LLama.SemanticKernel/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace LLamaSharp.SemanticKernel;

public static class ExtensionMethods
{
public static global::LLama.Common.ChatHistory ToLLamaSharpChatHistory(this ChatHistory chatHistory)
public static global::LLama.Common.ChatHistory ToLLamaSharpChatHistory(this ChatHistory chatHistory, bool ignoreCase = true)
{
if (chatHistory is null)
{
Expand All @@ -16,7 +16,7 @@ public static class ExtensionMethods

foreach (var chat in chatHistory)
{
var role = Enum.TryParse<global::LLama.Common.AuthorRole>(chat.Role.Label, true, out var _role) ? _role : global::LLama.Common.AuthorRole.Unknown;
var role = Enum.TryParse<global::LLama.Common.AuthorRole>(chat.Role.Label, ignoreCase, out var _role) ? _role : global::LLama.Common.AuthorRole.Unknown;
history.AddMessage(role, chat.Content);
}

Expand Down

0 comments on commit aa5e1ad

Please sign in to comment.