Skip to content

Commit 71c94d4

Browse files
authored
Merge pull request #651 from betalgo/dev
8.7.2
2 parents aee7aab + 921ba2c commit 71c94d4

File tree

7 files changed

+70
-26
lines changed

7 files changed

+70
-26
lines changed

OpenAI.SDK/EndpointProviders/AzureOpenAiEndpointProvider.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ public AzureOpenAiEndpointProvider(string apiVersion, string deploymentId)
2020
private string Prefix => $"{ApiPrefix}/{DeploymentsPrefix}/{WebUtility.UrlEncode(_deploymentId)}";
2121
private string AzureVersionQueryString => $"?api-version={_apiVersion}";
2222
private string AssistantPrefix => $"{ApiPrefix}/";
23+
private string DataPlanePrefix => $"{ApiPrefix}/";
2324

2425
public string ModelRetrieve(string model)
2526
{
26-
return $"{Prefix}/models/{model}{AzureVersionQueryString}";
27+
return $"{DataPlanePrefix}/models/{model}{AzureVersionQueryString}";
2728
}
2829

2930
public string FileDelete(string fileId)
3031
{
31-
return $"{Prefix}/files/{fileId}{AzureVersionQueryString}";
32+
return $"{DataPlanePrefix}/files/{fileId}{AzureVersionQueryString}";
3233
}
3334

3435
public string CompletionCreate()
@@ -43,7 +44,7 @@ public string EditCreate()
4344

4445
public string ModelsList()
4546
{
46-
return $"{Prefix}/models{AzureVersionQueryString}";
47+
return $"{DataPlanePrefix}/models{AzureVersionQueryString}";
4748
}
4849

4950
public string FilesList()
@@ -58,12 +59,12 @@ public string FilesUpload()
5859

5960
public string FileRetrieve(string fileId)
6061
{
61-
return $"{Prefix}/files/{fileId}{AzureVersionQueryString}";
62+
return $"{DataPlanePrefix}/files/{fileId}{AzureVersionQueryString}";
6263
}
6364

6465
public string FileRetrieveContent(string fileId)
6566
{
66-
return $"{Prefix}/files/{fileId}/content{AzureVersionQueryString}";
67+
return $"{DataPlanePrefix}/files/{fileId}/content{AzureVersionQueryString}";
6768
}
6869

6970
public string FineTuneCreate()
@@ -93,17 +94,17 @@ public string FineTuneListEvents(string fineTuneId)
9394

9495
public string FineTuneDelete(string fineTuneId)
9596
{
96-
return $"{Prefix}/models/{fineTuneId}{AzureVersionQueryString}";
97+
return $"{DataPlanePrefix}/fine_tuning/jobs/{fineTuneId}{AzureVersionQueryString}";
9798
}
9899

99100
public string FineTuningJobCreate()
100101
{
101-
return $"{Prefix}/fine_tuning/jobs{AzureVersionQueryString}";
102+
return $"{DataPlanePrefix}/fine_tuning/jobs{AzureVersionQueryString}";
102103
}
103104

