Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:Add API endpoint for grouped examples with associated runs #184

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

namespace LangSmith.JsonConverters
{
/// <inheritdoc />
public sealed class GroupExampleRunsByFieldJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::LangSmith.GroupExampleRunsByField>
{
/// <inheritdoc />
public override global::LangSmith.GroupExampleRunsByField Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::LangSmith.GroupExampleRunsByFieldExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::LangSmith.GroupExampleRunsByField)numValue;
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::LangSmith.GroupExampleRunsByField value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::LangSmith.GroupExampleRunsByFieldExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#nullable enable

namespace LangSmith.JsonConverters
{
/// <inheritdoc />
public sealed class GroupExampleRunsByFieldNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::LangSmith.GroupExampleRunsByField?>
{
/// <inheritdoc />
public override global::LangSmith.GroupExampleRunsByField? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::LangSmith.GroupExampleRunsByFieldExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::LangSmith.GroupExampleRunsByField)numValue;
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::LangSmith.GroupExampleRunsByField? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(global::LangSmith.GroupExampleRunsByFieldExtensions.ToValueString(value.Value));
}
}
}
}
3 changes: 3 additions & 0 deletions src/libs/LangSmith/Generated/JsonSerializerContext.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ namespace LangSmith
typeof(global::LangSmith.JsonConverters.FunctionMessageTypeNullableJsonConverter),
typeof(global::LangSmith.JsonConverters.FunctionMessageChunkTypeJsonConverter),
typeof(global::LangSmith.JsonConverters.FunctionMessageChunkTypeNullableJsonConverter),
typeof(global::LangSmith.JsonConverters.GroupExampleRunsByFieldJsonConverter),
typeof(global::LangSmith.JsonConverters.GroupExampleRunsByFieldNullableJsonConverter),
typeof(global::LangSmith.JsonConverters.HumanMessageTypeJsonConverter),
typeof(global::LangSmith.JsonConverters.HumanMessageTypeNullableJsonConverter),
typeof(global::LangSmith.JsonConverters.HumanMessageChunkTypeJsonConverter),
Expand Down Expand Up @@ -203,6 +205,7 @@ namespace LangSmith
typeof(global::LangSmith.JsonConverters.AnyOfJsonConverter<global::System.Collections.Generic.IList<global::LangSmith.DatasetTransformation>, global::LangSmith.Missing>),
typeof(global::LangSmith.JsonConverters.AnyOfJsonConverter<global::System.Collections.Generic.IList<string>, string>),
typeof(global::LangSmith.JsonConverters.AnyOfJsonConverter<global::System.Collections.Generic.IList<string>, string>),
typeof(global::LangSmith.JsonConverters.AnyOfJsonConverter<global::System.Collections.Generic.IList<global::LangSmith.ExampleWithRuns>, global::System.Collections.Generic.IList<global::LangSmith.ExampleWithRunsCH>>),
typeof(global::LangSmith.JsonConverters.AnyOfJsonConverter<double?, int?, bool?>),
typeof(global::LangSmith.JsonConverters.AnyOfJsonConverter<double?, int?, bool?, string, object>),
typeof(global::LangSmith.JsonConverters.AnyOfJsonConverter<object, string>),
Expand Down
Loading
Loading