LangSmith 2.0.2-dev.40

This is a prerelease version of LangSmith.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package LangSmith --version 2.0.2-dev.40
                    
NuGet\Install-Package LangSmith -Version 2.0.2-dev.40
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LangSmith" Version="2.0.2-dev.40" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LangSmith" Version="2.0.2-dev.40" />
                    
Directory.Packages.props
<PackageReference Include="LangSmith" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LangSmith --version 2.0.2-dev.40
                    
#r "nuget: LangSmith, 2.0.2-dev.40"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LangSmith@2.0.2-dev.40
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LangSmith&version=2.0.2-dev.40&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=LangSmith&version=2.0.2-dev.40&prerelease
                    
Install as a Cake Tool

LangSmith SDK for .NET

Nuget package dotnet License: MIT Discord

Features 🔥

  • Fully generated C# SDK based on official OpenAPI specification using AutoSDK
  • Automatic releases of new preview versions if there was an update to the OpenAPI specification
  • All modern .NET features - nullability, trimming, NativeAOT, etc.
  • Support .Net Framework/.Net Standard 2.0

Usage

Initializing

using var client = new LangSmithClient();
using var openAiClient = new OpenAiClient();

client.JsonSerializerContext = new SpecialJsonSerializerContext(tryAGI.OpenAI.SourceGenerationContext.Default);

// This can be a user input to your app
var question = "Can you summarize this morning's meetings?";

// This can be retrieved in a retrieval step
const string context = "During this morning's meeting, we solved all world conflict.";
var messages = new[]
{
    "You are a helpful assistant. Please respond to the user's request only based on the given context."
        .AsSystemMessage(),
    $"Question: {question}\\nContext: {context}",
};

// Create parent run
var parentRunId = Guid.NewGuid();
await client.Run.CreateRunAsync(
    name: "Chat Pipeline",
    runType: CreateRunRequestRunType.Chain,
    id: parentRunId,
    inputs: new Dictionary<string, object>
    {
        ["question"] = question,
    });

// Create child run
var childRunId = Guid.NewGuid();
await client.Run.CreateRunAsync(
    name: "OpenAI Call",
    runType: CreateRunRequestRunType.Llm,
    id: childRunId,
    parentRunId: parentRunId,
    inputs: new Dictionary<string, object>
    {
        ["messages"] = messages,
    });

// Generate a completion
var chatCompletion = await openAiClient.Chat.CreateChatCompletionAsync(
    model: CreateChatCompletionRequestModel.Gpt35Turbo,
    messages: messages);

// End runs
await client.Run.UpdateRunAsync(
    runId: childRunId,
    outputs: new Dictionary<string, object>
    {
        ["chatCompletion"] = chatCompletion,
    },
    endTime: DateTime.UtcNow.ToString("O"));
await client.Run.UpdateRunAsync(
    runId: parentRunId,
    outputs: new Dictionary<string, object>
    {
        ["answer"] = chatCompletion.Choices[0].Message.Content ?? string.Empty,
    },
    endTime: DateTime.UtcNow.ToString("O"));

Create Dataset

using var client = GetAuthorizedClient();

var response = await client.Datasets.CreateDatasetAsync(name: "test3");
try
{
    var response2 = await client.Datasets.DeleteDatasetAsync(datasetId: response.Id);
}
catch (Exception e)
{
    Console.WriteLine(e);
}

Ok

using var client = GetAuthorizedClient();
var response = await client.OkAsync();

Trace

using var client = GetAuthorizedClient();
using var openAiClient = GetAuthorizedOpenAiClient();

client.JsonSerializerContext = new SpecialJsonSerializerContext(tryAGI.OpenAI.SourceGenerationContext.Default);

// This can be a user input to your app
var question = "Can you summarize this morning's meetings?";

// This can be retrieved in a retrieval step
const string context = "During this morning's meeting, we solved all world conflict.";
var messages = new[]
{
    "You are a helpful assistant. Please respond to the user's request only based on the given context."
        .AsSystemMessage(),
    $"Question: {question}\\nContext: {context}",
};

// Create parent run
// var parentRunId = Guid.NewGuid();
// await client.Run.CreateRunAsync(
//     name: "Chat Pipeline",
//     runType: CreateRunRequestRunType.Chain,
//     id: parentRunId,
//     inputs: new Dictionary<string, object>
//     {
//         ["question"] = question,
//     });
//
// // Create child run
// var childRunId = Guid.NewGuid();
// await client.Run.CreateRunAsync(
//     name: "OpenAI Call",
//     runType: CreateRunRequestRunType.Llm,
//     id: childRunId,
//     parentRunId: parentRunId,
//     inputs: new Dictionary<string, object>
//     {
//         ["messages"] = messages,
//     });

// Generate a completion
var chatCompletion = await openAiClient.Chat.CreateChatCompletionAsync(
    model: CreateChatCompletionRequestModel.Gpt35Turbo,
    messages: messages);

// End runs
// await client.Run.UpdateRunAsync(
//     runId: childRunId,
//     outputs: new Dictionary<string, object>
//     {
//         ["chatCompletion"] = chatCompletion,
//     },
//     endTime: DateTime.UtcNow.ToString("O"));
// await client.Run.UpdateRunAsync(
//     runId: parentRunId,
//     outputs: new Dictionary<string, object>
//     {
//         ["answer"] = chatCompletion.Choices[0].Message.Content ?? string.Empty,
//     },
//     endTime: DateTime.UtcNow.ToString("O"));

Support

Priority place for bugs: https://github.com/tryAGI/LangSmith/issues
Priority place for ideas and general questions: https://github.com/tryAGI/LangSmith/discussions
Discord: https://discord.gg/Ca2xhfBf3v

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.2-dev.43 34 5/21/2026
2.0.2-dev.42 31 5/21/2026
2.0.2-dev.40 31 5/21/2026
2.0.1 476 4/30/2026
2.0.1-dev.231 72 4/1/2026
2.0.1-dev.225 71 3/29/2026
2.0.1-dev.220 155 3/28/2026
2.0.1-dev.218 72 3/28/2026
2.0.1-dev.216 73 3/27/2026
2.0.1-dev.197 69 3/20/2026
2.0.1-dev.194 66 3/20/2026
2.0.1-dev.193 66 3/20/2026
2.0.1-dev.190 70 3/19/2026
2.0.1-dev.188 64 3/19/2026
2.0.1-dev.187 63 3/19/2026
2.0.1-dev.186 68 3/19/2026
2.0.1-dev.185 63 3/19/2026
2.0.1-dev.183 66 3/19/2026
2.0.1-dev.182 62 3/19/2026
2.0.1-dev.181 60 3/19/2026
Loading failed