-
Notifications
You must be signed in to change notification settings - Fork 5.1k
/
main.tsp
57 lines (51 loc) · 1.21 KB
/
main.tsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import "@typespec/rest";
import "@typespec/http";
import "@typespec/versioning";
import "./routes.tsp";
using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
@useAuth(
ApiKeyAuth<ApiKeyLocation.header, "api-key"> |
OAuth2Auth<[{
type: OAuth2FlowType.implicit,
authorizationUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
scopes: ["https://cognitiveservices.azure.com/.default"]
}]>)
@service(
{
title: "Azure OpenAI API"
})
@server(
"{endpoint}/openai",
"Azure OpenAI APIs for completions and search",
{
@doc("""
Supported Cognitive Services endpoints (protocol and hostname, for example:
https://westus.api.cognitive.microsoft.com).
""")
endpoint: string,
}
)
@versioned(ServiceApiVersions)
@versionedDependency(
[
[
ServiceApiVersions.v2022_12_01,
Azure.Core.Versions.v1_0_Preview_1
]
]
)
@doc("Azure OpenAI APIs for completions and search")
namespace Azure.OpenAI;
enum ServiceApiVersions {
v2022_12_01: "2022-12-01",
}
@doc("A specific deployment")
@TypeSpec.Rest.resource("deployments")
model Deployment {
@visibility("read")
@doc("deployment id of the deployed model")
@key
deploymentId: string;
}