forked from pnp/copilot-pro-dev-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaiSearchactions.tsp
More file actions
51 lines (43 loc) · 1.28 KB
/
Copy pathaiSearchactions.tsp
File metadata and controls
51 lines (43 loc) · 1.28 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
import "@typespec/http";
import "@microsoft/typespec-m365-copilot";
using TypeSpec.Http;
using TypeSpec.M365.Copilot.Actions;
@service
@server(AISearchAPI.SERVER_URL)
@actions(AISearchAPI.ACTIONS_METADATA)
namespace AISearchAPI {
const ACTIONS_METADATA = #{
nameForHuman: "Volunteering Agent",
descriptionForHuman: "Helps users find info about volunteering opportunities using Azure AI Search.",
descriptionForModel: "Helps users find info about volunteering opportunities using Azure AI Search."
};
const SERVER_URL = "https://<AI_SEARCH_ENDPOINT>.search.windows.net";
@doc("Searches for volunteering opportunities using Azure AI Search.")
@post
@useAuth(ApiKeyAuth<ApiKeyLocation.header, "api-key">)
@route("/indexes/vol/docs/search")
op searchVolunteerOpportunities(
@body post: DataRequest,
@query("api-version") apiVersion: string = "2025-05-01-preview",
): DataResponse;
model DataRequest {
count: boolean;
vectorQueries: [
{
kind: string = "text";
text: string = "volunteering";
fields: string = "contentVector";
}
];
}
model DataResponse {
"@search.answers": DataItem[];
}
model DataItem {
key: string;
text: string;
started: string;
highlights: string;
score: decimal128;
}
}