Skip to content

Commit

Permalink
SQLite extension method for DI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
TesAnti committed Apr 12, 2024
1 parent 170418f commit 4bba2ce
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Databases/Sqlite/src/LangChain.Databases.Sqlite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite.Core" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Microsoft.SemanticKernel.Connectors.Memory.Sqlite" />
</ItemGroup>

Expand Down
17 changes: 17 additions & 0 deletions src/Databases/Sqlite/src/ServeExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
using LangChain.Serve.Abstractions;
using Microsoft.Extensions.DependencyInjection;

namespace LangChain.Databases.Sqlite
{
public static class ServeExtensions
{
public static IServiceCollection AddSQLiteConversationRepository(this IServiceCollection services, string connectionString)
{
services.AddSingleton<IConversationRepository>(new SQLiteConversationRepository(connectionString));
return services;
}
}
}

0 comments on commit 4bba2ce

Please sign in to comment.