1+
2+ #nullable enable
3+
4+ namespace LangSmith
5+ {
6+ public partial class ExamplesClient
7+ {
8+ partial void PrepareValidateExampleArguments (
9+ global ::System . Net . Http . HttpClient httpClient ,
10+ global ::LangSmith . ExampleCreate request ) ;
11+ partial void PrepareValidateExampleRequest (
12+ global ::System . Net . Http . HttpClient httpClient ,
13+ global ::System . Net . Http . HttpRequestMessage httpRequestMessage ,
14+ global ::LangSmith . ExampleCreate request ) ;
15+ partial void ProcessValidateExampleResponse (
16+ global ::System . Net . Http . HttpClient httpClient ,
17+ global ::System . Net . Http . HttpResponseMessage httpResponseMessage ) ;
18+
19+ partial void ProcessValidateExampleResponseContent (
20+ global ::System . Net . Http . HttpClient httpClient ,
21+ global ::System . Net . Http . HttpResponseMessage httpResponseMessage ,
22+ ref string content ) ;
23+
24+ /// <summary>
25+ /// Validate Example<br/>
26+ /// Validate an example.
27+ /// </summary>
28+ /// <param name="request"></param>
29+ /// <param name="cancellationToken">The token to cancel the operation with</param>
30+ /// <exception cref="global::System.InvalidOperationException"></exception>
31+ public async global ::System . Threading . Tasks . Task < global ::LangSmith . ExampleValidationResult > ValidateExampleAsync (
32+ global ::LangSmith . ExampleCreate request ,
33+ global ::System . Threading . CancellationToken cancellationToken = default )
34+ {
35+ request = request ?? throw new global ::System . ArgumentNullException ( nameof ( request ) ) ;
36+
37+ PrepareArguments (
38+ client : HttpClient ) ;
39+ PrepareValidateExampleArguments (
40+ httpClient : HttpClient ,
41+ request : request ) ;
42+
43+ var __pathBuilder = new PathBuilder (
44+ path : "/api/v1/examples/validate" ,
45+ baseUri : HttpClient . BaseAddress ) ;
46+ var __path = __pathBuilder . ToString ( ) ;
47+ using var __httpRequest = new global ::System . Net . Http . HttpRequestMessage (
48+ method : global ::System . Net . Http . HttpMethod . Post ,
49+ requestUri : new global ::System . Uri ( __path , global ::System . UriKind . RelativeOrAbsolute ) ) ;
50+
51+ foreach ( var __authorization in Authorizations )
52+ {
53+ if ( __authorization . Type == "Http" ||
54+ __authorization . Type == "OAuth2" )
55+ {
56+ __httpRequest . Headers . Authorization = new global ::System . Net . Http . Headers . AuthenticationHeaderValue (
57+ scheme : __authorization . Name ,
58+ parameter : __authorization . Value ) ;
59+ }
60+ else if ( __authorization . Type == "ApiKey" &&
61+ __authorization . Location == "Header" )
62+ {
63+ __httpRequest . Headers . Add ( __authorization . Name , __authorization . Value ) ;
64+ }
65+ }
66+ var __httpRequestContentBody = request . ToJson ( JsonSerializerContext ) ;
67+ var __httpRequestContent = new global ::System . Net . Http . StringContent (
68+ content : __httpRequestContentBody ,
69+ encoding : global ::System . Text . Encoding . UTF8 ,
70+ mediaType : "application/json" ) ;
71+ __httpRequest . Content = __httpRequestContent ;
72+
73+ PrepareRequest (
74+ client : HttpClient ,
75+ request : __httpRequest ) ;
76+ PrepareValidateExampleRequest (
77+ httpClient : HttpClient ,
78+ httpRequestMessage : __httpRequest ,
79+ request : request ) ;
80+
81+ using var __response = await HttpClient . SendAsync (
82+ request : __httpRequest ,
83+ completionOption : global ::System . Net . Http . HttpCompletionOption . ResponseContentRead ,
84+ cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
85+
86+ ProcessResponse (
87+ client : HttpClient ,
88+ response : __response ) ;
89+ ProcessValidateExampleResponse (
90+ httpClient : HttpClient ,
91+ httpResponseMessage : __response ) ;
92+
93+ var __content = await __response . Content . ReadAsStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
94+
95+ ProcessResponseContent (
96+ client : HttpClient ,
97+ response : __response ,
98+ content : ref __content ) ;
99+ ProcessValidateExampleResponseContent (
100+ httpClient : HttpClient ,
101+ httpResponseMessage : __response ,
102+ content : ref __content ) ;
103+
104+ try
105+ {
106+ __response . EnsureSuccessStatusCode ( ) ;
107+ }
108+ catch ( global ::System . Net . Http . HttpRequestException __ex )
109+ {
110+ throw new global ::System . InvalidOperationException ( __content , __ex ) ;
111+ }
112+
113+ return
114+ global ::LangSmith . ExampleValidationResult . FromJson ( __content , JsonSerializerContext ) ??
115+ throw new global ::System . InvalidOperationException ( $ "Response deserialization failed for \" { __content } \" ") ;
116+ }
117+
118+ /// <summary>
119+ /// Validate Example<br/>
120+ /// Validate an example.
121+ /// </summary>
122+ /// <param name="outputs"></param>
123+ /// <param name="datasetId"></param>
124+ /// <param name="sourceRunId"></param>
125+ /// <param name="metadata"></param>
126+ /// <param name="inputs"></param>
127+ /// <param name="split">
128+ /// Default Value: base
129+ /// </param>
130+ /// <param name="id"></param>
131+ /// <param name="useSourceRunIo">
132+ /// Default Value: false
133+ /// </param>
134+ /// <param name="createdAt"></param>
135+ /// <param name="cancellationToken">The token to cancel the operation with</param>
136+ /// <exception cref="global::System.InvalidOperationException"></exception>
137+ public async global ::System . Threading . Tasks . Task < global ::LangSmith . ExampleValidationResult > ValidateExampleAsync (
138+ global ::System . Guid datasetId ,
139+ object ? outputs = default ,
140+ global ::System . Guid ? sourceRunId = default ,
141+ object ? metadata = default ,
142+ object ? inputs = default ,
143+ global ::LangSmith . AnyOf < global ::System . Collections . Generic . IList < string > , string > ? split = default ,
144+ global ::System . Guid ? id = default ,
145+ bool ? useSourceRunIo = default ,
146+ global ::System . DateTime ? createdAt = default ,
147+ global ::System . Threading . CancellationToken cancellationToken = default )
148+ {
149+ var __request = new global ::LangSmith . ExampleCreate
150+ {
151+ Outputs = outputs ,
152+ DatasetId = datasetId ,
153+ SourceRunId = sourceRunId ,
154+ Metadata = metadata ,
155+ Inputs = inputs ,
156+ Split = split ,
157+ Id = id ,
158+ UseSourceRunIo = useSourceRunIo ,
159+ CreatedAt = createdAt ,
160+ } ;
161+
162+ return await ValidateExampleAsync (
163+ request : __request ,
164+ cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
165+ }
166+ }
167+ }
0 commit comments