Skip to content

Commit e6bbd1f

Browse files
authored
Python client renames related to session file upload/download (#44114)
1 parent 099edb6 commit e6bbd1f

7 files changed

Lines changed: 119 additions & 75 deletions

File tree

specification/ai-foundry/data-plane/Foundry/openapi3/v1/microsoft-foundry-openapi3.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52465,6 +52465,11 @@
5246552465
"type": "string",
5246652466
"description": "The configured trigger name that produced the routine attempt."
5246752467
},
52468+
"trigger_event_payload": {
52469+
"type": "object",
52470+
"unevaluatedProperties": {},
52471+
"description": "The event payload captured from the event that triggered the routine attempt, when available."
52472+
},
5246852473
"attempt_source": {
5246952474
"allOf": [
5247052475
{

specification/ai-foundry/data-plane/Foundry/openapi3/v1/microsoft-foundry-openapi3.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35949,6 +35949,10 @@ components:
3594935949
trigger_name:
3595035950
type: string
3595135951
description: The configured trigger name that produced the routine attempt.
35952+
trigger_event_payload:
35953+
type: object
35954+
unevaluatedProperties: {}
35955+
description: The event payload captured from the event that triggered the routine attempt, when available.
3595235956
attempt_source:
3595335957
allOf:
3595435958
- $ref: '#/components/schemas/RoutineAttemptSource'

specification/ai-foundry/data-plane/Foundry/openapi3/virtual-public-preview/microsoft-foundry-openapi3.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57229,6 +57229,11 @@
5722957229
"type": "string",
5723057230
"description": "The configured trigger name that produced the routine attempt."
5723157231
},
57232+
"trigger_event_payload": {
57233+
"type": "object",
57234+
"unevaluatedProperties": {},
57235+
"description": "The event payload captured from the event that triggered the routine attempt, when available."
57236+
},
5723257237
"attempt_source": {
5723357238
"allOf": [
5723457239
{

specification/ai-foundry/data-plane/Foundry/openapi3/virtual-public-preview/microsoft-foundry-openapi3.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39164,6 +39164,10 @@ components:
3916439164
trigger_name:
3916539165
type: string
3916639166
description: The configured trigger name that produced the routine attempt.
39167+
trigger_event_payload:
39168+
type: object
39169+
unevaluatedProperties: {}
39170+
description: The event payload captured from the event that triggered the routine attempt, when available.
3916739171
attempt_source:
3916839172
allOf:
3916939173
- $ref: '#/components/schemas/RoutineAttemptSource'

specification/ai-foundry/data-plane/Foundry/src/agents-session-files/models.tsp

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,67 @@
1+
using TypeSpec.Http;
2+
13
namespace Azure.AI.Projects;
24

5+
// ---------------------------------------------------------------------------
6+
// Request parameter models
7+
// ---------------------------------------------------------------------------
8+
9+
// Parameters for uploading a file to a session sandbox
10+
alias UploadSessionFileParams = {
11+
/** The name of the agent. */
12+
@path agent_name: string;
13+
14+
/** The session ID. */
15+
@path agent_session_id: string;
16+
17+
/** The destination file path within the sandbox, relative to the session home directory. */
18+
@query path: string;
19+
20+
/** The binary file content to upload. */
21+
@header("Content-Type") contentType: "application/octet-stream";
22+
23+
@body content: bytes;
24+
};
25+
26+
// Parameters for downloading a file from a session sandbox
27+
alias DownloadSessionFileParams = {
28+
/** The name of the agent. */
29+
@path agent_name: string;
30+
31+
/** The session ID. */
32+
@path agent_session_id: string;
33+
34+
/** The file path to download from the sandbox, relative to the session home directory. */
35+
@query path: string;
36+
};
37+
38+
// Parameters for listing files in a session sandbox
39+
alias ListSessionFilesParams = {
40+
/** The name of the agent. */
41+
@path agent_name: string;
42+
43+
/** The session ID. */
44+
@path agent_session_id: string;
45+
46+
/** The directory path to list, relative to the session home directory. Defaults to the home directory if not provided. */
47+
@query path?: string;
48+
};
49+
50+
// Parameters for deleting a file from a session sandbox
51+
alias DeleteSessionFileParams = {
52+
/** The name of the agent. */
53+
@path agent_name: string;
54+
55+
/** The session ID. */
56+
@path agent_session_id: string;
57+
58+
/** The file or directory path to delete, relative to the session home directory. */
59+
@query path: string;
60+
61+
/** Whether to recursively delete directory contents. The service defaults to `false` if a value is not specified by the caller. */
62+
@query recursive?: boolean = false;
63+
};
64+
365
// ---------------------------------------------------------------------------
466
// Response models
567
// ---------------------------------------------------------------------------

specification/ai-foundry/data-plane/Foundry/src/agents-session-files/routes.tsp

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import "../common/servicepatterns.tsp";
33
import "./models.tsp";
44

55
using TypeSpec.Http;
6-
using TypeSpec.OpenAPI;
7-
using TypeSpec.Versioning;
86

97
namespace Azure.AI.Projects;
108

@@ -31,19 +29,7 @@ interface AgentSessionFiles {
3129
@route("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content")
3230
uploadSessionFile is FoundryDataPlaneOperation<
3331
{
34-
/** The name of the agent. */
35-
@path agent_name: string;
36-
37-
/** The session ID. */
38-
@path agent_session_id: string;
39-
40-
/** The destination file path within the sandbox, relative to the session home directory. */
41-
@query path: string;
42-
43-
/** The binary file content to upload. */
44-
@header("Content-Type") contentType: "application/octet-stream";
45-
46-
@body content: bytes;
32+
...UploadSessionFileParams;
4733
},
4834
ResourceCreatedResponse<SessionFileWriteResponse>
4935
>;
@@ -57,14 +43,7 @@ interface AgentSessionFiles {
5743
@route("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files/content")
5844
downloadSessionFile is FoundryDataPlaneOperation<
5945
{
60-
/** The name of the agent. */
61-
@path agent_name: string;
62-
63-
/** The session ID. */
64-
@path agent_session_id: string;
65-
66-
/** The file path to download from the sandbox, relative to the session home directory. */
67-
@query path: string;
46+
...DownloadSessionFileParams;
6847
},
6948
bytes
7049
>;
@@ -79,15 +58,7 @@ interface AgentSessionFiles {
7958
@route("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files")
8059
listSessionFiles is FoundryDataPlaneOperation<
8160
{
82-
/** The name of the agent. */
83-
@path agent_name: string;
84-
85-
/** The session ID. */
86-
@path agent_session_id: string;
87-
88-
/** The directory path to list, relative to the session home directory. Defaults to the home directory if not provided. */
89-
@query path?: string;
90-
61+
...ListSessionFilesParams;
9162
...CommonPageQueryParameters;
9263
},
9364
SessionDirectoryListResponse
@@ -102,17 +73,7 @@ interface AgentSessionFiles {
10273
@route("/agents/{agent_name}/endpoint/sessions/{agent_session_id}/files")
10374
deleteSessionFile is FoundryDataPlaneOperation<
10475
{
105-
/** The name of the agent. */
106-
@path agent_name: string;
107-
108-
/** The session ID. */
109-
@path agent_session_id: string;
110-
111-
/** The file or directory path to delete, relative to the session home directory. */
112-
@query path: string;
113-
114-
/** Whether to recursively delete directory contents. The service defaults to `false` if a value is not specified by the caller. */
115-
@query recursive?: boolean = false;
76+
...DeleteSessionFileParams;
11677
},
11778
void
11879
>;

specification/ai-foundry/data-plane/Foundry/src/sdk-python-js-azure-ai-projects/client.tsp

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ using Azure.AI.Projects;
9494
@@clientName(AgentObject, "Agent", "javascript");
9595
@@clientName(AgentVersionObject, "AgentVersion", "javascript");
9696

97-
// Python emitter creates enum A2_A_PREVIEW = "a2a_preview". Override it here to "A2A_PREVIEW".
98-
@@clientName(_PreviewAgentToolType.a2a_preview, "A2A_PREVIEW", "python");
99-
10097
// Python emitter creates enum values ENUM_1_G = "1g", ENUM_4_G = "4g" etc. Override it here as below.
10198
@@clientName(OpenAI.ContainerMemoryLimit.`1g`, exact("MEMORY_1GB"), "python");
10299
@@clientName(OpenAI.ContainerMemoryLimit.`4g`, exact("MEMORY_4GB"), "python");
@@ -108,9 +105,44 @@ using Azure.AI.Projects;
108105
@@clientName(_PreviewAgentToolType.a2a_preview, exact("A2A_PREVIEW"), "python");
109106
@@clientName(ToolboxToolType.a2a_preview, exact("A2A_PREVIEW"), "python");
110107
@@clientName(ProtocolConfiguration.a2a, exact("a2a"), "python");
108+
@@clientName(AgentEndpointProtocol.a2a, exact("A2A"), "python");
111109

112110
@@clientName(OpenAI.ImageGenActionEnum, "ImageGenAction");
113111

112+
// DatasetItem model has a property `response_items?: OpenAI.OutputItem[]`. It is used
113+
// to define Agent optimization request. If emitted as-is, it pulls in a lot of
114+
// OpenAI responses classes. We want Foundry SDK to be free of those, therefore for the
115+
// time being we define output item as a generic dictionary.
116+
@@alternateType(OpenAI.OutputItem, Record<unknown>);
117+
118+
// Make this method internal, since it's patched with a new one that supports either binary or file-path input
119+
@@access(AgentSessionFiles.uploadSessionFile, Access.internal, "python");
120+
@@usage(SessionFileWriteResponse, Usage.output);
121+
@@access(SessionFileWriteResponse, Access.public);
122+
123+
@@clientName(UploadSessionFileParams.path, "remote_path", "python");
124+
@@clientName(DownloadSessionFileParams.path, "remote_path", "python");
125+
@@clientName(ListSessionFilesParams.path, "remote_path", "python");
126+
@@clientName(DeleteSessionFileParams.path, "remote_path", "python");
127+
128+
// Exclude these operations entirely from emitted SDK. These are convenience REST APIs that we don't think bring
129+
// real value on SDK surface. We can do everything using createAgentVersionFromCode.
130+
@@scope(Agents.createAgentFromCode, "!(python, javascript)");
131+
@@scope(Agents.updateAgentFromCode, "!(python, javascript)");
132+
133+
@@clientName(Agents.downloadAgentCode, "download_code", "python");
134+
@@clientName(Agents.createAgentVersionFromCode, "createVersionFromCode");
135+
136+
@@clientName(DownloadAgentCodeResponse, "DownloadAgentCodeResult", "python");
137+
@@clientName(
138+
SessionDirectoryListResponse,
139+
"SessionDirectoryListResult",
140+
"python"
141+
);
142+
@@clientName(SessionFileWriteResponse, "SessionFileWriteResult", "python");
143+
144+
145+
114146
// --------------------------------------------------------------------------------
115147
// Datasets sub‐client
116148
// --------------------------------------------------------------------------------
@@ -201,35 +233,6 @@ using Azure.AI.Projects;
201233
@@clientName(AgentOptimizationJobs.cancel, "cancelOptimizationJob");
202234
@@clientName(AgentOptimizationJobs.delete, "deleteOptimizationJob");
203235

204-
// DatasetItem model has a property `response_items?: OpenAI.OutputItem[]`. It is used
205-
// to define Agent optimization request. If emitted as-is, it pulls in a lot of
206-
// OpenAI responses classes. We want Foundry SDK to be free of those, therefore for the
207-
// time being we define output item as a generic dictionary.
208-
@@alternateType(OpenAI.OutputItem, Record<unknown>);
209-
210-
// Make this method internal, since it's patched with a new one that supports either binary or file-path input
211-
@@access(AgentSessionFiles.uploadSessionFile, Access.internal, "python");
212-
@@usage(SessionFileWriteResponse, Usage.output);
213-
@@access(SessionFileWriteResponse, Access.public);
214-
215-
// Exclude these operations entirely from emitted SDK. These are convenience REST APIs that we don't think bring
216-
// real value on SDK surface. We can do everything using createAgentVersionFromCode.
217-
@@scope(Agents.createAgentFromCode, "!(python, javascript)");
218-
@@scope(Agents.updateAgentFromCode, "!(python, javascript)");
219-
220-
@@clientName(Agents.downloadAgentCode, "download_code", "python");
221-
@@clientName(Agents.createAgentVersionFromCode, "createVersionFromCode");
222-
223-
@@clientName(DownloadAgentCodeResponse, "DownloadAgentCodeResult", "python");
224-
@@clientName(
225-
SessionDirectoryListResponse,
226-
"SessionDirectoryListResult",
227-
"python"
228-
);
229-
@@clientName(SessionFileWriteResponse, "SessionFileWriteResult", "python");
230-
231-
@@clientName(AgentEndpointProtocol.a2a, exact("A2A"), "python");
232-
233236
// All emitted Python classes already have "items" in the base class, so we need to pick another name
234237
@@clientName(OptimizationInlineDatasetInput.items, "dataset_items", "python");
235238

0 commit comments

Comments
 (0)