-
-
Notifications
You must be signed in to change notification settings - Fork 2
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:Enhance LangSmith library with custom chart handling and API updates #28
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
|
||
#nullable enable | ||
|
||
namespace LangSmith | ||
{ | ||
public partial class ChartsClient | ||
{ | ||
partial void PrepareReadChartPreviewApiV1ChartsPreviewPostArguments( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::LangSmith.CustomChartPreviewRequest request); | ||
partial void PrepareReadChartPreviewApiV1ChartsPreviewPostRequest( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpRequestMessage httpRequestMessage, | ||
global::LangSmith.CustomChartPreviewRequest request); | ||
partial void ProcessReadChartPreviewApiV1ChartsPreviewPostResponse( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpResponseMessage httpResponseMessage); | ||
|
||
partial void ProcessReadChartPreviewApiV1ChartsPreviewPostResponseContent( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpResponseMessage httpResponseMessage, | ||
ref string content); | ||
|
||
/// <summary> | ||
/// Read Chart Preview<br/> | ||
/// Get a preview for a chart without actually creating it. | ||
/// </summary> | ||
/// <param name="request"></param> | ||
/// <param name="cancellationToken">The token to cancel the operation with</param> | ||
/// <exception cref="global::System.InvalidOperationException"></exception> | ||
public async global::System.Threading.Tasks.Task<global::LangSmith.SingleCustomChartResponseBase> ReadChartPreviewApiV1ChartsPreviewPostAsync( | ||
global::LangSmith.CustomChartPreviewRequest request, | ||
global::System.Threading.CancellationToken cancellationToken = default) | ||
{ | ||
request = request ?? throw new global::System.ArgumentNullException(nameof(request)); | ||
|
||
PrepareArguments( | ||
client: _httpClient); | ||
PrepareReadChartPreviewApiV1ChartsPreviewPostArguments( | ||
httpClient: _httpClient, | ||
request: request); | ||
|
||
using var httpRequest = new global::System.Net.Http.HttpRequestMessage( | ||
method: global::System.Net.Http.HttpMethod.Post, | ||
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/api/v1/charts/preview", global::System.UriKind.RelativeOrAbsolute)); | ||
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::LangSmith.SourceGenerationContext.Default.CustomChartPreviewRequest); | ||
var __httpRequestContent = new global::System.Net.Http.StringContent( | ||
content: __httpRequestContentBody, | ||
encoding: global::System.Text.Encoding.UTF8, | ||
mediaType: "application/json"); | ||
httpRequest.Content = __httpRequestContent; | ||
|
||
PrepareRequest( | ||
client: _httpClient, | ||
request: httpRequest); | ||
PrepareReadChartPreviewApiV1ChartsPreviewPostRequest( | ||
httpClient: _httpClient, | ||
httpRequestMessage: httpRequest, | ||
request: request); | ||
|
||
using var response = await _httpClient.SendAsync( | ||
request: httpRequest, | ||
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, | ||
cancellationToken: cancellationToken).ConfigureAwait(false); | ||
|
||
ProcessResponse( | ||
client: _httpClient, | ||
response: response); | ||
ProcessReadChartPreviewApiV1ChartsPreviewPostResponse( | ||
httpClient: _httpClient, | ||
httpResponseMessage: response); | ||
|
||
var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); | ||
|
||
ProcessResponseContent( | ||
client: _httpClient, | ||
response: response, | ||
content: ref __content); | ||
ProcessReadChartPreviewApiV1ChartsPreviewPostResponseContent( | ||
httpClient: _httpClient, | ||
httpResponseMessage: response, | ||
content: ref __content); | ||
|
||
try | ||
{ | ||
response.EnsureSuccessStatusCode(); | ||
} | ||
catch (global::System.Net.Http.HttpRequestException ex) | ||
{ | ||
throw new global::System.InvalidOperationException(__content, ex); | ||
} | ||
|
||
return | ||
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::LangSmith.SourceGenerationContext.Default.NullableSingleCustomChartResponseBase) ?? | ||
Check failure on line 94 in src/libs/LangSmith/Generated/LangSmith.ChartsClient.ReadChartPreviewApiV1ChartsPreviewPost.g.cs
|
||
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); | ||
} | ||
|
||
/// <summary> | ||
/// Read Chart Preview<br/> | ||
/// Get a preview for a chart without actually creating it. | ||
/// </summary> | ||
/// <param name="bucketInfo"></param> | ||
/// <param name="chart"></param> | ||
/// <param name="cancellationToken">The token to cancel the operation with</param> | ||
/// <exception cref="global::System.InvalidOperationException"></exception> | ||
public async global::System.Threading.Tasks.Task<global::LangSmith.SingleCustomChartResponseBase> ReadChartPreviewApiV1ChartsPreviewPostAsync( | ||
global::LangSmith.CustomChartsRequestBase bucketInfo, | ||
global::LangSmith.CustomChartCreatePreview chart, | ||
global::System.Threading.CancellationToken cancellationToken = default) | ||
{ | ||
var request = new global::LangSmith.CustomChartPreviewRequest | ||
{ | ||
BucketInfo = bucketInfo, | ||
Chart = chart, | ||
}; | ||
|
||
return await ReadChartPreviewApiV1ChartsPreviewPostAsync( | ||
request: request, | ||
cancellationToken: cancellationToken).ConfigureAwait(false); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
#nullable enable | ||
|
||
namespace LangSmith | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public sealed partial class CustomChartCreatePreview | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("series")] | ||
[global::System.Text.Json.Serialization.JsonRequired] | ||
public required global::System.Collections.Generic.IList<global::LangSmith.CustomChartSeries> Series { get; set; } | ||
|
||
/// <summary> | ||
/// Additional properties that are not explicitly defined in the schema | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonExtensionData] | ||
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
#nullable enable | ||
|
||
namespace LangSmith | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public sealed partial class CustomChartPreviewRequest | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("bucket_info")] | ||
[global::System.Text.Json.Serialization.JsonRequired] | ||
public required global::LangSmith.CustomChartsRequestBase BucketInfo { get; set; } | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("chart")] | ||
[global::System.Text.Json.Serialization.JsonRequired] | ||
public required global::LangSmith.CustomChartCreatePreview Chart { get; set; } | ||
|
||
/// <summary> | ||
/// Additional properties that are not explicitly defined in the schema | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonExtensionData] | ||
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
#pragma warning disable CS0618 // Type or member is obsolete | ||
|
||
#nullable enable | ||
|
||
namespace LangSmith | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public sealed partial class CustomChartsRequestBase | ||
{ | ||
/// <summary> | ||
/// Default Value: UTC | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("timezone")] | ||
public string? Timezone { get; set; } = "UTC"; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("start_time")] | ||
[global::System.Text.Json.Serialization.JsonRequired] | ||
public required global::System.DateTime StartTime { get; set; } | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("end_time")] | ||
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.AnyOfJsonConverterFactory2))] | ||
public global::System.AnyOf<global::System.DateTime?, object>? EndTime { get; set; } | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("stride")] | ||
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.AllOfJsonConverterFactory1))] | ||
public global::System.AllOf<global::LangSmith.TimedeltaInput>? Stride { get; set; } | ||
|
||
/// <summary> | ||
/// Additional properties that are not explicitly defined in the schema | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonExtensionData] | ||
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
#nullable enable | ||
|
||
namespace LangSmith | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public sealed partial class SingleCustomChartResponseBase | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonPropertyName("data")] | ||
[global::System.Text.Json.Serialization.JsonRequired] | ||
public required global::System.Collections.Generic.IList<global::LangSmith.CustomChartsDataPoint> Data { get; set; } | ||
|
||
/// <summary> | ||
/// Additional properties that are not explicitly defined in the schema | ||
/// </summary> | ||
[global::System.Text.Json.Serialization.JsonExtensionData] | ||
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the missing definition for
NullableSingleCustomChartResponseBase
.The static analysis tool indicates that
SourceGenerationContext
does not contain a definition forNullableSingleCustomChartResponseBase
. Ensure that this type is defined or correctly referenced.Please verify the existence of
NullableSingleCustomChartResponseBase
inSourceGenerationContext
or update the reference to the correct type.Tools
GitHub Check: Test / Build, test and publish