Skip to content

Commit 2557a4e

Browse files
jpalvarezlm-nash
andauthored
Renaming fields for clarity AOAI Inference (Azure#33871)
* Renamed fields added * Removed empty comment line * Renamed class file * update generator and regen * regen after merge * update api * revert unintended version change --------- Co-authored-by: m-nash <prognash@gmail.com>
1 parent 117a1e0 commit 2557a4e

11 files changed

+120
-84
lines changed

eng/Packages.Data.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
All should have PrivateAssets="All" set so they don't become package dependencies
161161
-->
162162
<ItemGroup>
163-
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20230203.2" PrivateAssets="All" />
163+
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20230203.3" PrivateAssets="All" />
164164
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20230131.1" PrivateAssets="All" />
165165
<PackageReference Update="coverlet.collector" Version="1.3.0" PrivateAssets="All" />
166166
<PackageReference Update="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1" PrivateAssets="All" />

eng/emitter-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"main": "dist/src/index.js",
33
"dependencies": {
4-
"@azure-tools/cadl-csharp": "0.1.11-beta.20230203.2"
4+
"@azure-tools/cadl-csharp": "0.1.11-beta.20230203.3"
55
}
66
}

sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public partial class Choice
55
internal Choice() { }
66
public string FinishReason { get { throw null; } }
77
public int? Index { get { throw null; } }
8-
public Azure.AI.OpenAI.CompletionsLogProbs Logprobs { get { throw null; } }
8+
public Azure.AI.OpenAI.CompletionsLogProbability Logprobs { get { throw null; } }
99
public string Text { get { throw null; } }
1010
}
1111
public partial class Completions
@@ -18,32 +18,32 @@ internal Completions() { }
1818
public string Object { get { throw null; } }
1919
public Azure.AI.OpenAI.CompletionsUsage Usage { get { throw null; } }
2020
}
21-
public partial class CompletionsLogProbs
21+
public partial class CompletionsLogProbability
2222
{
23-
internal CompletionsLogProbs() { }
23+
internal CompletionsLogProbability() { }
2424
public System.Collections.Generic.IReadOnlyList<int> TextOffset { get { throw null; } }
25-
public System.Collections.Generic.IReadOnlyList<float> TokenLogprobs { get { throw null; } }
25+
public System.Collections.Generic.IReadOnlyList<float> TokenLogProbability { get { throw null; } }
2626
public System.Collections.Generic.IReadOnlyList<string> Tokens { get { throw null; } }
27-
public System.Collections.Generic.IReadOnlyList<System.Collections.Generic.IDictionary<string, float>> TopLogprobs { get { throw null; } }
27+
public System.Collections.Generic.IReadOnlyList<System.Collections.Generic.IDictionary<string, float>> TopLogProbability { get { throw null; } }
2828
}
2929
public partial class CompletionsOptions
3030
{
3131
public CompletionsOptions() { }
32-
public int? BestOf { get { throw null; } set { } }
3332
public int? CacheLevel { get { throw null; } set { } }
3433
public string CompletionConfig { get { throw null; } set { } }
3534
public bool? Echo { get { throw null; } set { } }
3635
public float? FrequencyPenalty { get { throw null; } set { } }
36+
public int? GenerationSampleCount { get { throw null; } set { } }
3737
public System.Collections.Generic.IDictionary<string, int> LogitBias { get { throw null; } }
38-
public int? Logprobs { get { throw null; } set { } }
38+
public int? LogProbability { get { throw null; } set { } }
3939
public int? MaxTokens { get { throw null; } set { } }
4040
public string Model { get { throw null; } set { } }
41-
public int? N { get { throw null; } set { } }
41+
public float? NucleusSamplingFactor { get { throw null; } set { } }
4242
public float? PresencePenalty { get { throw null; } set { } }
4343
public System.Collections.Generic.IList<string> Prompt { get { throw null; } }
44+
public int? SnippetCount { get { throw null; } set { } }
4445
public System.Collections.Generic.IList<string> Stop { get { throw null; } }
4546
public float? Temperature { get { throw null; } set { } }
46-
public float? TopP { get { throw null; } set { } }
4747
public string User { get { throw null; } set { } }
4848
}
4949
public partial class CompletionsUsage

