Skip to content

Getting started

Rasmus Wulff Jensen edited this page Sep 22, 2026 · 1 revision

Getting started

This walkthrough makes one Jev API call and maps three answers into a C# return object. You will need .NET 8 or later and a TypeSafe AI API key. The example keeps the returned values simple; the next guides explain the detailed answer types.

1. Create a project and install the package

dotnet new console --framework net8.0 --name JevDemo
cd JevDemo
dotnet add package JevDotNet

You can also add the package to an existing .NET 8+ project. The package is listed on NuGet.

2. Provide an API key

Set JEV_API_KEY in your local environment or supply the key through your application's secret storage. The example reads that variable and stops with a clear error when it is missing. Do not put an API key in Program.cs or commit it to Git.

new JevClient(apiKey) uses the default model (jev-latest) and endpoint. You can change those later with JevClientOptions in Evaluate text and use results.

3. Replace Program.cs with this example

using System.ComponentModel;
using JevDotNet;
using JevDotNet.Models;

string apiKey = Environment.GetEnvironmentVariable("JEV_API_KEY")
    ?? throw new InvalidOperationException("Set JEV_API_KEY first.");

JevClient client = new(apiKey);

string message = "The customer cannot sign in after resetting their password.";
JevResponse<SupportAssessment> response =
    await client.EvaluateAsync<SupportAssessment>(message);

Console.WriteLine($"Category: {response.Result.Category}");
Console.WriteLine($"Severity: {response.Result.Severity}");
Console.WriteLine($"Is broken: {response.Result.IsBroken}");
Console.WriteLine($"Tokens: {response.InputTokenCount} in, {response.OutputTokenCount} out");

public sealed class SupportAssessment
{
    [JevChoiceQuestion<Category>("What is the primary category?")]
    public Category? Category { get; set; }

    [JevScoreQuestion<Severity>("How severe is the reported issue?")]
    public double? Severity { get; set; }

    [JevNoulQuestion("Is the product broken or unavailable?", 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,
    [Description("Requests that fit neither category")]
    Other
}

public enum Severity
{
    [Description("Cosmetic issue; functionality works")]
    Cosmetic = 0,
    [Description("Feature is degraded, but a workaround exists")]
    Degraded = 1,
    [Description("Blocking issue with no usable workaround")]
    Blocking = 2
}

Run dotnet run with JEV_API_KEY available to the process. The values depend on the input and model; the example does not assume a particular answer.

4. Understand what happened

SupportAssessment is the return object. Its three attributed properties create three questions for the same message:

Property Jev type C# result
Category Choice One Category enum member.
Severity Score A numeric position on the Severity scale.
IsBroken Noul true when the yes-probability is at least 0.7.

The property names are the question IDs. JevDotNet creates a new SupportAssessment, maps the answers onto its writable properties, and returns it as response.Result. InputTokenCount and OutputTokenCount report usage for the call.

Where to go next

  1. Build the return object around your own questions and choose simple or detailed property types. The Choice, Score, and Noul pages sit under that step in the sidebar.
  2. Evaluate text and use the result to learn about detailed answers, token usage, cancellation, and client options.
  3. If an exception occurs, use its wiki link or open Troubleshooting return objects.

Clone this wiki locally