Skip to content

Commit

Permalink
120: Added empty library for langfuse integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jarmatys committed Dec 18, 2024
1 parent 64298a9 commit da270ad
Show file tree
Hide file tree
Showing 17 changed files with 4,927 additions and 5 deletions.
5 changes: 4 additions & 1 deletion API/ASSISTENTE.API/ApiSettings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using ASSISTENTE.Client.Internal.Settings;
using ASSISTENTE.Infrastructure.Embeddings.Settings;
using ASSISTENTE.Infrastructure.Firecrawl.Settings;
using ASSISTENTE.Infrastructure.Langfuse.Settings;
using ASSISTENTE.Infrastructure.LLM.Settings;
using ASSISTENTE.Infrastructure.Qdrant.Settings;
using ASSISTENTE.Module;
Expand All @@ -17,7 +18,8 @@ internal sealed class ApiSettings :
ISeqSettings,
IRabbitSettings,
IObservabilitySettings,
IAuthenticationSettings
IAuthenticationSettings,
ILangfuseSettings
{
public required InternalApiSettings InternalApi { get; init; }
public required SeqSettings Seq { get; init; }
Expand All @@ -29,4 +31,5 @@ internal sealed class ApiSettings :
public required ObservabilitySettings Observability { get; init; }
public required AuthenticationSettings Authentication { get; init; }
public required FirecrawlSettings Firecrawl { get; init; }
public required LangfuseSettings Langfuse { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SOFTURE.Results" Version="0.1.1" />
<PackageReference Include="SOFTURE.Settings" Version="0.1.1" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="ASSISTENTE.Infrastructure"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using CSharpFunctionalExtensions;

namespace ASSISTENTE.Infrastructure.Langfuse.Contracts;

public interface ILangfuseService
{
Task<Result> CreateIngestionAsync();
}
24 changes: 24 additions & 0 deletions API/ASSISTENTE.Infrastructure.Langfuse/DependencyInjection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using ASSISTENTE.Infrastructure.Langfuse.Contracts;
using ASSISTENTE.Infrastructure.Langfuse.Settings;
using Microsoft.Extensions.DependencyInjection;

namespace ASSISTENTE.Infrastructure.Langfuse
{
internal static class DependencyInjection
{
public static IServiceCollection AddLangfuse<TSettings>(this IServiceCollection services)
where TSettings : ILangfuseSettings
{
// services.AddSingleton<[CLIENT]>(serviceProvider =>
// {
// var langfuseSettings = serviceProvider.GetRequiredService<TSettings>().Langfuse;
//
// return [CLIENT]
// });

services.AddScoped<ILangfuseService, LangfuseService>();

return services;
}
}
}
12 changes: 12 additions & 0 deletions API/ASSISTENTE.Infrastructure.Langfuse/LangfuseService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using ASSISTENTE.Infrastructure.Langfuse.Contracts;
using CSharpFunctionalExtensions;

namespace ASSISTENTE.Infrastructure.Langfuse;

internal sealed class LangfuseService() : ILangfuseService
{
public async Task<Result> CreateIngestionAsync()

Check warning on line 8 in API/ASSISTENTE.Infrastructure.Langfuse/LangfuseService.cs

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 8 in API/ASSISTENTE.Infrastructure.Langfuse/LangfuseService.cs

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
return Result.Success();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace ASSISTENTE.Infrastructure.Langfuse.Settings;

public interface ILangfuseSettings
{
LangfuseSettings Langfuse { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ASSISTENTE.Infrastructure.Langfuse.Settings;

public sealed class LangfuseSettings
{
public required string SecretKey { get; init; }
public required string PublicKey { get; init; }
public required string Host { get; init; }
}
Loading

0 comments on commit da270ad

Please sign in to comment.