From b1e2c6159a99fc12eeac421092cbf6bbfad37df0 Mon Sep 17 00:00:00 2001 From: codingbandit Date: Fri, 12 Jul 2024 11:32:47 -0400 Subject: [PATCH 1/2] Add LongRunning flag to AgentBase --- .../Common/Models/ResourceProviders/Agent/AgentBase.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dotnet/Common/Models/ResourceProviders/Agent/AgentBase.cs b/src/dotnet/Common/Models/ResourceProviders/Agent/AgentBase.cs index 6e7d07d406..45c4e6630e 100644 --- a/src/dotnet/Common/Models/ResourceProviders/Agent/AgentBase.cs +++ b/src/dotnet/Common/Models/ResourceProviders/Agent/AgentBase.cs @@ -43,6 +43,12 @@ public class AgentBase : ResourceBase [JsonPropertyName("prompt_object_id")] public string? PromptObjectId { get; set; } + /// + /// Indicates whether the agent is long running and should use the polling pattern. + /// + [JsonPropertyName("long_running")] + public bool LongRunning { get; set; } = false; + /// /// The object type of the agent. /// From aa28640563aa34818d15fa4c3ddc2964cf6c8aca Mon Sep 17 00:00:00 2001 From: codingbandit Date: Fri, 12 Jul 2024 12:32:41 -0400 Subject: [PATCH 2/2] Add OperationState class and OperationStatus enum --- .../Models/Orchestration/OperationState.cs | 23 +++++++++++++++ .../Models/Orchestration/OperationStatus.cs | 28 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/dotnet/Common/Models/Orchestration/OperationState.cs create mode 100644 src/dotnet/Common/Models/Orchestration/OperationStatus.cs diff --git a/src/dotnet/Common/Models/Orchestration/OperationState.cs b/src/dotnet/Common/Models/Orchestration/OperationState.cs new file mode 100644 index 0000000000..2f07f6b8be --- /dev/null +++ b/src/dotnet/Common/Models/Orchestration/OperationState.cs @@ -0,0 +1,23 @@ +namespace FoundationaLLM.Common.Models.Orchestration +{ + /// + /// Represents the current state of a long running operation. + /// + public class OperationState + { + /// + /// The identifier of the long running operation. + /// + public required string OperationId { get; set; } + + /// + /// The status of the long running operation. + /// + public required OperationStatus Status { get; set; } + + /// + /// The message describing the current state of the operation. + /// + public string? Message { get; set; } + } +} diff --git a/src/dotnet/Common/Models/Orchestration/OperationStatus.cs b/src/dotnet/Common/Models/Orchestration/OperationStatus.cs new file mode 100644 index 0000000000..833f23e016 --- /dev/null +++ b/src/dotnet/Common/Models/Orchestration/OperationStatus.cs @@ -0,0 +1,28 @@ +namespace FoundationaLLM.Common.Models.Orchestration +{ + /// + /// Represents the status of a long running operation. + /// + public enum OperationStatus + { + /// + /// Operation is new and Pending processing. + /// + Pending, + + /// + /// Operation is in progress. + /// + InProgress, + + /// + /// Operation has been completed. + /// + Completed, + + /// + /// Operation has completed in a failed state + /// + Failed + } +}