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

WIP on versioning problem #8

Draft
wants to merge 1 commit into
base: azoai-client-inheritance3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions tsp-output/@azure-tools/typespec-csharp/src/Generated/Chat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public virtual ClientResult<CreateChatCompletionResponse> 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());
}

Expand Down Expand Up @@ -92,7 +92,7 @@ public virtual async Task<ClientResult> 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));
}

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,5 +476,7 @@ internal CreateChatCompletionRequest()
/// A list of functions the model may generate JSON inputs for.
/// </summary>
public IList<ChatCompletionFunctions> Functions { get; }

public string? V2Feature { get; set; }
}
}
Loading