Skip to content

Commit

Permalink
fix: Fixed errors and warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed May 15, 2024
1 parent 7163a30 commit 1bf22ec
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/Providers/Anthropic/libs/Anthropic/AnthropicModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ private static Message ToMessage(MessageResponse message)
{
switch (message.Role)
{
case "user":
case RoleType.User:
return new Message(string.Join("\r\n", message.Content.Select(s => s is TextContent textContent ? textContent.Text : string.Empty)), MessageRole.Human);
case "assistant":
case RoleType.Assistant:
return new Message(string.Join("\r\n", message.Content.Select(s => s is TextContent textContent ? textContent.Text : string.Empty)), MessageRole.Ai);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Providers/LLamaSharp/src/LLamaSharpModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected LLamaSharpModelBase(LLamaSharpConfiguration configuration)
Threads = configuration.Threads,
BatchThreads = configuration.BatchThreads,
BatchSize = configuration.BatchSize,
EmbeddingMode = configuration.EmbeddingMode
Embeddings = configuration.EmbeddingMode,
};
Model = LLamaWeights.LoadFromFile(Parameters);
Configuration = configuration;
Expand Down
5 changes: 1 addition & 4 deletions src/Providers/OpenRouter/src/OpenRouterModelProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ public static ChatModels GetModelById(OpenRouterModelIds modelId)
[CLSCompliant(false)]
public static ChatModels GetModelById(string modelId)
{
var model = Models.Values.FirstOrDefault(s => s.Id == modelId);
if (model == null)
throw new KeyNotFoundException($"Model with ID {modelId} not found.");
return model;
return Models.Values.First(s => s.Id == modelId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ public static ChatModels GetModelById(OpenRouterModelIds modelId)
[CLSCompliant(false)]
public static ChatModels GetModelById(string modelId)
{
var model = Models.Values.FirstOrDefault(s => s.Id == modelId);
if (model == null)
throw new KeyNotFoundException($"Model with ID {modelId} not found.");
return model;
return Models.Values.First(s => s.Id == modelId);
}
}

0 comments on commit 1bf22ec

Please sign in to comment.