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 new API endpoint for enhancing prompts at /api/v1/prompts/canvas #112

Merged
merged 1 commit into from
Oct 28, 2024
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 PlaygroundOptimizePromptRequestSchemaTemplateFormatJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::LangSmith.PlaygroundOptimizePromptRequestSchemaTemplateFormat>
{
/// <inheritdoc />
public override global::LangSmith.PlaygroundOptimizePromptRequestSchemaTemplateFormat 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.PlaygroundOptimizePromptRequestSchemaTemplateFormatExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

writer.WriteStringValue(global::LangSmith.PlaygroundOptimizePromptRequestSchemaTemplateFormatExtensions.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 PlaygroundOptimizePromptRequestSchemaTemplateFormatNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::LangSmith.PlaygroundOptimizePromptRequestSchemaTemplateFormat?>
{
/// <inheritdoc />
public override global::LangSmith.PlaygroundOptimizePromptRequestSchemaTemplateFormat? 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.PlaygroundOptimizePromptRequestSchemaTemplateFormatExtensions.ToEnum(stringValue);
}

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::LangSmith.PlaygroundOptimizePromptRequestSchemaTemplateFormat? 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.PlaygroundOptimizePromptRequestSchemaTemplateFormatExtensions.ToValueString(value.Value));
}
}
}
}
2 changes: 2 additions & 0 deletions src/libs/LangSmith/Generated/JsonSerializerContext.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ namespace LangSmith
typeof(global::LangSmith.JsonConverters.OrganizationDashboardTypeNullableJsonConverter),
typeof(global::LangSmith.JsonConverters.PagerdutySeverityJsonConverter),
typeof(global::LangSmith.JsonConverters.PagerdutySeverityNullableJsonConverter),
typeof(global::LangSmith.JsonConverters.PlaygroundOptimizePromptRequestSchemaTemplateFormatJsonConverter),
typeof(global::LangSmith.JsonConverters.PlaygroundOptimizePromptRequestSchemaTemplateFormatNullableJsonConverter),
typeof(global::LangSmith.JsonConverters.RunsGenerateQueryFeedbackKeysJsonConverter),
typeof(global::LangSmith.JsonConverters.RunsGenerateQueryFeedbackKeysNullableJsonConverter),
typeof(global::LangSmith.JsonConverters.ResourceTypeJsonConverter),
Expand Down
Loading