openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Custom/Assistants/Internal/InternalAssistantRunClient.cs
73lines · modecode
| 1 | using System; |
| 2 | using System.ClientModel; |
| 3 | using System.ClientModel.Primitives; |
| 4 | using System.Collections.Generic; |
| 5 | using System.Threading; |
| 6 | |
| 7 | namespace OpenAI.Assistants; |
| 8 | |
| 9 | [CodeGenType("Runs")] |
| 10 | [CodeGenSuppress("InternalAssistantRunClient", typeof(ClientPipeline), typeof(ApiKeyCredential), typeof(Uri))] |
| 11 | [CodeGenSuppress("CreateThreadAndRunAsync", typeof(InternalCreateThreadAndRunRequest), typeof(CancellationToken))] |
| 12 | [CodeGenSuppress("CreateThreadAndRun", typeof(InternalCreateThreadAndRunRequest), typeof(CancellationToken))] |
| 13 | [CodeGenSuppress("CreateRunAsync", typeof(string), typeof(RunCreationOptions), typeof(IEnumerable<InternalIncludedRunStepProperty>), typeof(CancellationToken))] |
| 14 | [CodeGenSuppress("CreateRun", typeof(string), typeof(RunCreationOptions), typeof(IEnumerable<InternalIncludedRunStepProperty>), typeof(CancellationToken))] |
| 15 | [CodeGenSuppress("GetRunsAsync", typeof(string), typeof(int?), typeof(OpenAI.VectorStores.VectorStoreCollectionOrder?), typeof(string), typeof(string), typeof(CancellationToken))] |
| 16 | [CodeGenSuppress("GetRuns", typeof(string), typeof(int?), typeof(OpenAI.VectorStores.VectorStoreCollectionOrder?), typeof(string), typeof(string), typeof(CancellationToken))] |
| 17 | [CodeGenSuppress("GetRunAsync", typeof(string), typeof(string), typeof(CancellationToken))] |
| 18 | [CodeGenSuppress("GetRun", typeof(string), typeof(string), typeof(CancellationToken))] |
| 19 | [CodeGenSuppress("ModifyRunAsync", typeof(string), typeof(string), typeof(RunModificationOptions), typeof(CancellationToken))] |
| 20 | [CodeGenSuppress("ModifyRun", typeof(string), typeof(string), typeof(RunModificationOptions), typeof(CancellationToken))] |
| 21 | [CodeGenSuppress("CancelRunAsync", typeof(string), typeof(string), typeof(CancellationToken))] |
| 22 | [CodeGenSuppress("CancelRun", typeof(string), typeof(string), typeof(CancellationToken))] |
| 23 | [CodeGenSuppress("SubmitToolOutputsToRunAsync", typeof(string), typeof(string), typeof(InternalSubmitToolOutputsRunRequest), typeof(CancellationToken))] |
| 24 | [CodeGenSuppress("SubmitToolOutputsToRun", typeof(string), typeof(string), typeof(InternalSubmitToolOutputsRunRequest), typeof(CancellationToken))] |
| 25 | [CodeGenSuppress("GetRunStepsAsync", typeof(string), typeof(string), typeof(int?), typeof(OpenAI.VectorStores.VectorStoreCollectionOrder?), typeof(string), typeof(string), typeof(IEnumerable<InternalIncludedRunStepProperty>), typeof(CancellationToken))] |
| 26 | [CodeGenSuppress("GetRunSteps", typeof(string), typeof(string), typeof(int?), typeof(OpenAI.VectorStores.VectorStoreCollectionOrder?), typeof(string), typeof(string), typeof(IEnumerable<InternalIncludedRunStepProperty>), typeof(CancellationToken))] |
| 27 | [CodeGenSuppress("GetRunStepAsync", typeof(string), typeof(string), typeof(string), typeof(IEnumerable<InternalIncludedRunStepProperty>), typeof(CancellationToken))] |
| 28 | [CodeGenSuppress("GetRunStep", typeof(string), typeof(string), typeof(string), typeof(IEnumerable<InternalIncludedRunStepProperty>), typeof(CancellationToken))] |
| 29 | internal partial class InternalAssistantRunClient |
| 30 | { |
| 31 | // CUSTOM: |
| 32 | // - Used a custom pipeline. |
| 33 | // - Demoted the endpoint parameter to be a property in the options class. |
| 34 | /// <summary> Initializes a new instance of <see cref="InternalAssistantRunClient"/>. </summary> |
| 35 | /// <param name="credential"> The API key to authenticate with the service. </param> |
| 36 | /// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception> |
| 37 | public InternalAssistantRunClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions()) |
| 38 | { |
| 39 | } |
| 40 | |
| 41 | // CUSTOM: |
| 42 | // - Used a custom pipeline. |
| 43 | // - Demoted the endpoint parameter to be a property in the options class. |
| 44 | /// <summary> Initializes a new instance of <see cref="InternalAssistantRunClient"/>. </summary> |
| 45 | /// <param name="credential"> The API key to authenticate with the service. </param> |
| 46 | /// <param name="options"> The options to configure the client. </param> |
| 47 | /// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception> |
| 48 | public InternalAssistantRunClient(ApiKeyCredential credential, OpenAIClientOptions options) |
| 49 | { |
| 50 | Argument.AssertNotNull(credential, nameof(credential)); |
| 51 | options ??= new OpenAIClientOptions(); |
| 52 | |
| 53 | Pipeline = OpenAIClient.CreatePipeline(credential, options); |
| 54 | _endpoint = OpenAIClient.GetEndpoint(options); |
| 55 | } |
| 56 | |
| 57 | // CUSTOM: |
| 58 | // - Used a custom pipeline. |
| 59 | // - Demoted the endpoint parameter to be a property in the options class. |
| 60 | // - Made protected. |
| 61 | /// <summary> Initializes a new instance of <see cref="InternalAssistantRunClient"/>. </summary> |
| 62 | /// <param name="pipeline"> The HTTP pipeline to send and receive REST requests and responses. </param> |
| 63 | /// <param name="options"> The options to configure the client. </param> |
| 64 | /// <exception cref="ArgumentNullException"> <paramref name="pipeline"/> is null. </exception> |
| 65 | protected internal InternalAssistantRunClient(ClientPipeline pipeline, OpenAIClientOptions options) |
| 66 | { |
| 67 | Argument.AssertNotNull(pipeline, nameof(pipeline)); |
| 68 | options ??= new OpenAIClientOptions(); |
| 69 | |
| 70 | Pipeline = pipeline; |
| 71 | _endpoint = OpenAIClient.GetEndpoint(options); |
| 72 | } |
| 73 | } |
| 74 | |