Class StateServiceClient
- Namespace
- FoundationaLLM.Common.Clients
- Assembly
- FoundationaLLM.Common.dll
Provides methods for managing state for long-running operations.
public class StateServiceClient : IStateServiceClient
- Inheritance
-
StateServiceClient
- Implements
- Inherited Members
- Extension Methods
Constructors
StateServiceClient(Uri, AzureKeyCredential, APIEndpointClientOptions?)
Initializes a new instance of the StateServiceClient class.
public StateServiceClient(Uri endpoint, AzureKeyCredential credential, APIEndpointClientOptions? options)
Parameters
endpoint
UriThe endpoint URI of the FoundationaLLM State API service.
credential
AzureKeyCredentialThe AzureKeyCredential used to authenticate requests to the service.
options
APIEndpointClientOptionsOptional configuration settings for the client, such as retry policies and timeouts.
Methods
BuildClient(Dictionary<string, object>)
Creates and configures a new instance of the StateServiceClient.
public static StateServiceClient BuildClient(Dictionary<string, object> clientBuilderParameters)
Parameters
clientBuilderParameters
Dictionary<string, object>A dictionary of parameters used to further configure the client.
Returns
- StateServiceClient
A new instance of the StateServiceClient configured with the specified
clientBuilderParameters
.
CreateOperation(string, string, UnifiedUserIdentity, CancellationToken)
Creates a new long-running operation in the state service.
public Task<ClientResult<LongRunningOperation>> CreateOperation(string instanceId, string operationId, UnifiedUserIdentity userIdentity, CancellationToken cancellationToken = default)
Parameters
instanceId
stringThe FoundationaLLM instance identifier.
operationId
stringThe unique identifier of the operation.
userIdentity
UnifiedUserIdentityThe identity of the user running the operation.
cancellationToken
CancellationTokenThe cancellation token notifiying a request to cancel the operation creation.
Returns
- Task<ClientResult<LongRunningOperation>>
UpdateOperation(string, string, OperationStatus, string, UnifiedUserIdentity, CancellationToken)
Updates the status of an existing long-running operation in the state service.
public Task<ClientResult<LongRunningOperation>> UpdateOperation(string instanceId, string operationId, OperationStatus status, string statusMessage, UnifiedUserIdentity userIdentity, CancellationToken cancellationToken = default)
Parameters
instanceId
stringThe FoundationaLLM instance identifier.
operationId
stringThe unique identifier of the operation.
status
OperationStatusThe status of the operation.
statusMessage
stringThe message describing the status of the operation.
userIdentity
UnifiedUserIdentityThe identity of the user running the operation.
cancellationToken
CancellationTokenThe cancellation token notifiying a request to cancel the operation status update.
Returns
- Task<ClientResult<LongRunningOperation>>
UpdateOperationResult(string, string, CompletionResponse, CancellationToken)
Updates the current result of a long-running operation in the state service.
public Task UpdateOperationResult(string instanceId, string operationId, CompletionResponse completionResponse, CancellationToken cancellationToken = default)
Parameters
instanceId
stringThe FoundationaLLM instance identifier.
operationId
stringThe unique identifier of the operation.
completionResponse
CompletionResponseThe completion response that is the current result of the operation.
cancellationToken
CancellationTokenThe cancellation token notifiying a request to cancel the operation result update.
Returns
UpdateOperationWithTextResult(string, string, OperationStatus, string, string, UnifiedUserIdentity, CancellationToken)
Updates the status and the current result of an existing long-running operation in the state service.
public Task<ClientResult<LongRunningOperation>> UpdateOperationWithTextResult(string instanceId, string operationId, OperationStatus status, string statusMessage, string resultMessage, UnifiedUserIdentity userIdentity, CancellationToken cancellationToken = default)
Parameters
instanceId
stringThe FoundationaLLM instance identifier.
operationId
stringThe unique identifier of the operation.
status
OperationStatusThe status of the operation.
statusMessage
stringThe message describing the status of the operation.
resultMessage
stringThe message describing the current result of the operation.
userIdentity
UnifiedUserIdentityThe identity of the user running the operation.
cancellationToken
CancellationTokenThe cancellation token notifiying a request to cancel the operation status update.
Returns
- Task<ClientResult<LongRunningOperation>>