Skip to content
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

Powershell to plugin: replace all the PS fixup with plugin visitors #341

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 8 additions & 8 deletions .dotnet/api/OpenAI.netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public class AssistantModificationOptions : IJsonModel<AssistantModificationOpti
public static explicit operator AssistantModificationOptions(ClientResult result);
public static implicit operator BinaryContent(AssistantModificationOptions assistantModificationOptions);
}
public abstract class AssistantResponseFormat : IEquatable<AssistantResponseFormat>, IEquatable<string>, IJsonModel<AssistantResponseFormat>, IPersistableModel<AssistantResponseFormat> {
public class AssistantResponseFormat : IEquatable<AssistantResponseFormat>, IEquatable<string>, IJsonModel<AssistantResponseFormat>, IPersistableModel<AssistantResponseFormat> {
public static AssistantResponseFormat Auto { get; }
public static AssistantResponseFormat JsonObject { get; }
public static AssistantResponseFormat Text { get; }
Expand Down Expand Up @@ -714,7 +714,7 @@ public class RunStepTokenUsage : IJsonModel<RunStepTokenUsage>, IPersistableMode
public static explicit operator RunStepTokenUsage(ClientResult result);
public static implicit operator BinaryContent(RunStepTokenUsage runStepTokenUsage);
}
public abstract class RunStepToolCall : IJsonModel<RunStepToolCall>, IPersistableModel<RunStepToolCall> {
public class RunStepToolCall : IJsonModel<RunStepToolCall>, IPersistableModel<RunStepToolCall> {
public string CodeInterpreterInput { get; }
public IReadOnlyList<RunStepCodeInterpreterOutput> CodeInterpreterOutputs { get; }
public FileSearchRankingOptions FileSearchRankingOptions { get; }
Expand All @@ -734,7 +734,7 @@ public enum RunStepToolCallKind {
}
public class RunStepUpdate : StreamingUpdate<RunStep> {
}
public abstract class RunStepUpdateCodeInterpreterOutput : IJsonModel<RunStepUpdateCodeInterpreterOutput>, IPersistableModel<RunStepUpdateCodeInterpreterOutput> {
public class RunStepUpdateCodeInterpreterOutput : IJsonModel<RunStepUpdateCodeInterpreterOutput>, IPersistableModel<RunStepUpdateCodeInterpreterOutput> {
public string ImageFileId { get; }
public string Logs { get; }
public int OutputIndex { get; }
Expand Down Expand Up @@ -1948,7 +1948,7 @@ public enum ConversationContentModalities {
Text = 1,
Audio = 2
}
public abstract class ConversationContentPart : IJsonModel<ConversationContentPart>, IPersistableModel<ConversationContentPart> {
public class ConversationContentPart : IJsonModel<ConversationContentPart>, IPersistableModel<ConversationContentPart> {
public string AudioTranscript { get; }
public string Text { get; }
public static ConversationContentPart CreateInputAudioTranscriptPart(string transcript = null);
Expand Down Expand Up @@ -2074,7 +2074,7 @@ public class ConversationInputTranscriptionOptions : IJsonModel<ConversationInpu
public static explicit operator ConversationInputTranscriptionOptions(ClientResult result);
public static implicit operator BinaryContent(ConversationInputTranscriptionOptions conversationInputTranscriptionOptions);
}
public abstract class ConversationItem : IJsonModel<ConversationItem>, IPersistableModel<ConversationItem> {
public class ConversationItem : IJsonModel<ConversationItem>, IPersistableModel<ConversationItem> {
public string FunctionArguments { get; }
public string FunctionCallId { get; }
public string FunctionName { get; }
Expand Down Expand Up @@ -2381,7 +2381,7 @@ public class ConversationSessionStartedUpdate : ConversationUpdate, IJsonModel<C
public static bool operator !=(ConversationStatus left, ConversationStatus right);
public override readonly string ToString();
}
public abstract class ConversationStatusDetails : IJsonModel<ConversationStatusDetails>, IPersistableModel<ConversationStatusDetails> {
public class ConversationStatusDetails : IJsonModel<ConversationStatusDetails>, IPersistableModel<ConversationStatusDetails> {
public ConversationStatus StatusKind { get; }
public static explicit operator ConversationStatusDetails(ClientResult result);
public static implicit operator BinaryContent(ConversationStatusDetails conversationStatusDetails);
Expand Down Expand Up @@ -2446,14 +2446,14 @@ public enum ConversationTurnDetectionKind {
ServerVoiceActivityDetection = 0,
Disabled = 1
}
public abstract class ConversationTurnDetectionOptions : IJsonModel<ConversationTurnDetectionOptions>, IPersistableModel<ConversationTurnDetectionOptions> {
public class ConversationTurnDetectionOptions : IJsonModel<ConversationTurnDetectionOptions>, IPersistableModel<ConversationTurnDetectionOptions> {
public ConversationTurnDetectionKind Kind { get; protected internal set; }
public static ConversationTurnDetectionOptions CreateDisabledTurnDetectionOptions();
public static ConversationTurnDetectionOptions CreateServerVoiceActivityTurnDetectionOptions(float? detectionThreshold = null, TimeSpan? prefixPaddingDuration = null, TimeSpan? silenceDuration = null);
public static explicit operator ConversationTurnDetectionOptions(ClientResult result);
public static implicit operator BinaryContent(ConversationTurnDetectionOptions conversationTurnDetectionOptions);
}
public abstract class ConversationUpdate : IJsonModel<ConversationUpdate>, IPersistableModel<ConversationUpdate> {
public class ConversationUpdate : IJsonModel<ConversationUpdate>, IPersistableModel<ConversationUpdate> {
public string EventId { get; }
public ConversationUpdateKind Kind { get; protected internal set; }
public BinaryData GetRawContent();
Expand Down
8 changes: 4 additions & 4 deletions .dotnet/src/Custom/Audio/AudioClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public virtual async Task<ClientResult<AudioTranscription>> TranscribeAudioAsync
options ??= new();
CreateAudioTranscriptionOptions(audio, audioFilename, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(audio, audioFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(audio, audioFilename);
ClientResult result = await TranscribeAudioAsync(content, content.ContentType, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue(AudioTranscription.FromResponse(result.GetRawResponse()), result.GetRawResponse());
}
Expand All @@ -181,7 +181,7 @@ public virtual ClientResult<AudioTranscription> TranscribeAudio(Stream audio, st
options ??= new();
CreateAudioTranscriptionOptions(audio, audioFilename, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(audio, audioFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(audio, audioFilename);
ClientResult result = TranscribeAudio(content, content.ContentType, cancellationToken.ToRequestOptions());
return ClientResult.FromValue(AudioTranscription.FromResponse(result.GetRawResponse()), result.GetRawResponse());
}
Expand Down Expand Up @@ -243,7 +243,7 @@ public virtual async Task<ClientResult<AudioTranslation>> TranslateAudioAsync(St
options ??= new();
CreateAudioTranslationOptions(audio, audioFilename, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(audio, audioFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(audio, audioFilename);
ClientResult result = await TranslateAudioAsync(content, content.ContentType, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue(AudioTranslation.FromResponse(result.GetRawResponse()), result.GetRawResponse());
}
Expand All @@ -267,7 +267,7 @@ public virtual ClientResult<AudioTranslation> TranslateAudio(Stream audio, strin
options ??= new();
CreateAudioTranslationOptions(audio, audioFilename, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(audio, audioFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(audio, audioFilename);
ClientResult result = TranslateAudio(content, content.ContentType, cancellationToken.ToRequestOptions());
return ClientResult.FromValue(AudioTranslation.FromResponse(result.GetRawResponse()), result.GetRawResponse());
}
Expand Down
4 changes: 2 additions & 2 deletions .dotnet/src/Custom/Audio/AudioTranscriptionOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public AudioTranscriptionOptions()
/// </summary>
public AudioTimestampGranularities TimestampGranularities { get; set; }

internal MultipartFormDataBinaryContent ToMultipartContent(Stream audio, string audioFilename)
internal MultiPartFormDataBinaryContent ToMultipartContent(Stream audio, string audioFilename)
{
MultipartFormDataBinaryContent content = new();
MultiPartFormDataBinaryContent content = new();

content.Add(audio, "file", audioFilename);
content.Add(Model.ToString(), "model");
Expand Down
4 changes: 2 additions & 2 deletions .dotnet/src/Custom/Audio/AudioTranslationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public AudioTranslationOptions()
{
}

internal MultipartFormDataBinaryContent ToMultipartContent(Stream audio, string audioFilename)
internal MultiPartFormDataBinaryContent ToMultipartContent(Stream audio, string audioFilename)
{
MultipartFormDataBinaryContent content = new();
MultiPartFormDataBinaryContent content = new();

content.Add(audio, "file", audioFilename);
content.Add(Model.ToString(), "model");
Expand Down
4 changes: 4 additions & 0 deletions .dotnet/src/Custom/Chat/ChatMessageContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public ChatMessageContent(params ChatMessageContentPart[] contentParts)
{
}

internal ChatMessageContent(IDictionary<string, BinaryData> additionalBinaryDataProperties)
: this()
{ }

internal bool IsInnerCollectionDefined()
{
return !(Items is ChangeTrackingList<ChatMessageContentPart> changeTrackingList && changeTrackingList.IsUndefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public InternalFileUploadOptions()
{
}

internal MultipartFormDataBinaryContent ToMultipartContent(Stream file, string filename)
internal MultiPartFormDataBinaryContent ToMultipartContent(Stream file, string filename)
{
MultipartFormDataBinaryContent content = new();
MultiPartFormDataBinaryContent content = new();

content.Add(file, "file", filename);

Expand Down
4 changes: 2 additions & 2 deletions .dotnet/src/Custom/Files/OpenAIFileClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public virtual async Task<ClientResult<OpenAIFile>> UploadFileAsync(Stream file,
Purpose = purpose
};

using MultipartFormDataBinaryContent content = options.ToMultipartContent(file, filename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(file, filename);
ClientResult result = await UploadFileAsync(content, content.ContentType, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue((OpenAIFile)result, result.GetRawResponse());
}
Expand All @@ -123,7 +123,7 @@ public virtual ClientResult<OpenAIFile> UploadFile(Stream file, string filename,
Purpose = purpose
};

using MultipartFormDataBinaryContent content = options.ToMultipartContent(file, filename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(file, filename);
ClientResult result = UploadFile(content, content.ContentType, cancellationToken.ToRequestOptions());
return ClientResult.FromValue((OpenAIFile)result, result.GetRawResponse());
}
Expand Down
24 changes: 12 additions & 12 deletions .dotnet/src/Custom/Images/ImageClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public virtual async Task<ClientResult<GeneratedImage>> GenerateImageEditAsync(S
options ??= new();
CreateImageEditOptions(image, imageFilename, prompt, null, null, null, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, null, null);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, null, null);
ClientResult result = await GenerateImageEditsAsync(content, content.ContentType, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue(((GeneratedImageCollection)result).FirstOrDefault(), result.GetRawResponse());
}
Expand Down Expand Up @@ -220,7 +220,7 @@ public virtual ClientResult<GeneratedImage> GenerateImageEdit(Stream image, stri
options ??= new();
CreateImageEditOptions(image, imageFilename, prompt, null, null, null, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, null, null);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, null, null);
ClientResult result = GenerateImageEdits(content, content.ContentType, cancellationToken.ToRequestOptions());
return ClientResult.FromValue(((GeneratedImageCollection)result).FirstOrDefault(), result.GetRawResponse());
}
Expand Down Expand Up @@ -297,7 +297,7 @@ public virtual async Task<ClientResult<GeneratedImage>> GenerateImageEditAsync(S
options ??= new();
CreateImageEditOptions(image, imageFilename, prompt, mask, maskFilename, null, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, mask, maskFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, mask, maskFilename);
ClientResult result = await GenerateImageEditsAsync(content, content.ContentType, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue(((GeneratedImageCollection)result).FirstOrDefault(), result.GetRawResponse());
}
Expand Down Expand Up @@ -334,7 +334,7 @@ public virtual ClientResult<GeneratedImage> GenerateImageEdit(Stream image, stri
options ??= new();
CreateImageEditOptions(image, imageFilename, prompt, mask, maskFilename, null, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, mask, maskFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, mask, maskFilename);
ClientResult result = GenerateImageEdits(content, content.ContentType, cancellationToken.ToRequestOptions());
return ClientResult.FromValue(((GeneratedImageCollection)result).FirstOrDefault(), result.GetRawResponse());
}
Expand Down Expand Up @@ -420,7 +420,7 @@ public virtual async Task<ClientResult<GeneratedImageCollection>> GenerateImageE
options ??= new();
CreateImageEditOptions(image, imageFilename, prompt, null, null, imageCount, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, null, null);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, null, null);
ClientResult result = await GenerateImageEditsAsync(content, content.ContentType, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue((GeneratedImageCollection)result, result.GetRawResponse());
}
Expand Down Expand Up @@ -450,7 +450,7 @@ public virtual ClientResult<GeneratedImageCollection> GenerateImageEdits(Stream
options ??= new();
CreateImageEditOptions(image, imageFilename, prompt, null, null, imageCount, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, null, null);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, null, null);
ClientResult result = GenerateImageEdits(content, content.ContentType, cancellationToken.ToRequestOptions());
return ClientResult.FromValue((GeneratedImageCollection)result, result.GetRawResponse());
}
Expand Down Expand Up @@ -530,7 +530,7 @@ public virtual async Task<ClientResult<GeneratedImageCollection>> GenerateImageE
options ??= new();
CreateImageEditOptions(image, imageFilename, prompt, mask, maskFilename, imageCount, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, mask, maskFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, mask, maskFilename);
ClientResult result = await GenerateImageEditsAsync(content, content.ContentType, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue((GeneratedImageCollection)result, result.GetRawResponse());
}
Expand Down Expand Up @@ -568,7 +568,7 @@ public virtual ClientResult<GeneratedImageCollection> GenerateImageEdits(Stream
options ??= new();
CreateImageEditOptions(image, imageFilename, prompt, mask, maskFilename, imageCount, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, mask, maskFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename, mask, maskFilename);
ClientResult result = GenerateImageEdits(content, content.ContentType, cancellationToken.ToRequestOptions());
return ClientResult.FromValue((GeneratedImageCollection)result, result.GetRawResponse());
}
Expand Down Expand Up @@ -654,7 +654,7 @@ public virtual async Task<ClientResult<GeneratedImage>> GenerateImageVariationAs
options ??= new();
CreateImageVariationOptions(image, imageFilename, null, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename);
ClientResult result = await GenerateImageVariationsAsync(content, content.ContentType, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue(((GeneratedImageCollection)result).FirstOrDefault(), result.GetRawResponse());
}
Expand All @@ -678,7 +678,7 @@ public virtual ClientResult<GeneratedImage> GenerateImageVariation(Stream image,
options ??= new();
CreateImageVariationOptions(image, imageFilename, null, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename);
ClientResult result = GenerateImageVariations(content, content.ContentType, cancellationToken.ToRequestOptions());
return ClientResult.FromValue(((GeneratedImageCollection)result).FirstOrDefault(), result.GetRawResponse());
}
Expand Down Expand Up @@ -739,7 +739,7 @@ public virtual async Task<ClientResult<GeneratedImageCollection>> GenerateImageV
options ??= new();
CreateImageVariationOptions(image, imageFilename, imageCount, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename);
ClientResult result = await GenerateImageVariationsAsync(content, content.ContentType, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
return ClientResult.FromValue((GeneratedImageCollection)result, result.GetRawResponse());
}
Expand All @@ -764,7 +764,7 @@ public virtual ClientResult<GeneratedImageCollection> GenerateImageVariations(St
options ??= new();
CreateImageVariationOptions(image, imageFilename, imageCount, ref options);

using MultipartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename);
using MultiPartFormDataBinaryContent content = options.ToMultipartContent(image, imageFilename);
ClientResult result = GenerateImageVariations(content, content.ContentType, cancellationToken.ToRequestOptions());
return ClientResult.FromValue((GeneratedImageCollection)result, result.GetRawResponse());
}
Expand Down
Loading