From dfe570459058d5916164913c7012b2011ff1ee9e Mon Sep 17 00:00:00 2001 From: Anne Thompson Date: Thu, 25 Apr 2024 11:53:48 -0700 Subject: [PATCH] WIP on versioning problem --- .../typespec-csharp/src/Generated/Chat.cs | 17 +++++++++++++---- .../Models/CreateChatCompletionRequest.cs | 2 ++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tsp-output/@azure-tools/typespec-csharp/src/Generated/Chat.cs b/tsp-output/@azure-tools/typespec-csharp/src/Generated/Chat.cs index f142108fc..453169e22 100644 --- a/tsp-output/@azure-tools/typespec-csharp/src/Generated/Chat.cs +++ b/tsp-output/@azure-tools/typespec-csharp/src/Generated/Chat.cs @@ -64,7 +64,7 @@ public virtual ClientResult CreateChatCompletion(C RequestOptions context = FromCancellationToken(cancellationToken); using BinaryContent content = createChatCompletionRequest.ToBinaryBody(); - ClientResult result = CreateChatCompletion(content, context); + ClientResult result = CreateChatCompletion(createChatCompletionRequest.V2Feature, content, context); return ClientResult.FromValue(CreateChatCompletionResponse.FromResponse(result.GetRawResponse()), result.GetRawResponse()); } @@ -92,7 +92,7 @@ public virtual async Task CreateChatCompletionAsync(BinaryContent { Argument.AssertNotNull(content, nameof(content)); - using PipelineMessage message = CreateCreateChatCompletionRequest(content, context); + using PipelineMessage message = CreateCreateChatCompletionRequest(v2Feature: default, content, context); return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false)); } @@ -120,11 +120,20 @@ public virtual ClientResult CreateChatCompletion(BinaryContent content, RequestO { Argument.AssertNotNull(content, nameof(content)); - using PipelineMessage message = CreateCreateChatCompletionRequest(content, context); + using PipelineMessage message = CreateCreateChatCompletionRequest(v2Feature: default, content, context); return ClientResult.FromResponse(_pipeline.ProcessMessage(message, context)); } - internal PipelineMessage CreateCreateChatCompletionRequest(BinaryContent content, RequestOptions context) + public virtual ClientResult CreateChatCompletion(string v2Feature, BinaryContent content, RequestOptions context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreateCreateChatCompletionRequest(v2Feature, content, context); + return ClientResult.FromResponse(_pipeline.ProcessMessage(message, context)); + } + + // Question: is the v2feature property optional or required on the request creation helper method? + internal PipelineMessage CreateCreateChatCompletionRequest(string v2Feature, BinaryContent content, RequestOptions context) { var message = _pipeline.CreateMessage(); if (context != null) diff --git a/tsp-output/@azure-tools/typespec-csharp/src/Generated/Models/CreateChatCompletionRequest.cs b/tsp-output/@azure-tools/typespec-csharp/src/Generated/Models/CreateChatCompletionRequest.cs index 4f23bf189..56c97330a 100644 --- a/tsp-output/@azure-tools/typespec-csharp/src/Generated/Models/CreateChatCompletionRequest.cs +++ b/tsp-output/@azure-tools/typespec-csharp/src/Generated/Models/CreateChatCompletionRequest.cs @@ -476,5 +476,7 @@ internal CreateChatCompletionRequest() /// A list of functions the model may generate JSON inputs for. /// public IList Functions { get; } + + public string? V2Feature { get; set; } } }