Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/110-dotnet-anthropic/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.KernelMemory.DocumentStorage.DevTools;
using Microsoft.KernelMemory.MemoryStorage.DevTools;

var anthropicConfig = new AnthropicConfiguration();
var anthropicConfig = new AnthropicConfig();
var azureOpenAIEmbeddingConfig = new AzureOpenAIConfig();

new ConfigurationBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.KernelMemory.AI.Anthropic;
/// <summary>
/// Configuration for Text Generation with Anthropic
/// </summary>
public class AnthropicConfiguration
public class AnthropicConfig
{
/// <summary>
/// Anthropic web service endpoint
Expand Down
2 changes: 1 addition & 1 deletion extensions/Anthropic/AnthropicTextGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public sealed class AnthropicTextGeneration : ITextGenerator, IDisposable
/// <param name="httpClientFactory">Optional factory used to inject a pre-configured HTTP client for requests to Anthropic API</param>
/// <param name="loggerFactory">Optional factory used to inject configured loggers</param>
public AnthropicTextGeneration(
AnthropicConfiguration config,
AnthropicConfig config,
ITextTokenizer? textTokenizer = null,
IHttpClientFactory? httpClientFactory = null,
ILoggerFactory? loggerFactory = null)
Expand Down
4 changes: 2 additions & 2 deletions extensions/Anthropic/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static partial class KernelMemoryBuilderExtensions
/// <param name="textTokenizer">Optional tokenizer, default one will be used if passed null.</param>
public static IKernelMemoryBuilder WithAnthropicTextGeneration(
this IKernelMemoryBuilder builder,
AnthropicConfiguration config,
AnthropicConfig config,
ITextTokenizer? textTokenizer = null)
{
builder.Services.AddAnthropicTextGeneration(config, textTokenizer);
Expand All @@ -44,7 +44,7 @@ public static partial class DependencyInjection
/// <param name="textTokenizer">Tokenizer to measure content size</param>
public static IServiceCollection AddAnthropicTextGeneration(
this IServiceCollection services,
AnthropicConfiguration config,
AnthropicConfig config,
ITextTokenizer? textTokenizer = null)
{
services.AddSingleton(config);
Expand Down
12 changes: 6 additions & 6 deletions service/Core/SemanticKernel/KernelMemoryBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ public static partial class KernelMemoryBuilderExtensions
/// <param name="builder">KM builder</param>
/// <param name="service">SK text generation service instance</param>
/// <param name="config">SK text generator settings</param>
/// <param name="tokenizer">Tokenizer used to count tokens used by prompts</param>
/// <param name="textTokenizer">Tokenizer used to count tokens used by prompts</param>
/// <param name="loggerFactory">.NET logger factory</param>
/// <returns>KM builder</returns>
public static IKernelMemoryBuilder WithSemanticKernelTextGenerationService(
this IKernelMemoryBuilder builder,
ITextGenerationService service,
SemanticKernelConfig config,
ITextTokenizer? tokenizer = null,
ITextTokenizer? textTokenizer = null,
ILoggerFactory? loggerFactory = null)
{
if (service == null) { throw new ConfigurationException("Memory Builder: the semantic kernel text generation service instance is NULL"); }

return builder.AddSingleton<ITextGenerator>(new SemanticKernelTextGenerator(service, config, tokenizer, loggerFactory));
return builder.AddSingleton<ITextGenerator>(new SemanticKernelTextGenerator(service, config, textTokenizer, loggerFactory));
}

/// <summary>
Expand All @@ -44,21 +44,21 @@ public static IKernelMemoryBuilder WithSemanticKernelTextGenerationService(
/// <param name="builder">KM builder</param>
/// <param name="service">SK text embedding generation instance</param>
/// <param name="config">SK text embedding generator settings</param>
/// <param name="tokenizer">Tokenizer used to count tokens sent to the embedding generator</param>
/// <param name="textTokenizer">Tokenizer used to count tokens sent to the embedding generator</param>
/// <param name="loggerFactory">.NET logger factory</param>
/// <param name="onlyForRetrieval">Whether to use this embedding generator only during data ingestion, and not for retrieval (search and ask API)</param>
/// <returns>KM builder</returns>
public static IKernelMemoryBuilder WithSemanticKernelTextEmbeddingGenerationService(
this IKernelMemoryBuilder builder,
ITextEmbeddingGenerationService service,
SemanticKernelConfig config,
ITextTokenizer? tokenizer = null,
ITextTokenizer? textTokenizer = null,
ILoggerFactory? loggerFactory = null,
bool onlyForRetrieval = false)
{
if (service == null) { throw new ConfigurationException("Memory Builder: the semantic kernel text embedding generation service instance is NULL"); }

var generator = new SemanticKernelTextEmbeddingGenerator(service, config, tokenizer, loggerFactory);
var generator = new SemanticKernelTextEmbeddingGenerator(service, config, textTokenizer, loggerFactory);
builder.AddSingleton<ITextEmbeddingGenerator>(generator);

if (!onlyForRetrieval)
Expand Down
2 changes: 1 addition & 1 deletion service/Service/ServiceConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ private void ConfigureTextGenerator(IKernelMemoryBuilder builder)
break;

case string x when x.Equals("Anthropic", StringComparison.OrdinalIgnoreCase):
builder.Services.AddAnthropicTextGeneration(this.GetServiceConfig<AnthropicConfiguration>("Anthropic"));
builder.Services.AddAnthropicTextGeneration(this.GetServiceConfig<AnthropicConfig>("Anthropic"));
break;

case string x when x.Equals("LlamaSharp", StringComparison.OrdinalIgnoreCase):
Expand Down