-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update long-running operation APIs to use LRO subclient pattern #129
Update long-running operation APIs to use LRO subclient pattern #129
Conversation
… using general helpers
… using general helpers
…avor of generalized helpers
…s an abstract type
string threadId, | ||
string assistantId, | ||
RunCreationOptions options = null, | ||
public virtual async Task<RunOperation> ContinueRunAsync( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding a new method group here, add a factory method to RunOperation to rehydrate it, similar to Azure.Core Operation static Rehydrate method.
@@ -433,13 +434,20 @@ public virtual ClientResult RemoveFileFromStore(string vectorStoreId, string fil | |||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> | |||
/// <returns> The response returned from the service. </returns> | |||
[EditorBrowsable(EditorBrowsableState.Never)] | |||
public virtual async Task<ClientResult> CreateBatchFileJobAsync(string vectorStoreId, BinaryContent content, RequestOptions options = null) | |||
public virtual async Task<VectorStoreFileBatchOperation> CreateBatchFileJobAsync(string vectorStoreId, BinaryContent content, RequestOptions options = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to decide if this should take ReturnWhen
@@ -34,12 +35,18 @@ public partial class FineTuningClient | |||
/// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception> | |||
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> | |||
/// <returns> The response returned from the service. </returns> | |||
public virtual async Task<ClientResult> CreateJobAsync(BinaryContent content, RequestOptions options = null) | |||
public virtual async Task<FineTuningOperation> CreateJobAsync(BinaryContent content, RequestOptions options = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to decide if this should take ReturnWhen
public virtual Task<ClientResult> CreateRunAsync(string threadId, BinaryContent content, RequestOptions options = null) | ||
=> _runSubClient.CreateRunAsync(threadId, content, options); | ||
public virtual async Task<RunOperation> CreateThreadAndRunAsync( | ||
ReturnWhen returnWhen, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should not take ReturnWhen
since this LRO can be suspended and resumed -- passing ReturnWhen.Completed
would be an error.
_interval = interval ?? new TimeSpan(DefaultWaitMilliseconds); | ||
} | ||
|
||
public async Task WaitAsync(CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should respect Retry-After
header, and possibly exponential backoff?
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> | ||
/// <returns> The response returned from the service. </returns> | ||
public virtual async Task<ClientResult> CreateBatchAsync(BinaryContent content, RequestOptions options = null) | ||
public virtual async Task<BatchOperation> CreateBatchAsync(BinaryContent content, RequestOptions options = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decide if it should take ReturnWhen
parameter
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAI.Tests", "tests\OpenAI.Tests.csproj", "{6F156401-2544-41D7-B204-3148C51C1D09}" | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenAI.Tests", "tests\OpenAI.Tests.csproj", "{6F156401-2544-41D7-B204-3148C51C1D09}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.ClientModel", "..\azure-sdk-for-net\sdk\core\System.ClientModel\src\System.ClientModel.csproj", "{8316F2D5-21A7-468B-97DB-B14C44B4F50C}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be able to update this to SCM 1.1.0-beta.6 when it ships next week.
Closing in favor of #156 |
Currently prototype work-in-progress.
Uses SCM LRO types introduced in Azure/azure-sdk-for-net#44728
This version explores whether we can generate the LRO update mechanism as an internal update enumerator, to represent both streaming and polling versions with the same abstraction.