sdk/openai/Azure.AI.OpenAI/src/Custom/Choice.Serialization.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal static Choice DeserializeChoice(JsonElement element)
1717
{
1818
Optional<string> text = default;
1919
Optional<int?> index = default;
20-
Optional<CompletionsLogProbs> logprobs = default;
20+
Optional<CompletionsLogProbability> logprobs = default;
2121
Optional<string> finishReason = default;
2222
foreach (var property in element.EnumerateObject())
2323
{
@@ -45,7 +45,7 @@ internal static Choice DeserializeChoice(JsonElement element)
4545
}
4646
else
4747
{
48-
logprobs = CompletionsLogProbs.DeserializeCompletionsLogProbs(property.Value);
48+
logprobs = CompletionsLogProbability.DeserializeCompletionsLogProbability(property.Value);
4949
continue;
5050
}
5151
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System.Collections.Generic;
7+
using Azure.Core;
8+
9+
namespace Azure.AI.OpenAI
10+
{
11+
/// <summary> LogProbs model within completion choice. </summary>
12+
[CodeGenModel("CompletionsLogProbs")]
13+
public partial class CompletionsLogProbability
14+
{
15+
/// <summary> Log Probability of Tokens. </summary>
16+
[CodeGenMember("TokenLogprobs")]
17+
public IReadOnlyList<float> TokenLogProbability { get; }
18+
/// <summary> Top Log Probabilities. </summary>
19+
[CodeGenMember("TopLogprobs")]
20+
public IReadOnlyList<IDictionary<string, float>> TopLogProbability { get; }
21+
}
22+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using Azure.Core;
9+
10+
namespace Azure.AI.OpenAI
11+
{
12+
public partial class CompletionsOptions
13+
{
14+
/// <summary>
15+
/// An alternative to sampling with temperature, called nucleus sampling, where the
16+
/// model considers the results of the tokens with top_p probability mass. So 0.1
17+
/// means only the tokens comprising the top 10% probability mass are
18+
/// considered.
19+
/// We generally recommend using this or `temperature` but not
20+
/// both.
21+
/// Minimum of 0 and maximum of 1 allowed.
22+
/// </summary>
23+
[CodeGenMember("TopP")]
24+
public float? NucleusSamplingFactor { get; set; }
25+
/// <summary>
26+
/// How many snippets to generate for each prompt. Minimum of 1 and maximum of 128
27+
/// allowed.
28+
/// </summary>
29+
[CodeGenMember("N")]
30+
public int? SnippetCount { get; set; }
31+
/// <summary>
32+
/// Include the log probabilities on the `logprobs` most likely tokens, as well the
33+
/// chosen tokens. So for example, if `logprobs` is 10, the API will return a list
34+
/// of the 10 most likely tokens. If `logprobs` is 0, only the chosen tokens will
35+
/// have logprobs returned. Minimum of 0 and maximum of 100 allowed.
36+
/// </summary>
37+
[CodeGenMember("Logprobs")]
38+
public int? LogProbability { get; set; }
39+
/// <summary>
40+
/// How many generations to create server side, and display only the best. Will not
41+
/// stream intermediate progress if best_of &gt; 1. Has maximum value of 128.
42+
/// </summary>
43+
[CodeGenMember("BestOf")]
44+
public int? GenerationSampleCount { get; set; }
45+
}
46+
}

sdk/openai/Azure.AI.OpenAI/src/Generated/Choice.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/openai/Azure.AI.OpenAI/src/Generated/CompletionsLogProbs.Serialization.cs renamed to sdk/openai/Azure.AI.OpenAI/src/Generated/CompletionsLogProbability.Serialization.cs

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/openai/Azure.AI.OpenAI/src/Generated/CompletionsLogProbs.cs renamed to sdk/openai/Azure.AI.OpenAI/src/Generated/CompletionsLogProbability.cs

Lines changed: 11 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/openai/Azure.AI.OpenAI/src/Generated/CompletionsOptions.Serialization.cs

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)