Skip to content

Commit 2d77676

Browse files
jpalvarezljnlycklama
authored andcommitted
[OpenAI] Refactor project structure (#25986)
* Somehow after compiling the examples are gone * Renamed model files * Re-structured project * Added fix for example directory * Corrected example * Corrected documentation issue * Added new word to custom-word list
1 parent e37a1e5 commit 2d77676

File tree

28 files changed

+314
-233
lines changed

28 files changed

+314
-233
lines changed

custom-words.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,7 @@ findsquare
967967
finetune
968968
finetunes
969969
firmwares
970+
flac
970971
flexera
971972
flink
972973
flowlet
@@ -1644,6 +1645,7 @@ moodle
16441645
mooncake
16451646
mountainview
16461647
movere
1648+
mpga
16471649
mpls
16481650
mpns
16491651
mran

specification/cognitiveservices/OpenAI.Inference/examples/2023-09-01-preview/audio_transcription_object.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"parameters": {
55
"endpoint": "{endpoint}",
66
"api-version": "2023-09-01-preview",
7-
"deploymentId": "<deployment-id>"
7+
"deploymentId": "<deployment-id>",
8+
"body": "---multipart-boundary\nContent-Disposition: form-data; name=\"file\"; filename=\"file.wav\"\nContent-Type: application/octet-stream\n\nRIFF..audio.data.omitted\n---multipart-boundary--"
89
},
910
"responses": {
1011
"200": {

specification/cognitiveservices/OpenAI.Inference/main.tsp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import "@typespec/rest";
21
import "@typespec/http";
32
import "@typespec/versioning";
43

5-
import "./routes.tsp";
4+
import "./routes/common.tsp";
5+
import "./routes/audio_transcription.tsp";
6+
import "./routes/audio_translation.tsp";
7+
import "./routes/completions.tsp";
8+
import "./routes/images.tsp";
9+
import "./routes/embeddings.tsp";
610

711
using TypeSpec.Http;
8-
using TypeSpec.Rest;
912
using TypeSpec.Versioning;
1013

1114
#suppress "@azure-tools/typespec-azure-core/casing-style" "OpenAI is a case-sensitive name"
@@ -56,13 +59,3 @@ enum ServiceApiVersions {
5659
@useDependency(Azure.Core.Versions.v1_0_Preview_1)
5760
v2023_09_01_Preview: "2023-09-01-preview",
5861
}
59-
60-
@doc("A specific deployment")
61-
@TypeSpec.Rest.resource("deployments")
62-
model Deployment {
63-
@visibility("read")
64-
@doc("Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.")
65-
@projectedName("java", "deploymentOrModelName")
66-
@key
67-
deploymentId: string;
68-
}

specification/cognitiveservices/OpenAI.Inference/models/audio.transcription.tsp renamed to specification/cognitiveservices/OpenAI.Inference/models/audio/audio_transcription.tsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import "@typespec/versioning";
2-
import "./audio.common.tsp";
2+
import "./common.tsp";
33

44
namespace Azure.OpenAI;
55

@@ -36,7 +36,7 @@ The configuration information for an audio transcription request.
3636
model AudioTranscriptionOptions {
3737
@doc("""
3838
The audio data to transcribe. This must be the binary content of a file in one of the supported media formats:
39-
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm.
39+
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm.
4040
""")
4141
@projectedName("csharp", "AudioData")
4242
file: bytes;

specification/cognitiveservices/OpenAI.Inference/models/audio.translation.tsp renamed to specification/cognitiveservices/OpenAI.Inference/models/audio/audio_translation.tsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import "@typespec/versioning";
2-
import "./audio.common.tsp";
2+
import "./common.tsp";
33

44
namespace Azure.OpenAI;
55

@@ -36,7 +36,7 @@ The configuration information for an audio translation request.
3636
model AudioTranslationOptions {
3737
@doc("""
3838
The audio data to translate. This must be the binary content of a file in one of the supported media formats:
39-
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm.
39+
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm.
4040
""")
4141
@projectedName("csharp", "AudioData")
4242
file: bytes;

specification/cognitiveservices/OpenAI.Inference/models/audio.common.tsp renamed to specification/cognitiveservices/OpenAI.Inference/models/audio/common.tsp

File renamed without changes.

specification/cognitiveservices/OpenAI.Inference/models/azure.chat.extensions.tsp renamed to specification/cognitiveservices/OpenAI.Inference/models/completions/azure_chat_extensions.tsp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "@typespec/versioning";
2-
import "./chat.completions.tsp";
3-
import "./azure.cognitive.search.options.tsp";
2+
3+
import "./chat_completions.tsp";
4+
import "./azure_cognitive_search_options.tsp";
45

56
namespace Azure.OpenAI;
67

specification/cognitiveservices/OpenAI.Inference/models/azure.cognitive.search.options.tsp renamed to specification/cognitiveservices/OpenAI.Inference/models/completions/azure_cognitive_search_options.tsp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import "@typespec/versioning";
2-
import "./azure.chat.extensions.tsp";
2+
3+
import "./azure_chat_extensions.tsp";
34

45
namespace Azure.OpenAI;
56

specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp renamed to specification/cognitiveservices/OpenAI.Inference/models/completions/chat_completions.tsp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import "@typespec/rest";
22
import "@typespec/http";
33
import "@typespec/versioning";
4-
import "./azure.chat.extensions.tsp";
5-
import "./completions.common.tsp";
4+
5+
import "./azure_chat_extensions.tsp";
6+
import "./common.tsp";
67
import "./functions.tsp";
78

89
using TypeSpec.Rest;
@@ -231,8 +232,8 @@ model ChatChoice {
231232
delta?: ChatMessage;
232233

233234
@doc("""
234-
Information about the content filtering category (hate, sexual, violence, self_harm), if it
235-
has been detected, as well as the severity level (very_low, low, medium, high-scale that
235+
Information about the content filtering category (hate, sexual, violence, self_harm), if it
236+
has been detected, as well as the severity level (very_low, low, medium, high-scale that
236237
determines the intensity and risk level of harmful content) and if it has been filtered or not.
237238
""")
238239
@added(ServiceApiVersions.v2023_06_01_Preview)
@@ -268,7 +269,7 @@ model ChatCompletions {
268269
choices: ChatChoice[];
269270

270271
@doc("""
271-
Content filtering results for zero or more prompts in the request. In a streaming request,
272+
Content filtering results for zero or more prompts in the request. In a streaming request,
272273
results for different prompts may arrive at different times or in different orders.
273274
""")
274275
@added(ServiceApiVersions.v2023_06_01_Preview)

specification/cognitiveservices/OpenAI.Inference/models/completions.common.tsp renamed to specification/cognitiveservices/OpenAI.Inference/models/completions/common.tsp

File renamed without changes.

0 commit comments

Comments
 (0)