104105
public string FineTuningJobList(FineTuningJobListRequest? fineTuningJobListRequest)
105106
{
106-
var url = $"{Prefix}/fine_tuning/jobs";
107+
var url = $"{DataPlanePrefix}/fine_tuning/jobs";
107108
if (fineTuningJobListRequest != null)
108109
{
109110
var queryParams = new List<string>();
@@ -121,22 +122,22 @@ public string FineTuningJobList(FineTuningJobListRequest? fineTuningJobListReque
121122

122123
public string FineTuningJobRetrieve(string fineTuningJobId)
123124
{
124-
return $"{Prefix}/fine_tuning/jobs/{fineTuningJobId}{AzureVersionQueryString}";
125+
return $"{DataPlanePrefix}/fine_tuning/jobs/{fineTuningJobId}{AzureVersionQueryString}";
125126
}
126127

127128
public string FineTuningJobCancel(string fineTuningJobId)
128129
{
129-
return $"{Prefix}/fine_tuning/jobs/{fineTuningJobId}/cancel{AzureVersionQueryString}";
130+
return $"{DataPlanePrefix}/fine_tuning/jobs/{fineTuningJobId}/cancel{AzureVersionQueryString}";
130131
}
131132

132133
public string FineTuningJobListEvents(string fineTuningJobId)
133134
{
134-
return $"{Prefix}/fine_tuning/jobs/{fineTuningJobId}/events{AzureVersionQueryString}";
135+
return $"{DataPlanePrefix}/fine_tuning/jobs/{fineTuningJobId}/events{AzureVersionQueryString}";
135136
}
136137

137138
public string ModelsDelete(string modelId)
138139
{
139-
return $"{Prefix}/models/{modelId}{AzureVersionQueryString}";
140+
return $"{DataPlanePrefix}/models/{modelId}{AzureVersionQueryString}";
140141
}
141142

142143
public string EmbeddingCreate()
@@ -451,26 +452,26 @@ public string VectorStoreFileBatchList(string vectorStoreId, string batchId, Pag
451452

452453
public string BatchCreate()
453454
{
454-
return $"{Prefix}/batches{AzureVersionQueryString}";
455+
return $"{DataPlanePrefix}/batches{AzureVersionQueryString}";
455456
}
456457

457458
public string BatchRetrieve(string batchId)
458459
{
459-
return $"{Prefix}/batches/{batchId}{AzureVersionQueryString}";
460+
return $"{DataPlanePrefix}/batches/{batchId}{AzureVersionQueryString}";
460461
}
461462

462463
public string BatchCancel(string batchId)
463464
{
464-
return $"{Prefix}/batches/{batchId}/cancel{AzureVersionQueryString}";
465+
return $"{DataPlanePrefix}/batches/{batchId}/cancel{AzureVersionQueryString}";
465466
}
466467

467468
public string FineTuningJobList()
468469
{
469-
return $"{Prefix}/fine_tuning/jobs{AzureVersionQueryString}";
470+
return $"{DataPlanePrefix}/fine_tuning/jobs{AzureVersionQueryString}";
470471
}
471472

472473
private string Files()
473474
{
474-
return $"{Prefix}/files{AzureVersionQueryString}";
475+
return $"{DataPlanePrefix}/files{AzureVersionQueryString}";
475476
}
476477
}

OpenAI.SDK/ObjectModels/Models.cs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ public enum Model
9898
Gpt_4_turbo_2024_04_09,
9999
Gpt_4o,
100100
Gpt_4o_2024_05_13,
101+
Gpt_4o_2024_08_06,
101102
Gpt_4o_mini,
102103
Gpt_4o_mini_2024_07_18,
104+
Chatgpt_4o_latest,
103105

104106
WhisperV1,
105107

@@ -213,18 +215,27 @@ public enum Subject
213215
public static string Gpt_4_turbo_2024_04_09 => "gpt-4-turbo-2024-04-09";
214216

215217
/// <summary>
216-
/// Our most advanced, multimodal flagship model that’s cheaper and faster than GPT-4 Turbo.
217-
/// Currently points to gpt-4o-2024-05-13.
218-
/// 128,000 tokens Up to Oct 2023
218+
/// GPT-4o: Our high-intelligence flagship model for complex, multi-step tasks. GPT-4o is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-08-06.
219+
/// Context Window: 128,000 tokens
220+
/// Max output tokens: 16,384 tokens
221+
/// Training data: Up to Oct 2023
219222
/// </summary>
220223
public static string Gpt_4o => "gpt-4o";
221224

222225
/// <summary>
223-
/// Our most advanced, multimodal flagship model that’s cheaper and faster than GPT-4 Turbo.
224-
/// Currently points to gpt-4o-2024-05-13.
225-
/// 128,000 tokens Up to Oct 2023
226+
/// Original gpt-4o snapshot from May 13, 2024.
227+
/// Context Window: 128,000 tokens
228+
/// Max output tokens: 4,096 tokens
229+
/// Training data: Up to Oct 2023
226230
/// </summary>
227231
public static string Gpt_4o_2024_05_13 => "gpt-4o-2024-05-13";
232+
/// <summary>
233+
/// Latest snapshot that supports Structured Outputs. gpt-4o currently points to this version.
234+
/// Context Window: 128,000 tokens
235+
/// Max output tokens: 16,384 tokens
236+
/// Training data: Up to Oct 2023
237+
/// </summary>
238+
public static string Gpt_4o_2024_08_06 => "gpt-4o-2024-08-06";
228239

229240
/// <summary>
230241
/// Our affordable and intelligent small model for fast, lightweight tasks.
@@ -242,6 +253,11 @@ public enum Subject
242253
/// </summary>
243254
public static string Gpt_4o_mini_2024_07_18 => "gpt-4o-mini-2024-07-18";
244255

256+
/// <summary>
257+
/// Dynamic model continuously updated to the current version of GPT-4o in ChatGPT. <a href="https://platform.openai.com/docs/models#4ofootnote">Intended for research and evaluation [1]</a>.
258+
/// </summary>
259+
public static string Chatgpt_4o_latest => "chatgpt-4o-latest";
260+
245261

246262
public static string Ada => "ada";
247263
public static string Babbage => "babbage";
@@ -495,8 +511,10 @@ public static string EnumToString(this Model model)
495511
Model.Gpt_4_turbo_2024_04_09 => Gpt_4_turbo_2024_04_09,
496512
Model.Gpt_4o => Gpt_4o,
497513
Model.Gpt_4o_2024_05_13 => Gpt_4o_2024_05_13,
514+
Model.Gpt_4o_2024_08_06 => Gpt_4o_2024_08_06,
498515
Model.Gpt_4o_mini => Gpt_4o_mini,
499516
Model.Gpt_4o_mini_2024_07_18 => Gpt_4o_mini_2024_07_18,
517+
Model.Chatgpt_4o_latest => Chatgpt_4o_latest,
500518
Model.Tts_1 => Tts_1,
501519
Model.Tts_1_hd => Tts_1_hd,
502520
Model.Text_moderation_007 => TextModeration007,

OpenAI.SDK/ObjectModels/ResponseModels/CompletionTokensDetails.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ public record CompletionTokensDetails
66
{
77
[JsonPropertyName("reasoning_tokens")]
88
public int ReasoningTokens { get; set; }
9+
[JsonPropertyName("audio_tokens")]
10+
public int AudioTokens { get; set; }
911
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace OpenAI.ObjectModels.ResponseModels
4+
{
5+
public class PromptTokensDetails
6+
{
7+
[JsonPropertyName("cached_tokens")]
8+
public int? CachedTokens { get; set; }
9+
[JsonPropertyName("audio_tokens")]
10+
public int? AudioTokens { get; set; }
11+
}
12+
}
13+

OpenAI.SDK/ObjectModels/ResponseModels/UsageResponse.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ public record UsageResponse
1515

1616
[JsonPropertyName("completion_tokens_details")]
1717
public CompletionTokensDetails? CompletionTokensDetails { get; set; }
18-
}
18+
19+
[JsonPropertyName("prompt_tokens_details")]
20+
public PromptTokensDetails? PromptTokensDetails { get; set; }
21+
22+
}

OpenAI.SDK/OpenAI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<PackageIcon>Betalgo-Ranul-OpenAI-icon.png</PackageIcon>
1111
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1212
<Title>OpenAI SDK by Betalgo</Title>
13-
<Version>8.7.1</Version>
13+
<Version>8.7.2</Version>
1414
<Authors>Tolga Kayhan, Betalgo</Authors>
1515
<Company>Betalgo Up Ltd.</Company>
1616
<Product>OpenAI ChatGPT, Whisper, GPT-4 and DALL·E dotnet SDK</Product>

Readme.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,14 @@ Due to time constraints, not all methods have been thoroughly tested or fully do
115115
Needless to say, I cannot accept responsibility for any damage caused by using the library.
116116

117117
## Changelog
118+
### 8.7.2
119+
- Fixed incorrect Azure Urls.
120+
- Token usage response extended with `PromptTokensDetails`, `audio_tokens` and `cached_tokens`.
121+
- Model list extended with `Gpt_4o_2024_08_06` and `Chatgpt_4o_latest`.
122+
118123
### 8.7.1
119-
- moved `strict ` paremeter from `ToolDefinition` to `FunctionDefinition`
124+
- moved `strict` paremeter from `ToolDefinition` to `FunctionDefinition`
125+
120126
### 8.7.0
121127
- Added Support for o1 reasing models (`o1-mini` and `o1-preview`).
122128
- Added `MaxCompletionTokens` for `chat completions`.

0 commit comments

Comments
 (0)