Public Access
Handle settings logs agent failures
PR and Push Build/Test / build-and-test (push) Successful in 9m8s
PR and Push Build/Test / build-and-test (push) Successful in 9m8s
This commit is contained in:
@@ -21,6 +21,7 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
|
||||
private readonly TimeSpan reconnectionDelay;
|
||||
private readonly LiteLlmResponsesCompactionOptions? compactionOptions;
|
||||
private readonly ILogger? logger;
|
||||
private readonly Action? retrying;
|
||||
private int responsesRequestCount;
|
||||
|
||||
public LiteLlmResponsesChatClient(
|
||||
@@ -33,7 +34,8 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
|
||||
TimeSpan reconnectionDelay,
|
||||
LiteLlmResponsesCompactionOptions? compactionOptions = null,
|
||||
ILogger? logger = null,
|
||||
bool firstRequestIsUser = true)
|
||||
bool firstRequestIsUser = true,
|
||||
Action? retrying = null)
|
||||
: this(
|
||||
new HttpClient { BaseAddress = NormalizeEndpoint(endpoint) },
|
||||
apiKey,
|
||||
@@ -44,7 +46,8 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
|
||||
reconnectionDelay,
|
||||
compactionOptions,
|
||||
logger,
|
||||
firstRequestIsUser)
|
||||
firstRequestIsUser,
|
||||
retrying)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,7 +61,8 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
|
||||
TimeSpan reconnectionDelay,
|
||||
LiteLlmResponsesCompactionOptions? compactionOptions = null,
|
||||
ILogger? logger = null,
|
||||
bool firstRequestIsUser = true)
|
||||
bool firstRequestIsUser = true,
|
||||
Action? retrying = null)
|
||||
{
|
||||
this.httpClient = httpClient;
|
||||
this.httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
|
||||
@@ -69,6 +73,7 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
|
||||
this.reconnectionDelay = reconnectionDelay > TimeSpan.Zero ? reconnectionDelay : TimeSpan.Zero;
|
||||
this.compactionOptions = compactionOptions;
|
||||
this.logger = logger;
|
||||
this.retrying = retrying;
|
||||
responsesRequestCount = firstRequestIsUser ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -377,6 +382,7 @@ public sealed class LiteLlmResponsesChatClient : IChatClient
|
||||
lastException = exception;
|
||||
}
|
||||
|
||||
retrying?.Invoke();
|
||||
await DelayBeforeRetryAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user