-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathactions.tsp
More file actions
83 lines (70 loc) · 1.83 KB
/
actions.tsp
File metadata and controls
83 lines (70 loc) · 1.83 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import "@typespec/http";
import "@microsoft/typespec-m365-copilot";
using TypeSpec.Http;
using TypeSpec.M365.Copilot.Actions;
@service
@server(AzureOpenAPI.SERVER_URL)
@actions(AzureOpenAPI.ACTIONS_METADATA)
namespace AzureOpenAPI {
/**
* Metadata for the AzureOpenAPI API actions.
*/
const ACTIONS_METADATA = #{
nameForHuman: "AzureOpenAPI",
descriptionForHuman: "Query AzureOpenAPI.",
descriptionForModel: "Query AzureOpenAPI.",
};
/**
* The base URL for the AzureOpenAPI API.
*/
const SERVER_URL = "<SERVER_URL>";
const MODEL = "gpt-4o";
const TEMPERATURE = 0.7;
const TOP_P = 0.95;
const MAX_TOKENS = 1024;
const PRESENCE_PENALTY = 0.0;
const FREQUENCY_PENALTY = 0.0;
@doc("Searches for volunteering opportunities using Azure Open API")
@useAuth(ApiKeyAuth<ApiKeyLocation.header, "api-key">)
@route("/openai/deployments/${MODEL}/chat/completions")
@post
op searchVolunteerOpportunities(
@body post: ChatCompletionsRequest,
@query("api-version") apiVersion: string = "2025-01-01-preview",
): ChatCompletionsResponse;
model ChatCompletionsRequest {
messages: Message[];
temperature?: float32 = TEMPERATURE;
top_p?: float32 = TOP_P;
max_tokens?: int32 = MAX_TOKENS;
n?: int32 = 1;
stop?: string[];
presence_penalty?: float32 = PRESENCE_PENALTY;
frequency_penalty?: float32 = FREQUENCY_PENALTY;
}
model Message {
role: "system" | "user" | "assistant";
content: Content[];
}
model Content {
type: "text";
text: string
}
model ChatCompletionsResponse {
id: string;
choices: Choice[];
usage: Usage;
}
model Choice {
text: string;
finish_reason: string;
}
model Usage {
prompt_tokens: int32;
completion_tokens: int32;
total_tokens: int32;
}
model ErrorResponse {
message?: string
}
}