Skip to content

Commit

Permalink
Merge pull request #1231 from solliancenet/cp_polling_work
Browse files Browse the repository at this point in the history
Polling:  Add LongRunning flag on agent and OperationState class and OperationStatus enum
  • Loading branch information
ciprianjichici authored Jul 12, 2024
2 parents c40d08b + aa28640 commit a390ee5
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/dotnet/Common/Models/Orchestration/OperationState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace FoundationaLLM.Common.Models.Orchestration
{
/// <summary>
/// Represents the current state of a long running operation.
/// </summary>
public class OperationState
{
/// <summary>
/// The identifier of the long running operation.
/// </summary>
public required string OperationId { get; set; }

/// <summary>
/// The status of the long running operation.
/// </summary>
public required OperationStatus Status { get; set; }

/// <summary>
/// The message describing the current state of the operation.
/// </summary>
public string? Message { get; set; }
}
}
28 changes: 28 additions & 0 deletions src/dotnet/Common/Models/Orchestration/OperationStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace FoundationaLLM.Common.Models.Orchestration
{
/// <summary>
/// Represents the status of a long running operation.
/// </summary>
public enum OperationStatus
{
/// <summary>
/// Operation is new and Pending processing.
/// </summary>
Pending,

/// <summary>
/// Operation is in progress.
/// </summary>
InProgress,

/// <summary>
/// Operation has been completed.
/// </summary>
Completed,

/// <summary>
/// Operation has completed in a failed state
/// </summary>
Failed
}
}
6 changes: 6 additions & 0 deletions src/dotnet/Common/Models/ResourceProviders/Agent/AgentBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ public class AgentBase : ResourceBase
[JsonPropertyName("prompt_object_id")]
public string? PromptObjectId { get; set; }

/// <summary>
/// Indicates whether the agent is long running and should use the polling pattern.
/// </summary>
[JsonPropertyName("long_running")]
public bool LongRunning { get; set; } = false;

/// <summary>
/// The object type of the agent.
/// </summary>
Expand Down

0 comments on commit a390ee5

Please sign in to comment.