JevDotNet 0.9.2
See the version list below for details.
dotnet add package JevDotNet --version 0.9.2
NuGet\Install-Package JevDotNet -Version 0.9.2
<PackageReference Include="JevDotNet" Version="0.9.2" />
<PackageVersion Include="JevDotNet" Version="0.9.2" />
<PackageReference Include="JevDotNet" />
paket add JevDotNet --version 0.9.2
#r "nuget: JevDotNet, 0.9.2"
#:package JevDotNet@0.9.2
#addin nuget:?package=JevDotNet&version=0.9.2
#tool nuget:?package=JevDotNet&version=0.9.2
JevDotNet
JevDotNet is an opinionated, convention-based .NET client for the TypeSafe AI Jev API. It turns Jev Choice, Score, and Noul answers into a strongly typed result object.
Start with the wiki's implementation walkthrough, then use its guides to build your return object and work with each Jev type.
YouTube video how to use
Installation
JevDotNet is available on NuGet.
dotnet add package JevDotNet
JevDotNet targets .NET 8 or higher.
Quick start
Step 1: Define your return object and decorate its properties with the Jev attributes (Choice, Score, or Noul). The property types can be either simple or detailed types (see below):
using System.ComponentModel;
using JevDotNet;
using JevDotNet.Models;
public sealed class MyJevReturnObject
{
[JevChoiceQuestion<Category>("What is the primary category?")]
public Category? Category { get; set; }
[JevScoreQuestion<Severity>("How severe is the reported impact?")]
public double? Severity { get; set; }
[JevNoulQuestion("Is the product broken?", threshold: 0.7)]
public bool? IsBroken { get; set; }
}
public enum Category
{
[Description("Questions about using or troubleshooting the product")]
Technical,
[Description("Questions about invoices, payments, or subscriptions")]
Billing,
Other
}
public enum Severity
{
Cosmetic,
Degraded,
Blocking
}
Step 2: Create a client and evaluate some text:
JevClient client = new JevClient(Environment.GetEnvironmentVariable("JEV_API_KEY")!);
string input = "The customer cannot sign in after resetting their password.";
JevResponse<MyJevReturnObject> response = await client.EvaluateAsync<MyJevReturnObject>(input);
MyJevReturnObject myReturnObject = response.Result;
Category? category = myReturnObject.Category;
double? severity = myReturnObject.Severity;
bool? isBroken = myReturnObject.IsBroken;
Each attributed property defines one question.
Dependency injection
In an ASP.NET Core application, register JevClient as a singleton:
using JevDotNet;
using Microsoft.AspNetCore.Builder;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
string apiKey = Environment.GetEnvironmentVariable("JEV_API_KEY")
?? throw new InvalidOperationException("Set JEV_API_KEY.");
builder.Services.AddJevClient(apiKey);
You can also pass a JevClientOptions instance to AddJevClient to configure the model,
endpoint, or HTTP client. Resolve JevClient from dependency injection wherever it is needed.
Question types
Choice
[JevChoiceQuestion<TEnum>] returns one enum member:
[JevChoiceQuestion<Category>("What is the primary category?")]
public Category? Category { get; set; }
or
[JevChoiceQuestion<Category>("What is the primary category?")]
public JevChoice<Category>? Category { get; set; }
Score
[JevScoreQuestion<TEnum>] uses an enum with 2–10 members as an ordered scale.
The members are ordered by their underlying numeric values and mapped to levels
0, 1, 2, and so on. Use double, decimal, or their nullable forms for only the
score:
[JevScoreQuestion<Severity>("How severe is this?")]
public double? Severity { get; set; }
or
[JevScoreQuestion<Severity>("How severe is this?")]
public JevScore<Severity>? Severity { get; set; }
Noul
[JevNoulQuestion] returns a probability from 0 to 1. Use double, decimal or JevNoul to receive the probability.
Boolean properties default to true at 0.5 or above. Configure the inclusive threshold on the question itself:
[JevNoulQuestion("Is the product broken?", threshold: 0.7)]
public bool? IsBroken { get; set; }
Custom client configuration
For custom configuration, construct the client with JevClientOptions:
HttpClient httpClient = new HttpClient();
var client = new JevClient(new JevClientOptions
{
ApiKey = apiKey,
Model = "jev-latest",
Endpoint = new Uri("https://api.typesafe.ai/v1/systemone"),
HttpClientFactory = () => httpClient
});
The returned JevResponse<T> contains the converted Result together with the
InputTokenCount and OutputTokenCount reported by the API.
| 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 was computed. 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
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.