![]() |
VOOZH | about |
dotnet add package LangSharp --version 1.0.32
NuGet\Install-Package LangSharp -Version 1.0.32
<PackageReference Include="LangSharp" Version="1.0.32" />
<PackageVersion Include="LangSharp" Version="1.0.32" />Directory.Packages.props
<PackageReference Include="LangSharp" />Project file
paket add LangSharp --version 1.0.32
#r "nuget: LangSharp, 1.0.32"
#:package LangSharp@1.0.32
#addin nuget:?package=LangSharp&version=1.0.32Install as a Cake Addin
#tool nuget:?package=LangSharp&version=1.0.32Install as a Cake Tool
LangSharp SDK is a .NET 8 library that leverages Python.NET to communicate with AI providers, utilizing powerful Python resources such as LangChain. This SDK provides a robust framework for executing Python commands and scripts within a .NET environment, enabling seamless integration with various AI services.
LangSharp SDK is designed to bridge the gap between .NET applications and Python's extensive ecosystem of AI tools. By using Python.NET, this SDK allows .NET developers to harness the power of Python libraries such as LangChain, enabling advanced AI functionalities within their .NET applications.
dotnet add package LangSharp
Configure the LangSharp SDK using the builder pattern in your Program.cs:
using LangSharp.Core.Configuration;
using LangSharp.Core.Enums;
using LangSharp.MicrosoftExtensionsDI;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
// Building the SDK configuration using the LangSharpConfigurationBuilder
var sdkConfiguration = new LangSharpConfigurationBuilder()
.SetAIProvider(AIProviderType.LangChain)
.SetModel("gpt-4o-mini")
.SetApiKey("your-openai-api-key")
.SetDatabaseUri("your-database-uri") // Optional
.Build();
// Adding the services and the SDK configuration
builder.Services.AddLangSharp(sdkConfiguration);
var app = builder.Build();
app.Run();
To execute a database query using the LangSharp SDK, you can ask a question about the table:
using LangSharp.Core.Interfaces.Services;
var service = app.Services.GetService<ILangSharpService>();
string queryResult = await service.ExecuteDatabaseQuery("What are the names of all users in the users table?");
Console.WriteLine(queryResult);
To call an AI cloud service using the LangSharp SDK:
using LangSharp.Core.Interfaces.Services;
var service = app.Services.GetService<ILangSharpService>();
string aiResponse = await service.CallAIChat("What is the weather like today?");
Console.WriteLine(aiResponse);
To run the LangSharp SDK in a Docker container, ensure Python and required dependencies are properly configured. Below are examples for Linux and Windows containers.
Install Python 3.11.7:
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER root
WORKDIR /app
# Install Python 3.11 and dependencies
RUN apt update && \
apt install -y \
python3.11 \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
This project is licensed under the MIT License. See the file for more details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on LangSharp:
| Package | Downloads |
|---|---|
|
LangSharp.Examples.AspNetCore
Package Description |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.32 | 194 | 5/31/2025 |
| 1.0.31 | 143 | 5/31/2025 |
| 1.0.30 | 139 | 5/31/2025 |
| 1.0.29 | 142 | 5/31/2025 |
| 1.0.28 | 155 | 5/31/2025 |
| 1.0.27 | 221 | 5/29/2025 |
| 1.0.26 | 223 | 5/28/2025 |
| 1.0.25 | 216 | 5/28/2025 |
| 1.0.24 | 218 | 5/21/2025 |
| 1.0.23 | 212 | 5/21/2025 |
| 1.0.22 | 216 | 5/21/2025 |
| 1.0.21 | 207 | 5/21/2025 |
| 1.0.20 | 304 | 5/16/2025 |
| 1.0.18 | 305 | 5/13/2025 |
| 1.0.17 | 311 | 5/13/2025 |
| 1.0.16 | 273 | 5/12/2025 |
| 1.0.15 | 221 | 5/8/2025 |
| 1.0.14 | 226 | 5/2/2025 |
| 1.0.13 | 216 | 5/2/2025 |
| 1.0.12 | 226 | 5/2/2025 |