zborek.LangfuseDotnet
0.0.1
test message
See the version list below for details.
dotnet add package zborek.LangfuseDotnet --version 0.0.1
NuGet\Install-Package zborek.LangfuseDotnet -Version 0.0.1
<PackageReference Include="zborek.LangfuseDotnet" Version="0.0.1" />
<PackageVersion Include="zborek.LangfuseDotnet" Version="0.0.1" />
<PackageReference Include="zborek.LangfuseDotnet" />
paket add zborek.LangfuseDotnet --version 0.0.1
#r "nuget: zborek.LangfuseDotnet, 0.0.1"
#:package zborek.LangfuseDotnet@0.0.1
#addin nuget:?package=zborek.LangfuseDotnet&version=0.0.1
#tool nuget:?package=zborek.LangfuseDotnet&version=0.0.1
WORK IN PROGRESS
Langfuse Example Web API
This repository contains library for Langfuse in .net
In default behaviour, application add background service for sending logs to Langfuse. You can disable it by setting SendLogs
to false
in appsettings.json
.
{
"Langfuse": {
"SendLogs": false
}
}
Getting Started
Usage in Your Project
Inject LangfuseClient
into your service and use it to send events to Langfuse.
For creating trace events use LangfuseTrace
. Use can inject it into your service or create it.
You can use methods for creating observations:
var trace = new LangfuseTrace("traceName", TimeProvider.System);
var span = trace.CreateSpan("GetDataFromDb");
var generation = trace.CreateGeneration("DbGeneration");
var event = trace.CreateEvent("DbEvent");
// or use from created span
var eventFromSpan = span.CreateEvent("DbEvent");
Logs can be viewed on https://cloud.langfuse.com/ or on local hosted Langfuse.
Examples
Clone the repository:
git clone https://github.com/your-repo/langfuse-example-webapi.git cd langfuse-example-webapi
Set api key in
appsettings.json
:{ "Langfuse": { "PublicKey": "", "SecretKey": "" }, "OpenAI": { "ApiKey": "" } }
Restore dependencies:
dotnet restore
Running the Application
Build the project:
dotnet build
Run the project:
dotnet run --project Examples/Langfuse.Example.WebApi
API Endpoints
POST /chat
: Processes a chat request and returns a response.POST /chatDi
: Processes a chat request with dependency injection and returns a response.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Configuration (>= 9.0.1)
- Microsoft.Extensions.DependencyInjection (>= 9.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.1)
- Microsoft.Extensions.Http (>= 9.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.1)
-
net9.0
- Microsoft.Extensions.Configuration (>= 9.0.1)
- Microsoft.Extensions.DependencyInjection (>= 9.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.1)
- Microsoft.Extensions.Http (>= 9.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.