Skip to content
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
Expand Up @@ -50,6 +50,28 @@ partial void ProcessCallAgentResponseContent(
/// <exception cref="global::tryAGI.Humanloop.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::tryAGI.Humanloop.AgentCallResponse> CallAgentAsync(

global::tryAGI.Humanloop.AgentCallRequest request,
global::tryAGI.Humanloop.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __response = await CallAgentAsResponseAsync(

request: request,
requestOptions: requestOptions,
cancellationToken: cancellationToken
).ConfigureAwait(false);

return __response.Body;
}
/// <summary>
/// Call Agent
/// </summary>
/// <param name="request"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::tryAGI.Humanloop.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::tryAGI.Humanloop.AutoSDKHttpResponse<global::tryAGI.Humanloop.AgentCallResponse>> CallAgentAsResponseAsync(

global::tryAGI.Humanloop.AgentCallRequest request,
global::tryAGI.Humanloop.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -84,6 +106,7 @@ partial void ProcessCallAgentResponseContent(

global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{

var __pathBuilder = new global::tryAGI.Humanloop.PathBuilder(
path: "/agents/call",
baseUri: HttpClient.BaseAddress);
Expand Down Expand Up @@ -163,6 +186,8 @@ partial void ProcessCallAgentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -173,6 +198,11 @@ partial void ProcessCallAgentResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -190,6 +220,8 @@ partial void ProcessCallAgentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
Expand All @@ -199,8 +231,7 @@ partial void ProcessCallAgentResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -209,6 +240,11 @@ partial void ProcessCallAgentResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -225,14 +261,15 @@ partial void ProcessCallAgentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
retryDelay: __retryDelay,
retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -272,6 +309,8 @@ partial void ProcessCallAgentResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -292,6 +331,8 @@ partial void ProcessCallAgentResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}

Expand All @@ -316,9 +357,13 @@ partial void ProcessCallAgentResponseContent(
{
__response.EnsureSuccessStatusCode();

return
global::tryAGI.Humanloop.AgentCallResponse.FromJson(__content, JsonSerializerContext) ??
var __value = global::tryAGI.Humanloop.AgentCallResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
return new global::tryAGI.Humanloop.AutoSDKHttpResponse<global::tryAGI.Humanloop.AgentCallResponse>(
statusCode: __response.StatusCode,
headers: global::tryAGI.Humanloop.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down Expand Up @@ -346,9 +391,13 @@ partial void ProcessCallAgentResponseContent(
#endif
).ConfigureAwait(false);

return
await global::tryAGI.Humanloop.AgentCallResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
var __value = await global::tryAGI.Humanloop.AgentCallResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
return new global::tryAGI.Humanloop.AutoSDKHttpResponse<global::tryAGI.Humanloop.AgentCallResponse>(
statusCode: __response.StatusCode,
headers: global::tryAGI.Humanloop.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ partial void ProcessDeleteAgentResponse(
string id,
global::tryAGI.Humanloop.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
await DeleteAgentAsResponseAsync(
id: id,
requestOptions: requestOptions,
cancellationToken: cancellationToken
).ConfigureAwait(false);
}
/// <summary>
/// Delete Agent
/// </summary>
/// <param name="id"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::tryAGI.Humanloop.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::tryAGI.Humanloop.AutoSDKHttpResponse> DeleteAgentAsResponseAsync(
string id,
global::tryAGI.Humanloop.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
Expand Down Expand Up @@ -76,6 +94,7 @@ partial void ProcessDeleteAgentResponse(

global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{

var __pathBuilder = new global::tryAGI.Humanloop.PathBuilder(
path: $"/agents/{id}",
baseUri: HttpClient.BaseAddress);
Expand Down Expand Up @@ -149,6 +168,8 @@ partial void ProcessDeleteAgentResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -159,6 +180,11 @@ partial void ProcessDeleteAgentResponse(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -176,6 +202,8 @@ partial void ProcessDeleteAgentResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
Expand All @@ -185,8 +213,7 @@ partial void ProcessDeleteAgentResponse(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -195,6 +222,11 @@ partial void ProcessDeleteAgentResponse(
__attempt < __maxAttempts &&
global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -211,14 +243,15 @@ partial void ProcessDeleteAgentResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
retryDelay: __retryDelay,
retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.Humanloop.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -258,6 +291,8 @@ partial void ProcessDeleteAgentResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -278,6 +313,8 @@ partial void ProcessDeleteAgentResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}

Expand All @@ -298,6 +335,10 @@ partial void ProcessDeleteAgentResponse(
{
__response.EnsureSuccessStatusCode();

return new global::tryAGI.Humanloop.AutoSDKHttpResponse(
statusCode: __response.StatusCode,
headers: global::tryAGI.Humanloop.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri);
}
catch (global::System.Exception __ex)
{
Expand All @@ -319,6 +360,10 @@ partial void ProcessDeleteAgentResponse(
try
{
__response.EnsureSuccessStatusCode();
return new global::tryAGI.Humanloop.AutoSDKHttpResponse(
statusCode: __response.StatusCode,
headers: global::tryAGI.Humanloop.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri);
}
catch (global::System.Exception __ex)
{
Expand Down
Loading