Skip to content

Commit

Permalink
Merge pull request #274 from kidkych/master
Browse files Browse the repository at this point in the history
Update ToLLamaSharpChatHistory extension method to be public and support semantic-kernel author roles
  • Loading branch information
AsakusaRinne authored Nov 11, 2023
2 parents c62e27e + aa5e1ad commit c2be012
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions LLama.SemanticKernel/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace LLamaSharp.SemanticKernel;

internal static class ExtensionMethods
public static class ExtensionMethods
{
internal 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 @@ internal static class ExtensionMethods

foreach (var chat in chatHistory)
{
var role = Enum.TryParse<global::LLama.Common.AuthorRole>(chat.Role.Label, 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 c2be012

Please sign in to comment.