@azure/ai-agents 1.1.0-beta.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -76
- package/dist/browser/api/agentsContext.js +2 -2
- package/dist/browser/api/agentsContext.js.map +1 -1
- package/dist/browser/api/runs/operations.d.ts.map +1 -1
- package/dist/browser/api/runs/operations.js +1 -4
- package/dist/browser/api/runs/operations.js.map +1 -1
- package/dist/browser/api/runs/options.d.ts +1 -5
- package/dist/browser/api/runs/options.d.ts.map +1 -1
- package/dist/browser/api/runs/options.js.map +1 -1
- package/dist/browser/constants.d.ts +1 -1
- package/dist/browser/constants.d.ts.map +1 -1
- package/dist/browser/constants.js +1 -1
- package/dist/browser/constants.js.map +1 -1
- package/dist/browser/index.d.ts +1 -2
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +0 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/models/index.d.ts +1 -1
- package/dist/browser/models/index.d.ts.map +1 -1
- package/dist/browser/models/index.js.map +1 -1
- package/dist/browser/models/models.d.ts +9 -257
- package/dist/browser/models/models.d.ts.map +1 -1
- package/dist/browser/models/models.js +0 -326
- package/dist/browser/models/models.js.map +1 -1
- package/dist/browser/utils/utils.d.ts +1 -61
- package/dist/browser/utils/utils.d.ts.map +1 -1
- package/dist/browser/utils/utils.js +0 -90
- package/dist/browser/utils/utils.js.map +1 -1
- package/dist/commonjs/api/agentsContext.js +2 -2
- package/dist/commonjs/api/agentsContext.js.map +1 -1
- package/dist/commonjs/api/runs/operations.d.ts.map +1 -1
- package/dist/commonjs/api/runs/operations.js +0 -3
- package/dist/commonjs/api/runs/operations.js.map +1 -1
- package/dist/commonjs/api/runs/options.d.ts +1 -5
- package/dist/commonjs/api/runs/options.d.ts.map +1 -1
- package/dist/commonjs/api/runs/options.js.map +1 -1
- package/dist/commonjs/constants.d.ts +1 -1
- package/dist/commonjs/constants.d.ts.map +1 -1
- package/dist/commonjs/constants.js +1 -1
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/commonjs/index.d.ts +1 -2
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -3
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +1 -1
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/models.d.ts +9 -257
- package/dist/commonjs/models/models.d.ts.map +1 -1
- package/dist/commonjs/models/models.js +0 -371
- package/dist/commonjs/models/models.js.map +1 -1
- package/dist/commonjs/utils/utils.d.ts +1 -61
- package/dist/commonjs/utils/utils.d.ts.map +1 -1
- package/dist/commonjs/utils/utils.js +0 -90
- package/dist/commonjs/utils/utils.js.map +1 -1
- package/dist/esm/api/agentsContext.js +2 -2
- package/dist/esm/api/agentsContext.js.map +1 -1
- package/dist/esm/api/runs/operations.d.ts.map +1 -1
- package/dist/esm/api/runs/operations.js +1 -4
- package/dist/esm/api/runs/operations.js.map +1 -1
- package/dist/esm/api/runs/options.d.ts +1 -5
- package/dist/esm/api/runs/options.d.ts.map +1 -1
- package/dist/esm/api/runs/options.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models/index.d.ts +1 -1
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/models.d.ts +9 -257
- package/dist/esm/models/models.d.ts.map +1 -1
- package/dist/esm/models/models.js +0 -326
- package/dist/esm/models/models.js.map +1 -1
- package/dist/esm/utils/utils.d.ts +1 -61
- package/dist/esm/utils/utils.d.ts.map +1 -1
- package/dist/esm/utils/utils.js +0 -90
- package/dist/esm/utils/utils.js.map +1 -1
- package/dist/react-native/api/agentsContext.js +2 -2
- package/dist/react-native/api/agentsContext.js.map +1 -1
- package/dist/react-native/api/runs/operations.d.ts.map +1 -1
- package/dist/react-native/api/runs/operations.js +1 -4
- package/dist/react-native/api/runs/operations.js.map +1 -1
- package/dist/react-native/api/runs/options.d.ts +1 -5
- package/dist/react-native/api/runs/options.d.ts.map +1 -1
- package/dist/react-native/api/runs/options.js.map +1 -1
- package/dist/react-native/constants.d.ts +1 -1
- package/dist/react-native/constants.d.ts.map +1 -1
- package/dist/react-native/constants.js +1 -1
- package/dist/react-native/constants.js.map +1 -1
- package/dist/react-native/index.d.ts +1 -2
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +0 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/models/index.d.ts +1 -1
- package/dist/react-native/models/index.d.ts.map +1 -1
- package/dist/react-native/models/index.js.map +1 -1
- package/dist/react-native/models/models.d.ts +9 -257
- package/dist/react-native/models/models.d.ts.map +1 -1
- package/dist/react-native/models/models.js +0 -326
- package/dist/react-native/models/models.js.map +1 -1
- package/dist/react-native/utils/utils.d.ts +1 -61
- package/dist/react-native/utils/utils.d.ts.map +1 -1
- package/dist/react-native/utils/utils.js +0 -90
- package/dist/react-native/utils/utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/utils/MCPTool.d.ts +0 -78
- package/dist/browser/utils/MCPTool.d.ts.map +0 -1
- package/dist/browser/utils/MCPTool.js +0 -133
- package/dist/browser/utils/MCPTool.js.map +0 -1
- package/dist/commonjs/utils/MCPTool.d.ts +0 -78
- package/dist/commonjs/utils/MCPTool.d.ts.map +0 -1
- package/dist/commonjs/utils/MCPTool.js +0 -137
- package/dist/commonjs/utils/MCPTool.js.map +0 -1
- package/dist/esm/utils/MCPTool.d.ts +0 -78
- package/dist/esm/utils/MCPTool.d.ts.map +0 -1
- package/dist/esm/utils/MCPTool.js +0 -133
- package/dist/esm/utils/MCPTool.js.map +0 -1
- package/dist/react-native/utils/MCPTool.d.ts +0 -78
- package/dist/react-native/utils/MCPTool.d.ts.map +0 -1
- package/dist/react-native/utils/MCPTool.js +0 -133
- package/dist/react-native/utils/MCPTool.js.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { AzureAISearchToolDefinition, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, FunctionDefinition, FunctionToolDefinition, OpenApiToolDefinition, RequiredAction, RequiredToolCall, ToolDefinition, ToolDefinitionUnion, ToolResources, VectorStoreConfigurations, VectorStoreDataSource, OpenApiFunctionDefinition, AISearchIndexResource,
|
|
2
|
-
import { MCPTool } from "./MCPTool.js";
|
|
1
|
+
import type { AzureAISearchToolDefinition, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, FunctionDefinition, FunctionToolDefinition, OpenApiToolDefinition, RequiredAction, RequiredToolCall, ToolDefinition, ToolDefinitionUnion, ToolResources, VectorStoreConfigurations, VectorStoreDataSource, OpenApiFunctionDefinition, AISearchIndexResource, BingGroundingToolDefinition, BingGroundingSearchConfiguration, ConnectedAgentToolDefinition } from "../index.js";
|
|
3
2
|
/**
|
|
4
3
|
* Determines if the given output is of the specified type.
|
|
5
4
|
*
|
|
@@ -38,17 +37,6 @@ export declare class ToolUtility {
|
|
|
38
37
|
static createConnectionTool(toolType: connectionToolType, connectionIds: string[]): {
|
|
39
38
|
definition: ToolDefinitionUnion;
|
|
40
39
|
};
|
|
41
|
-
/**
|
|
42
|
-
* Creates a sharepoint grounding search tool
|
|
43
|
-
*
|
|
44
|
-
* @param connectionId - The ID of the sharepoint search connection.
|
|
45
|
-
*
|
|
46
|
-
* @returns An object containing the definition and resources for the sharepoint grounding search tool
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
static createSharepointGroundingTool(connectionId: string): {
|
|
50
|
-
definition: SharepointToolDefinition;
|
|
51
|
-
};
|
|
52
40
|
/**
|
|
53
41
|
* Creates a bing grounding search tool
|
|
54
42
|
*
|
|
@@ -60,16 +48,6 @@ export declare class ToolUtility {
|
|
|
60
48
|
static createBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {
|
|
61
49
|
definition: BingGroundingToolDefinition;
|
|
62
50
|
};
|
|
63
|
-
/**
|
|
64
|
-
* Creates a bing custom search tool
|
|
65
|
-
*
|
|
66
|
-
* @param searchConfigurations - The ID of bing search connection and instanceName.
|
|
67
|
-
*
|
|
68
|
-
* @returns An object containing the definition and resources for the bing custom search tool
|
|
69
|
-
*/
|
|
70
|
-
static createBingCustomSearchTool(searchConfigurations: BingCustomSearchConfiguration[]): {
|
|
71
|
-
definition: BingCustomSearchToolDefinition;
|
|
72
|
-
};
|
|
73
51
|
/**
|
|
74
52
|
* Creates a file search tool
|
|
75
53
|
*
|
|
@@ -115,15 +93,6 @@ export declare class ToolUtility {
|
|
|
115
93
|
static createConnectedAgentTool(id: string, name: string, description: string): {
|
|
116
94
|
definition: ConnectedAgentToolDefinition;
|
|
117
95
|
};
|
|
118
|
-
/**
|
|
119
|
-
* Creates a Microsoft Fabric tool
|
|
120
|
-
*
|
|
121
|
-
* @param connectionIds - A list of the IDs of the Fabric connections to use.
|
|
122
|
-
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
123
|
-
*/
|
|
124
|
-
static createFabricTool(connectionId: string): {
|
|
125
|
-
definition: MicrosoftFabricToolDefinition;
|
|
126
|
-
};
|
|
127
96
|
/**
|
|
128
97
|
* Creates a function tool
|
|
129
98
|
*
|
|
@@ -144,16 +113,6 @@ export declare class ToolUtility {
|
|
|
144
113
|
static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {
|
|
145
114
|
definition: OpenApiToolDefinition;
|
|
146
115
|
};
|
|
147
|
-
/**
|
|
148
|
-
* Creates an MCP tool with the provided configuration.
|
|
149
|
-
* @param options - Configuration options for the MCP tool
|
|
150
|
-
* @returns A new MCPTool instance
|
|
151
|
-
*/
|
|
152
|
-
static createMCPTool(options: {
|
|
153
|
-
serverLabel: string;
|
|
154
|
-
serverUrl: string;
|
|
155
|
-
allowedTools?: string[];
|
|
156
|
-
}): MCPTool;
|
|
157
116
|
}
|
|
158
117
|
/**
|
|
159
118
|
* Represents a set of tools with their definitions and resources.
|
|
@@ -242,24 +201,5 @@ export declare class ToolSet {
|
|
|
242
201
|
addConnectedAgentTool(id: string, name: string, description: string): {
|
|
243
202
|
definition: ConnectedAgentToolDefinition;
|
|
244
203
|
};
|
|
245
|
-
/**
|
|
246
|
-
* Adds a Microsoft Fabric tool to the tool set.
|
|
247
|
-
*
|
|
248
|
-
* @param connectionId - The ID of the Fabric connection to use.
|
|
249
|
-
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
250
|
-
*/
|
|
251
|
-
addFabricTool(connectionId: string): {
|
|
252
|
-
definition: MicrosoftFabricToolDefinition;
|
|
253
|
-
};
|
|
254
|
-
/**
|
|
255
|
-
* Adds sharepoint grounding search tool to the tool set.
|
|
256
|
-
*
|
|
257
|
-
* @param connectionId - The ID of the sharepoint search connection.
|
|
258
|
-
*
|
|
259
|
-
* @returns An object containing the definition and resources for the sharepoint grounding search tool
|
|
260
|
-
*/
|
|
261
|
-
addSharepointGroundingTool(connectionId: string): {
|
|
262
|
-
definition: SharepointToolDefinition;
|
|
263
|
-
};
|
|
264
204
|
}
|
|
265
205
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,EACxB,+BAA+B,EAC/B,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,
|
|
1
|
+
{"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,cAAc,CAAC,EAAE,MAAM,EAAE,EACzB,YAAY,CAAC,EAAE,KAAK,CAAC,yBAAyB,CAAC,EAC/C,iBAAiB,CAAC,EAAE,+BAA+B,GAClD;QAAE,UAAU,EAAE,wBAAwB,CAAC;QAAC,SAAS,EAAE,aAAa,CAAA;KAAE;IAOrE;;;;;;;OAOG;IACH,sBAAsB,CACpB,OAAO,CAAC,EAAE,MAAM,EAAE,EAClB,WAAW,CAAC,EAAE,KAAK,CAAC,qBAAqB,CAAC,GACzC;QAAE,UAAU,EAAE,6BAA6B,CAAC;QAAC,SAAS,EAAE,aAAa,CAAA;KAAE;IAO1E;;;;;;;OAOG;IACH,oBAAoB,CAClB,iBAAiB,EAAE,MAAM,EACzB,SAAS,EAAE,MAAM,GAChB;QAAE,UAAU,EAAE,2BAA2B,CAAC;QAAC,SAAS,EAAE,aAAa,CAAA;KAAE;IAOxE;;;;;;OAMG;IACH,cAAc,CAAC,yBAAyB,EAAE,yBAAyB,GAAG;QACpE,UAAU,EAAE,qBAAqB,CAAC;KACnC;IAMD;;;;;;OAMG;IACH,oBAAoB,CAAC,oBAAoB,EAAE,gCAAgC,EAAE,GAAG;QAC9E,UAAU,EAAE,2BAA2B,CAAC;KACzC;IAMD;;;;;;;OAOG;IACH,qBAAqB,CACnB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB;QAAE,UAAU,EAAE,4BAA4B,CAAA;KAAE;CAKhD"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { MCPTool } from "./MCPTool.js";
|
|
4
3
|
/**
|
|
5
4
|
* Determines if the given output is of the specified type.
|
|
6
5
|
*
|
|
@@ -54,28 +53,6 @@ export class ToolUtility {
|
|
|
54
53
|
},
|
|
55
54
|
};
|
|
56
55
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Creates a sharepoint grounding search tool
|
|
59
|
-
*
|
|
60
|
-
* @param connectionId - The ID of the sharepoint search connection.
|
|
61
|
-
*
|
|
62
|
-
* @returns An object containing the definition and resources for the sharepoint grounding search tool
|
|
63
|
-
*
|
|
64
|
-
*/
|
|
65
|
-
static createSharepointGroundingTool(connectionId) {
|
|
66
|
-
return {
|
|
67
|
-
definition: {
|
|
68
|
-
type: "sharepoint_grounding",
|
|
69
|
-
sharepointGrounding: {
|
|
70
|
-
connectionList: [
|
|
71
|
-
{
|
|
72
|
-
connectionId: connectionId,
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
56
|
/**
|
|
80
57
|
* Creates a bing grounding search tool
|
|
81
58
|
*
|
|
@@ -102,26 +79,6 @@ export class ToolUtility {
|
|
|
102
79
|
},
|
|
103
80
|
};
|
|
104
81
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Creates a bing custom search tool
|
|
107
|
-
*
|
|
108
|
-
* @param searchConfigurations - The ID of bing search connection and instanceName.
|
|
109
|
-
*
|
|
110
|
-
* @returns An object containing the definition and resources for the bing custom search tool
|
|
111
|
-
*/
|
|
112
|
-
static createBingCustomSearchTool(searchConfigurations) {
|
|
113
|
-
return {
|
|
114
|
-
definition: {
|
|
115
|
-
type: "bing_custom_search",
|
|
116
|
-
bingCustomSearch: {
|
|
117
|
-
searchConfigurations: searchConfigurations.map((searchConfiguration) => ({
|
|
118
|
-
connectionId: searchConfiguration.connectionId,
|
|
119
|
-
instanceName: searchConfiguration.instanceName,
|
|
120
|
-
})),
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
82
|
/**
|
|
126
83
|
* Creates a file search tool
|
|
127
84
|
*
|
|
@@ -197,22 +154,6 @@ export class ToolUtility {
|
|
|
197
154
|
},
|
|
198
155
|
};
|
|
199
156
|
}
|
|
200
|
-
/**
|
|
201
|
-
* Creates a Microsoft Fabric tool
|
|
202
|
-
*
|
|
203
|
-
* @param connectionIds - A list of the IDs of the Fabric connections to use.
|
|
204
|
-
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
205
|
-
*/
|
|
206
|
-
static createFabricTool(connectionId) {
|
|
207
|
-
return {
|
|
208
|
-
definition: {
|
|
209
|
-
type: "fabric_dataagent",
|
|
210
|
-
fabricDataagent: {
|
|
211
|
-
connectionList: [{ connectionId: connectionId }],
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
157
|
/**
|
|
217
158
|
* Creates a function tool
|
|
218
159
|
*
|
|
@@ -249,14 +190,6 @@ export class ToolUtility {
|
|
|
249
190
|
},
|
|
250
191
|
};
|
|
251
192
|
}
|
|
252
|
-
/**
|
|
253
|
-
* Creates an MCP tool with the provided configuration.
|
|
254
|
-
* @param options - Configuration options for the MCP tool
|
|
255
|
-
* @returns A new MCPTool instance
|
|
256
|
-
*/
|
|
257
|
-
static createMCPTool(options) {
|
|
258
|
-
return new MCPTool(options.serverLabel, options.serverUrl, options.allowedTools);
|
|
259
|
-
}
|
|
260
193
|
}
|
|
261
194
|
/**
|
|
262
195
|
* Represents a set of tools with their definitions and resources.
|
|
@@ -359,28 +292,5 @@ export class ToolSet {
|
|
|
359
292
|
this.toolDefinitions.push(tool.definition);
|
|
360
293
|
return tool;
|
|
361
294
|
}
|
|
362
|
-
/**
|
|
363
|
-
* Adds a Microsoft Fabric tool to the tool set.
|
|
364
|
-
*
|
|
365
|
-
* @param connectionId - The ID of the Fabric connection to use.
|
|
366
|
-
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
367
|
-
*/
|
|
368
|
-
addFabricTool(connectionId) {
|
|
369
|
-
const tool = ToolUtility.createFabricTool(connectionId);
|
|
370
|
-
this.toolDefinitions.push(tool.definition);
|
|
371
|
-
return tool;
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Adds sharepoint grounding search tool to the tool set.
|
|
375
|
-
*
|
|
376
|
-
* @param connectionId - The ID of the sharepoint search connection.
|
|
377
|
-
*
|
|
378
|
-
* @returns An object containing the definition and resources for the sharepoint grounding search tool
|
|
379
|
-
*/
|
|
380
|
-
addSharepointGroundingTool(connectionId) {
|
|
381
|
-
const tool = ToolUtility.createSharepointGroundingTool(connectionId);
|
|
382
|
-
this.toolDefinitions.push(tool.definition);
|
|
383
|
-
return tool;
|
|
384
|
-
}
|
|
385
295
|
}
|
|
386
296
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA2BlC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAA+D,EAC/D,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,MAAM,CAAN,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,iCAAiC;IACjC,sDAAgC,CAAA;IAChC,4BAA4B;IAC5B,0DAAoC,CAAA;IACpC,sBAAsB;IACtB,kEAA4C,CAAA;IAC5C,0BAA0B;IAC1B,sDAAgC,CAAA;IAChC,8BAA8B;IAC9B,6DAAuC,CAAA;AACzC,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B;AAED,MAAM,OAAO,GAAG;IACd,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,kBAAkB;IACpC,oBAAoB,EAAE,qBAAqB;IAC3C,cAAc,EAAE,eAAe;IAC/B,kBAAkB,EAAE,kBAAkB;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,WAAW;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACzB,QAA4B,EAC5B,aAAuB;QAEvB,OAAO;YACL,UAAU,EAAE;gBACV,I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AAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AzureAISearchToolDefinition,\n CodeInterpreterToolDefinition,\n FileSearchToolDefinition,\n FileSearchToolDefinitionDetails,\n FunctionDefinition,\n FunctionToolDefinition,\n OpenApiToolDefinition,\n RequiredAction,\n RequiredToolCall,\n ToolDefinition,\n ToolDefinitionUnion,\n ToolResources,\n VectorStoreConfigurations,\n VectorStoreDataSource,\n OpenApiFunctionDefinition,\n AISearchIndexResource,\n BingCustomSearchConfiguration,\n BingCustomSearchToolDefinition,\n BingGroundingToolDefinition,\n BingGroundingSearchConfiguration,\n ConnectedAgentToolDefinition,\n MicrosoftFabricToolDefinition,\n SharepointToolDefinition,\n} from \"../index.js\";\nimport { MCPTool } from \"./MCPTool.js\";\n\n/**\n * Determines if the given output is of the specified type.\n *\n * @typeParam T - The type to check against, which extends one of the possible output parent types.\n * @param output - The action to check, which can be of type `RequiredAction`, `RequiredToolCall`, or `ToolDefinitionUnion`.\n * @param type - The type to check the action against.\n * @returns A boolean indicating whether the action is of the specified type.\n */\nexport function isOutputOfType<T extends { type: string }>(\n output: RequiredAction | RequiredToolCall | ToolDefinitionUnion,\n type: string,\n): output is T {\n return output.type === type;\n}\n\n/** Types of connection tools used to configure an agent */\nexport enum connectionToolType {\n /** Bing grounding search tool */\n BingGrounding = \"bing_grounding\",\n /** Microsoft Fabric tool */\n MicrosoftFabric = \"fabric_dataagent\",\n /** Sharepoint tool */\n SharepointGrounding = \"sharepoint_grounding\",\n /** Azure Function tool */\n AzureFunction = \"azure_function\",\n /** Bing custom search tool */\n BingCustomSearch = \"bing_custom_search\",\n}\n\nconst toolMap = {\n bing_grounding: \"bingGrounding\",\n fabric_dataagent: \"fabric_dataagent\",\n sharepoint_grounding: \"sharepointGrounding\",\n azure_function: \"azureFunction\",\n bing_custom_search: \"bingCustomSearch\",\n};\n\n/**\n * Utility class for creating various tools.\n */\nexport class ToolUtility {\n /**\n * Creates a connection tool\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n * @returns An object containing the definition for the connection tool\n */\n static createConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinitionUnion } {\n return {\n definition: {\n type: toolType,\n [toolMap[toolType]]: {\n connections: connectionIds.map((connectionId) => ({ connectionId: connectionId })),\n },\n },\n };\n }\n\n /**\n * Creates a sharepoint grounding search tool\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n *\n */\n static createSharepointGroundingTool(connectionId: string): {\n definition: SharepointToolDefinition;\n } {\n return {\n definition: {\n type: \"sharepoint_grounding\",\n sharepointGrounding: {\n connectionList: [\n {\n connectionId: connectionId,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a bing grounding search tool\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n *\n */\n static createBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n // Ensure searchConfigurations is an array even if it's undefined\n const configs = searchConfigurations || [];\n return {\n definition: {\n type: \"bing_grounding\",\n bingGrounding: {\n searchConfigurations: configs.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n market: searchConfiguration?.market,\n setLang: searchConfiguration?.setLang,\n count: searchConfiguration?.count,\n freshness: searchConfiguration?.freshness,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a bing custom search tool\n *\n * @param searchConfigurations - The ID of bing search connection and instanceName.\n *\n * @returns An object containing the definition and resources for the bing custom search tool\n */\n\n static createBingCustomSearchTool(searchConfigurations: BingCustomSearchConfiguration[]): {\n definition: BingCustomSearchToolDefinition;\n } {\n return {\n definition: {\n type: \"bing_custom_search\",\n bingCustomSearch: {\n searchConfigurations: searchConfigurations.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n instanceName: searchConfiguration.instanceName,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a file search tool\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n static createFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"file_search\", fileSearch: definitionDetails },\n resources: { fileSearch: { vectorStoreIds: vectorStoreIds, vectorStores: vectorStores } },\n };\n }\n\n /**\n * Creates a code interpreter tool\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool.\n */\n static createCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n if (fileIds && dataSources) {\n throw new Error(\"Cannot specify both fileIds and dataSources\");\n }\n\n return {\n definition: { type: \"code_interpreter\" },\n resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } },\n };\n }\n\n /**\n * Creates an Azure AI search tool\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool.\n */\n static createAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n options?: AISearchIndexResource,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexList: [\n {\n indexConnectionId: indexConnectionId,\n indexName: indexName,\n queryType: options?.queryType,\n topK: options?.topK,\n filter: options?.filter,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a connected agent tool\n *\n * @returns An object containing the definition for the connected agent tool.\n */\n static createConnectedAgentTool(\n id: string,\n name: string,\n description: string,\n ): { definition: ConnectedAgentToolDefinition } {\n return {\n definition: {\n type: \"connected_agent\",\n connectedAgent: {\n id: id,\n name: name,\n description: description,\n },\n },\n };\n }\n\n /**\n * Creates a Microsoft Fabric tool\n *\n * @param connectionIds - A list of the IDs of the Fabric connections to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n static createFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n return {\n definition: {\n type: \"fabric_dataagent\",\n fabricDataagent: {\n connectionList: [{ connectionId: connectionId }],\n },\n },\n };\n }\n\n /**\n * Creates a function tool\n *\n * @param functionDefinition - The function definition to use.\n *\n * @returns An object containing the definition for the function tool.\n */\n static createFunctionTool(functionDefinition: FunctionDefinition): {\n definition: FunctionToolDefinition;\n } {\n return {\n definition: {\n type: \"function\",\n function: functionDefinition,\n },\n };\n }\n\n /**\n * Creates an OpenApi tool\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool.\n */\n static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n return {\n definition: {\n type: \"openapi\",\n openapi: {\n name: openApiFunctionDefinition.name,\n spec: openApiFunctionDefinition.spec,\n description: openApiFunctionDefinition.description,\n auth: openApiFunctionDefinition.auth,\n defaultParams: openApiFunctionDefinition.defaultParams,\n },\n },\n };\n }\n /**\n * Creates an MCP tool with the provided configuration.\n * @param options - Configuration options for the MCP tool\n * @returns A new MCPTool instance\n */\n static createMCPTool(options: {\n serverLabel: string;\n serverUrl: string;\n allowedTools?: string[];\n }): MCPTool {\n return new MCPTool(options.serverLabel, options.serverUrl, options.allowedTools);\n }\n}\n\n/**\n * Represents a set of tools with their definitions and resources.\n */\nexport class ToolSet {\n /** A list of tool definitions that have been added to the tool set. */\n toolDefinitions: ToolDefinition[] = [];\n\n /** A collection of resources associated with the tools in the tool set. */\n toolResources: ToolResources = {};\n\n /**\n * Adds a connection tool to the tool set.\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n *\n * @returns An object containing the definition for the connection tool\n */\n addConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinition } {\n const tool = ToolUtility.createConnectionTool(toolType, connectionIds);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a file search tool to the tool set.\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n addFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createFileSearchTool(vectorStoreIds, vectorStores, definitionDetails);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds a code interpreter tool to the tool set.\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool\n */\n addCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createCodeInterpreterTool(fileIds, dataSources);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an Azure AI search tool to the tool set.\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool\n */\n addAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createAzureAISearchTool(indexConnectionId, indexName);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an OpenApi tool to the tool set.\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool\n */\n addOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n const tool = ToolUtility.createOpenApiTool(openApiFunctionDefinition);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a bing grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n */\n addBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n const tool = ToolUtility.createBingGroundingTool(searchConfigurations);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a connected agent tool to the tool set.\n *\n * @param id - The ID of the connected agent.\n * @param name - The name of the connected agent.\n * @param description - The description of the connected agent.\n * @returns An object containing the definition for the connected agent tool\n */\n addConnectedAgentTool(\n id: string,\n name: string,\n description: string,\n ): { definition: ConnectedAgentToolDefinition } {\n const tool = ToolUtility.createConnectedAgentTool(id, name, description);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a Microsoft Fabric tool to the tool set.\n *\n * @param connectionId - The ID of the Fabric connection to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n addFabricTool(connectionId: string): { definition: MicrosoftFabricToolDefinition } {\n const tool = ToolUtility.createFabricTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds sharepoint grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the sharepoint search connection.\n *\n * @returns An object containing the definition and resources for the sharepoint grounding search tool\n */\n addSharepointGroundingTool(connectionId: string): { definition: SharepointToolDefinition } {\n const tool = ToolUtility.createSharepointGroundingTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAwBlC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAA+D,EAC/D,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,MAAM,CAAN,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,iCAAiC;IACjC,sDAAgC,CAAA;IAChC,4BAA4B;IAC5B,0DAAoC,CAAA;IACpC,sBAAsB;IACtB,kEAA4C,CAAA;IAC5C,0BAA0B;IAC1B,sDAAgC,CAAA;IAChC,8BAA8B;IAC9B,6DAAuC,CAAA;AACzC,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B;AAED,MAAM,OAAO,GAAG;IACd,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,kBAAkB;IACpC,oBAAoB,EAAE,qBAAqB;IAC3C,cAAc,EAAE,eAAe;IAC/B,kBAAkB,EAAE,kBAAkB;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,WAAW;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACzB,QAA4B,EAC5B,aAAuB;QAEvB,OAAO;YACL,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,CAAC,OAAO,CAAC,QA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AAC;IAED;;;;;;;OAOG;IACH,oBAAoB,CAClB,iBAAyB,EACzB,SAAiB;QAEjB,MAAM,IAAI,GAAG,WAAW,CAAC,uBAAuB,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;QAC/E,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,CAAC,aAAa,GAAG,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,cAAc,CAAC,yBAAoD;QAGjE,MAAM,IAAI,GAAG,WAAW,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;QACtE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,oBAAoB,CAAC,oBAAwD;QAG3E,MAAM,IAAI,GAAG,WAAW,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;QACvE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,qBAAqB,CACnB,EAAU,EACV,IAAY,EACZ,WAAmB;QAEnB,MAAM,IAAI,GAAG,WAAW,CAAC,wBAAwB,CAAC,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QACzE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AzureAISearchToolDefinition,\n CodeInterpreterToolDefinition,\n FileSearchToolDefinition,\n FileSearchToolDefinitionDetails,\n FunctionDefinition,\n FunctionToolDefinition,\n OpenApiToolDefinition,\n RequiredAction,\n RequiredToolCall,\n ToolDefinition,\n ToolDefinitionUnion,\n ToolResources,\n VectorStoreConfigurations,\n VectorStoreDataSource,\n OpenApiFunctionDefinition,\n AISearchIndexResource,\n BingGroundingToolDefinition,\n BingGroundingSearchConfiguration,\n ConnectedAgentToolDefinition,\n} from \"../index.js\";\n\n/**\n * Determines if the given output is of the specified type.\n *\n * @typeParam T - The type to check against, which extends one of the possible output parent types.\n * @param output - The action to check, which can be of type `RequiredAction`, `RequiredToolCall`, or `ToolDefinitionUnion`.\n * @param type - The type to check the action against.\n * @returns A boolean indicating whether the action is of the specified type.\n */\nexport function isOutputOfType<T extends { type: string }>(\n output: RequiredAction | RequiredToolCall | ToolDefinitionUnion,\n type: string,\n): output is T {\n return output.type === type;\n}\n\n/** Types of connection tools used to configure an agent */\nexport enum connectionToolType {\n /** Bing grounding search tool */\n BingGrounding = \"bing_grounding\",\n /** Microsoft Fabric tool */\n MicrosoftFabric = \"fabric_dataagent\",\n /** Sharepoint tool */\n SharepointGrounding = \"sharepoint_grounding\",\n /** Azure Function tool */\n AzureFunction = \"azure_function\",\n /** Bing custom search tool */\n BingCustomSearch = \"bing_custom_search\",\n}\n\nconst toolMap = {\n bing_grounding: \"bingGrounding\",\n fabric_dataagent: \"fabric_dataagent\",\n sharepoint_grounding: \"sharepointGrounding\",\n azure_function: \"azureFunction\",\n bing_custom_search: \"bingCustomSearch\",\n};\n\n/**\n * Utility class for creating various tools.\n */\nexport class ToolUtility {\n /**\n * Creates a connection tool\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n * @returns An object containing the definition for the connection tool\n */\n static createConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinitionUnion } {\n return {\n definition: {\n type: toolType,\n [toolMap[toolType]]: {\n connections: connectionIds.map((connectionId) => ({ connectionId: connectionId })),\n },\n },\n };\n }\n\n /**\n * Creates a bing grounding search tool\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n *\n */\n static createBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n // Ensure searchConfigurations is an array even if it's undefined\n const configs = searchConfigurations || [];\n return {\n definition: {\n type: \"bing_grounding\",\n bingGrounding: {\n searchConfigurations: configs.map((searchConfiguration) => ({\n connectionId: searchConfiguration.connectionId,\n market: searchConfiguration?.market,\n setLang: searchConfiguration?.setLang,\n count: searchConfiguration?.count,\n freshness: searchConfiguration?.freshness,\n })),\n },\n },\n };\n }\n\n /**\n * Creates a file search tool\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n static createFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"file_search\", fileSearch: definitionDetails },\n resources: { fileSearch: { vectorStoreIds: vectorStoreIds, vectorStores: vectorStores } },\n };\n }\n\n /**\n * Creates a code interpreter tool\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool.\n */\n static createCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n if (fileIds && dataSources) {\n throw new Error(\"Cannot specify both fileIds and dataSources\");\n }\n\n return {\n definition: { type: \"code_interpreter\" },\n resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } },\n };\n }\n\n /**\n * Creates an Azure AI search tool\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool.\n */\n static createAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n options?: AISearchIndexResource,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexList: [\n {\n indexConnectionId: indexConnectionId,\n indexName: indexName,\n queryType: options?.queryType,\n topK: options?.topK,\n filter: options?.filter,\n },\n ],\n },\n },\n };\n }\n\n /**\n * Creates a connected agent tool\n *\n * @returns An object containing the definition for the connected agent tool.\n */\n static createConnectedAgentTool(\n id: string,\n name: string,\n description: string,\n ): { definition: ConnectedAgentToolDefinition } {\n return {\n definition: {\n type: \"connected_agent\",\n connectedAgent: {\n id: id,\n name: name,\n description: description,\n },\n },\n };\n }\n\n /**\n * Creates a function tool\n *\n * @param functionDefinition - The function definition to use.\n *\n * @returns An object containing the definition for the function tool.\n */\n static createFunctionTool(functionDefinition: FunctionDefinition): {\n definition: FunctionToolDefinition;\n } {\n return {\n definition: {\n type: \"function\",\n function: functionDefinition,\n },\n };\n }\n\n /**\n * Creates an OpenApi tool\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool.\n */\n static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n return {\n definition: {\n type: \"openapi\",\n openapi: {\n name: openApiFunctionDefinition.name,\n spec: openApiFunctionDefinition.spec,\n description: openApiFunctionDefinition.description,\n auth: openApiFunctionDefinition.auth,\n defaultParams: openApiFunctionDefinition.defaultParams,\n },\n },\n };\n }\n}\n\n/**\n * Represents a set of tools with their definitions and resources.\n */\nexport class ToolSet {\n /** A list of tool definitions that have been added to the tool set. */\n toolDefinitions: ToolDefinition[] = [];\n\n /** A collection of resources associated with the tools in the tool set. */\n toolResources: ToolResources = {};\n\n /**\n * Adds a connection tool to the tool set.\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n *\n * @returns An object containing the definition for the connection tool\n */\n addConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinition } {\n const tool = ToolUtility.createConnectionTool(toolType, connectionIds);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a file search tool to the tool set.\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n addFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createFileSearchTool(vectorStoreIds, vectorStores, definitionDetails);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds a code interpreter tool to the tool set.\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool\n */\n addCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createCodeInterpreterTool(fileIds, dataSources);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an Azure AI search tool to the tool set.\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool\n */\n addAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createAzureAISearchTool(indexConnectionId, indexName);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an OpenApi tool to the tool set.\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool\n */\n addOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n const tool = ToolUtility.createOpenApiTool(openApiFunctionDefinition);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a bing grounding search tool to the tool set.\n *\n * @param connectionId - The ID of the bing search connection.\n *\n * @returns An object containing the definition and resources for the bing grounding search tool\n */\n addBingGroundingTool(searchConfigurations: BingGroundingSearchConfiguration[]): {\n definition: BingGroundingToolDefinition;\n } {\n const tool = ToolUtility.createBingGroundingTool(searchConfigurations);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a connected agent tool to the tool set.\n *\n * @param id - The ID of the connected agent.\n * @param name - The name of the connected agent.\n * @param description - The description of the connected agent.\n * @returns An object containing the definition for the connected agent tool\n */\n addConnectedAgentTool(\n id: string,\n name: string,\n description: string,\n ): { definition: ConnectedAgentToolDefinition } {\n const tool = ToolUtility.createConnectedAgentTool(id, name, description);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n}\n"]}
|
|
@@ -8,7 +8,7 @@ const core_client_1 = require("@azure-rest/core-client");
|
|
|
8
8
|
function createAgents(endpointParam, credential, options = {}) {
|
|
9
9
|
const endpointUrl = options.endpoint ?? options.baseUrl ?? String(endpointParam);
|
|
10
10
|
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
11
|
-
const userAgentInfo = `azsdk-js-ai-agents/1.1.0
|
|
11
|
+
const userAgentInfo = `azsdk-js-ai-agents/1.1.0`;
|
|
12
12
|
const userAgentPrefix = prefixFromOptions
|
|
13
13
|
? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
|
|
14
14
|
: `azsdk-js-api ${userAgentInfo}`;
|
|
@@ -22,7 +22,7 @@ function createAgents(endpointParam, credential, options = {}) {
|
|
|
22
22
|
};
|
|
23
23
|
const clientContext = (0, core_client_1.getClient)(endpointUrl, credential, updatedOptions);
|
|
24
24
|
clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
25
|
-
const apiVersion = options.apiVersion ?? "
|
|
25
|
+
const apiVersion = options.apiVersion ?? "v1";
|
|
26
26
|
clientContext.pipeline.addPolicy({
|
|
27
27
|
name: "ClientApiVersionPolicy",
|
|
28
28
|
sendRequest: (req, next) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentsContext.js","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAoBlC,oCAsCC;AAxDD,4CAAsC;AAEtC,yDAA2E;AAgB3E,SAAgB,YAAY,CAC1B,aAAqB,EACrB,UAA2B,EAC3B,UAAsC,EAAE;IAExC,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC;IACjF,MAAM,iBAAiB,GAAG,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC;IACrE,MAAM,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"agentsContext.js","sourceRoot":"","sources":["../../../src/api/agentsContext.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAoBlC,oCAsCC;AAxDD,4CAAsC;AAEtC,yDAA2E;AAgB3E,SAAgB,YAAY,CAC1B,aAAqB,EACrB,UAA2B,EAC3B,UAAsC,EAAE;IAExC,M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AG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,aAAa,EAAE,UAAU,EAAmB,CAAC;AAC3D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport interface AgentsContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion: string;\n}\n\n/** Optional parameters for the client. */\nexport interface AgentsClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion?: string;\n}\n\nexport function createAgents(\n endpointParam: string,\n credential: TokenCredential,\n options: AgentsClientOptionalParams = {},\n): AgentsContext {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? String(endpointParam);\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-ai-agents/1.1.0`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`\n : `azsdk-js-api ${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://ai.azure.com/.default\"],\n },\n };\n const clientContext = getClient(endpointUrl, credential, updatedOptions);\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? \"v1\";\n clientContext.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\")) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n return { ...clientContext, apiVersion } as AgentsContext;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../src/api/runs/operations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,2BAA2B,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../src/api/runs/operations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,2BAA2B,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAajG,OAAO,KAAK,EACV,2BAA2B,EAC3B,wCAAwC,EACxC,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAGxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEvF,OAAO,KAAK,EAAE,gBAAgB,EAA2B,MAAM,iCAAiC,CAAC;AAEjG,OAAO,KAAK,EAAE,cAAc,EAAmB,UAAU,EAAE,MAAM,iBAAiB,CAAC;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AQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,2BAAoD,GAC5D,gBAAgB,CAalB;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,2BAAoD,GAC5D,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAgBlD"}
|
|
@@ -75,9 +75,6 @@ function _submitToolOutputsToRunSend(context, threadId, runId, toolOutputs, opti
|
|
|
75
75
|
},
|
|
76
76
|
body: {
|
|
77
77
|
tool_outputs: toolOutputs.length > 0 ? (0, models_js_1.toolOutputArraySerializer)(toolOutputs) : undefined,
|
|
78
|
-
tool_approvals: !options?.toolApprovals
|
|
79
|
-
? options?.toolApprovals
|
|
80
|
-
: (0, models_js_1.toolApprovalArraySerializer)(options?.toolApprovals),
|
|
81
78
|
stream: options?.stream ?? false,
|
|
82
79
|
},
|
|
83
80
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/api/runs/operations.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAmClC,wCAwBC;AAED,sDASC;AAGD,8BAQC;AAED,kEAiCC;AAED,gFAWC;AAGD,wDA2BC;AAED,wCA0BC;AAED,sDASC;AAGD,8BAQC;AAED,kCAwBC;AAED,gDASC;AAGD,wBAQC;AAED,sCA0BC;AAED,oDAWC;AAGD,4BAYC;AAED,wCA0DC;AAED,sDASC;AAGD,8CAQC;AAGD,8BAkBC;AAGD,4CAqBC;AApbD,sDAYgC;AAUhC,4EAAgF;AAChF,wEAAwE;AAExE,yDAA+F;AAE/F,oDAAuF;AAEvF,4CAA4C;AAE5C,SAAgB,cAAc,CAC5B,OAAe,EACf,QAAgB,EAChB,KAAa,EACb,UAAuC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE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M,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;gBAC5D,CAAC,CAAC,SAAS,CAAC;QAChB,CAAC;QACD,YAAY,EAAE,OAAO,CAAC,cAAc,EAAE,YAAY;KACnD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAiB;IAC9C,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,KAAK,QAAQ;YACX,OAAO,YAAY,CAAC;QACtB,KAAK,aAAa;YAChB,OAAO,SAAS,CAAC;QACnB,KAAK,iBAAiB;YACpB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB,KAAK,WAAW,CAAC;QACjB,KAAK,SAAS,CAAC;QACf;YACE,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AgentsContext as Client } from \"../index.js\";\nimport type { ThreadRun, _AgentsPagedResultThreadRun, ToolOutput } from \"../../models/models.js\";\nimport {\n toolResourcesSerializer,\n toolDefinitionUnionArraySerializer,\n agentsResponseFormatOptionSerializer,\n agentV1ErrorDeserializer,\n threadMessageOptionsArraySerializer,\n truncationObjectSerializer,\n agentsToolChoiceOptionSerializer,\n threadRunDeserializer,\n _agentsPagedResultThreadRunDeserializer,\n toolOutputArraySerializer,\n toolApprovalArraySerializer,\n} from \"../../models/models.js\";\nimport type {\n RunsCancelRunOptionalParams,\n RunsSubmitToolOutputsToRunOptionalParams,\n RunsUpdateRunOptionalParams,\n RunsGetRunOptionalParams,\n RunsListRunsOptionalParams,\n RunsCreateRunOptionalParams,\n} from \"./options.js\";\nimport type { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { buildPagedAsyncIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { expandUrlTemplate } from \"../../static-helpers/urlTemplate.js\";\nimport type { StreamableMethod, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError, operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type { AgentRunResponse, AgentEventMessageStream } from \"../../models/streamingModels.js\";\nimport { createRunStreaming, submitToolOutputsToRunStreaming } from \"../operations.js\";\nimport type { OperationState, OperationStatus, PollerLike } from \"@azure/core-lro\";\nimport { createPoller } from \"../poller.js\";\n\nexport function _cancelRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsCancelRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}/cancel{?api-version}\",\n {\n threadId: threadId,\n runId: runId,\n \"api-version\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _cancelRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Cancels a run of an in‐progress thread. */\nexport async function cancelRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsCancelRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _cancelRunSend(context, threadId, runId, options);\n return _cancelRunDeserialize(result);\n}\n\nexport function _submitToolOutputsToRunSend(\n context: Client,\n threadId: string,\n runId: string,\n toolOutputs: ToolOutput[],\n options: RunsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}/submit_tool_outputs{?api-version}\",\n {\n threadId: threadId,\n runId: runId,\n \"api-version\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n tool_outputs: toolOutputs.length > 0 ? toolOutputArraySerializer(toolOutputs) : undefined,\n tool_approvals: !options?.toolApprovals\n ? options?.toolApprovals\n : toolApprovalArraySerializer(options?.toolApprovals),\n stream: options?.stream ?? false,\n },\n });\n}\n\nexport async function _submitToolOutputsToRunDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Submits outputs from tools as requested by tool calls in a run. */\nexport function submitToolOutputsToRun(\n context: Client,\n threadId: string,\n runId: string,\n toolOutputs: ToolOutput[],\n options: RunsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} },\n): AgentRunResponse {\n async function executeSubmitToolOutputsToRun(): Promise<ThreadRun> {\n const result = await _submitToolOutputsToRunSend(\n context,\n threadId,\n runId,\n toolOutputs,\n options,\n );\n\n return _submitToolOutputsToRunDeserialize(result);\n }\n\n return {\n then: function (onFulfilled, onRejected) {\n return executeSubmitToolOutputsToRun().then(onFulfilled, onRejected).catch(onRejected);\n },\n async stream(): Promise<AgentEventMessageStream> {\n return submitToolOutputsToRunStreaming(context, threadId, runId, toolOutputs, options);\n },\n };\n}\n\nexport function _updateRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsUpdateRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}{?api-version}\",\n {\n threadId: threadId,\n runId: runId,\n \"api-version\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: { metadata: options?.metadata },\n });\n}\n\nexport async function _updateRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Modifies an existing thread run. */\nexport async function updateRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsUpdateRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _updateRunSend(context, threadId, runId, options);\n return _updateRunDeserialize(result);\n}\n\nexport function _getRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsGetRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}{?api-version}\",\n {\n threadId: threadId,\n runId: runId,\n \"api-version\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _getRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Gets an existing run from an existing thread. */\nexport async function getRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsGetRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _getRunSend(context, threadId, runId, options);\n return _getRunDeserialize(result);\n}\n\nexport function _listRunsSend(\n context: Client,\n threadId: string,\n options: RunsListRunsOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs{?api-version,limit,order,after,before}\",\n {\n threadId: threadId,\n \"api-version\": context.apiVersion,\n limit: options?.limit,\n order: options?.order,\n after: options?.after,\n before: options?.before,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _listRunsDeserialize(\n result: PathUncheckedResponse,\n): Promise<_AgentsPagedResultThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return _agentsPagedResultThreadRunDeserializer(result.body);\n}\n\n/** Gets a list of runs for a specified thread. */\nexport function listRuns(\n context: Client,\n threadId: string,\n options: RunsListRunsOptionalParams = { requestOptions: {} },\n): PagedAsyncIterableIterator<ThreadRun> {\n return buildPagedAsyncIterator(\n context,\n () => _listRunsSend(context, threadId, options),\n _listRunsDeserialize,\n [\"200\"],\n { itemName: \"data\" },\n );\n}\n\nexport function _createRunSend(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs{?api-version,include%5B%5D}\",\n {\n threadId: threadId,\n \"api-version\": context.apiVersion,\n \"include%5B%5D\": !options?.include\n ? options?.include\n : options?.include.map((p: any) => {\n return p;\n }),\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n assistant_id: assistantId,\n model: options?.model,\n instructions: options?.instructions,\n additional_instructions: options?.additionalInstructions,\n additional_messages: !options?.additionalMessages\n ? options?.additionalMessages\n : threadMessageOptionsArraySerializer(options?.additionalMessages),\n tools: !options?.tools ? options?.tools : toolDefinitionUnionArraySerializer(options?.tools),\n tool_resources: !options?.toolResources\n ? options?.toolResources\n : toolResourcesSerializer(options?.toolResources),\n stream: options?.stream,\n temperature: options?.temperature,\n top_p: options?.topP,\n max_prompt_tokens: options?.maxPromptTokens,\n max_completion_tokens: options?.maxCompletionTokens,\n truncation_strategy: !options?.truncationStrategy\n ? options?.truncationStrategy\n : truncationObjectSerializer(options?.truncationStrategy),\n tool_choice: !options?.toolChoice\n ? options?.toolChoice\n : agentsToolChoiceOptionSerializer(options?.toolChoice),\n response_format: !options?.responseFormat\n ? options?.responseFormat\n : agentsResponseFormatOptionSerializer(options?.responseFormat),\n parallel_tool_calls: options?.parallelToolCalls,\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _createRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Creates a new run for an agent thread (internal implementation). */\nexport async function createRunInternal(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _createRunSend(context, threadId, assistantId, options);\n return _createRunDeserialize(result);\n}\n\n/** Creates a new run for an agent thread. */\nexport function createRun(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): AgentRunResponse {\n async function executeCreateRun(): Promise<ThreadRun> {\n return createRunInternal(context, threadId, assistantId, options);\n }\n\n return {\n then: function (onFulfilled, onRejected) {\n return executeCreateRun().then(onFulfilled, onRejected).catch(onRejected);\n },\n async stream(): Promise<AgentEventMessageStream> {\n return createRunStreaming(context, assistantId, threadId, options);\n },\n };\n}\n\n/** Creates a new run for an agent thread with polling */\nexport function createRunAndPoll(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): PollerLike<OperationState<ThreadRun>, ThreadRun> {\n return createPoller<ThreadRun>({\n initOperation: async () => {\n return createRunInternal(context, threadId, assistantId, options);\n },\n pollOperation: async (currentRun: ThreadRun) => {\n return getRun(context, threadId, currentRun.id, options);\n },\n getOperationStatus: getLroOperationStatus,\n getOperationError: (result: ThreadRun) => {\n return getLroOperationStatus(result) === \"failed\" && result.lastError\n ? new Error(`Operation failed: ${result.lastError.message}`)\n : undefined;\n },\n intervalInMs: options.pollingOptions?.intervalInMs,\n });\n}\n\nfunction getLroOperationStatus(result: ThreadRun): OperationStatus {\n switch (result.status) {\n case \"queued\":\n return \"notStarted\";\n case \"in_progress\":\n return \"running\";\n case \"requires_action\":\n return \"running\";\n case \"completed\":\n return \"succeeded\";\n case \"cancelled\":\n case \"expired\":\n default:\n return \"failed\";\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/api/runs/operations.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAkClC,wCAwBC;AAED,sDASC;AAGD,8BAQC;AAED,kEA8BC;AAED,gFAWC;AAGD,wDA2BC;AAED,wCA0BC;AAED,sDASC;AAGD,8BAQC;AAED,kCAwBC;AAED,gDASC;AAGD,wBAQC;AAED,sCA0BC;AAED,oDAWC;AAGD,4BAYC;AAED,wCA0DC;AAED,sDASC;AAGD,8CAQC;AAGD,8BAkBC;AAGD,4CAqBC;AAhbD,sDAWgC;AAUhC,4EAAgF;AAChF,wEAAwE;AAExE,yDAA+F;AAE/F,oDAAuF;AAEvF,4CAA4C;AAE5C,SAAgB,cAAc,CAC5B,OAAe,EACf,QAAgB,EAChB,KAAa,EACb,UAAuC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE7D,MAAM,IAAI,GAAG,IAAA,kCAAiB,EAC5B,uDAAuD,EACvD;QACE,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,KAAK;QACZ,aAAa,EAAE,OAAO,CAAC,UAAU;KAClC,EACD;QACE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe;KACxD,CACF,CAAC;IACF,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ACnB,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB,KAAK,WAAW,CAAC;QACjB,KAAK,SAAS,CAAC;QACf;YACE,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AgentsContext as Client } from \"../index.js\";\nimport type { ThreadRun, _AgentsPagedResultThreadRun, ToolOutput } from \"../../models/models.js\";\nimport {\n toolResourcesSerializer,\n toolDefinitionUnionArraySerializer,\n agentsResponseFormatOptionSerializer,\n agentV1ErrorDeserializer,\n threadMessageOptionsArraySerializer,\n truncationObjectSerializer,\n agentsToolChoiceOptionSerializer,\n threadRunDeserializer,\n _agentsPagedResultThreadRunDeserializer,\n toolOutputArraySerializer,\n} from \"../../models/models.js\";\nimport type {\n RunsCancelRunOptionalParams,\n RunsSubmitToolOutputsToRunOptionalParams,\n RunsUpdateRunOptionalParams,\n RunsGetRunOptionalParams,\n RunsListRunsOptionalParams,\n RunsCreateRunOptionalParams,\n} from \"./options.js\";\nimport type { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { buildPagedAsyncIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { expandUrlTemplate } from \"../../static-helpers/urlTemplate.js\";\nimport type { StreamableMethod, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError, operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type { AgentRunResponse, AgentEventMessageStream } from \"../../models/streamingModels.js\";\nimport { createRunStreaming, submitToolOutputsToRunStreaming } from \"../operations.js\";\nimport type { OperationState, OperationStatus, PollerLike } from \"@azure/core-lro\";\nimport { createPoller } from \"../poller.js\";\n\nexport function _cancelRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsCancelRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}/cancel{?api-version}\",\n {\n threadId: threadId,\n runId: runId,\n \"api-version\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _cancelRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Cancels a run of an in‐progress thread. */\nexport async function cancelRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsCancelRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _cancelRunSend(context, threadId, runId, options);\n return _cancelRunDeserialize(result);\n}\n\nexport function _submitToolOutputsToRunSend(\n context: Client,\n threadId: string,\n runId: string,\n toolOutputs: ToolOutput[],\n options: RunsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}/submit_tool_outputs{?api-version}\",\n {\n threadId: threadId,\n runId: runId,\n \"api-version\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n tool_outputs: toolOutputs.length > 0 ? toolOutputArraySerializer(toolOutputs) : undefined,\n stream: options?.stream ?? false,\n },\n });\n}\n\nexport async function _submitToolOutputsToRunDeserialize(\n result: PathUncheckedResponse,\n): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Submits outputs from tools as requested by tool calls in a run. */\nexport function submitToolOutputsToRun(\n context: Client,\n threadId: string,\n runId: string,\n toolOutputs: ToolOutput[],\n options: RunsSubmitToolOutputsToRunOptionalParams = { requestOptions: {} },\n): AgentRunResponse {\n async function executeSubmitToolOutputsToRun(): Promise<ThreadRun> {\n const result = await _submitToolOutputsToRunSend(\n context,\n threadId,\n runId,\n toolOutputs,\n options,\n );\n\n return _submitToolOutputsToRunDeserialize(result);\n }\n\n return {\n then: function (onFulfilled, onRejected) {\n return executeSubmitToolOutputsToRun().then(onFulfilled, onRejected).catch(onRejected);\n },\n async stream(): Promise<AgentEventMessageStream> {\n return submitToolOutputsToRunStreaming(context, threadId, runId, toolOutputs, options);\n },\n };\n}\n\nexport function _updateRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsUpdateRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}{?api-version}\",\n {\n threadId: threadId,\n runId: runId,\n \"api-version\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: { metadata: options?.metadata },\n });\n}\n\nexport async function _updateRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Modifies an existing thread run. */\nexport async function updateRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsUpdateRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _updateRunSend(context, threadId, runId, options);\n return _updateRunDeserialize(result);\n}\n\nexport function _getRunSend(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsGetRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs/{runId}{?api-version}\",\n {\n threadId: threadId,\n runId: runId,\n \"api-version\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _getRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Gets an existing run from an existing thread. */\nexport async function getRun(\n context: Client,\n threadId: string,\n runId: string,\n options: RunsGetRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _getRunSend(context, threadId, runId, options);\n return _getRunDeserialize(result);\n}\n\nexport function _listRunsSend(\n context: Client,\n threadId: string,\n options: RunsListRunsOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs{?api-version,limit,order,after,before}\",\n {\n threadId: threadId,\n \"api-version\": context.apiVersion,\n limit: options?.limit,\n order: options?.order,\n after: options?.after,\n before: options?.before,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _listRunsDeserialize(\n result: PathUncheckedResponse,\n): Promise<_AgentsPagedResultThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return _agentsPagedResultThreadRunDeserializer(result.body);\n}\n\n/** Gets a list of runs for a specified thread. */\nexport function listRuns(\n context: Client,\n threadId: string,\n options: RunsListRunsOptionalParams = { requestOptions: {} },\n): PagedAsyncIterableIterator<ThreadRun> {\n return buildPagedAsyncIterator(\n context,\n () => _listRunsSend(context, threadId, options),\n _listRunsDeserialize,\n [\"200\"],\n { itemName: \"data\" },\n );\n}\n\nexport function _createRunSend(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/threads/{threadId}/runs{?api-version,include%5B%5D}\",\n {\n threadId: threadId,\n \"api-version\": context.apiVersion,\n \"include%5B%5D\": !options?.include\n ? options?.include\n : options?.include.map((p: any) => {\n return p;\n }),\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: {\n assistant_id: assistantId,\n model: options?.model,\n instructions: options?.instructions,\n additional_instructions: options?.additionalInstructions,\n additional_messages: !options?.additionalMessages\n ? options?.additionalMessages\n : threadMessageOptionsArraySerializer(options?.additionalMessages),\n tools: !options?.tools ? options?.tools : toolDefinitionUnionArraySerializer(options?.tools),\n tool_resources: !options?.toolResources\n ? options?.toolResources\n : toolResourcesSerializer(options?.toolResources),\n stream: options?.stream,\n temperature: options?.temperature,\n top_p: options?.topP,\n max_prompt_tokens: options?.maxPromptTokens,\n max_completion_tokens: options?.maxCompletionTokens,\n truncation_strategy: !options?.truncationStrategy\n ? options?.truncationStrategy\n : truncationObjectSerializer(options?.truncationStrategy),\n tool_choice: !options?.toolChoice\n ? options?.toolChoice\n : agentsToolChoiceOptionSerializer(options?.toolChoice),\n response_format: !options?.responseFormat\n ? options?.responseFormat\n : agentsResponseFormatOptionSerializer(options?.responseFormat),\n parallel_tool_calls: options?.parallelToolCalls,\n metadata: options?.metadata,\n },\n });\n}\n\nexport async function _createRunDeserialize(result: PathUncheckedResponse): Promise<ThreadRun> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = agentV1ErrorDeserializer(result.body);\n throw error;\n }\n\n return threadRunDeserializer(result.body);\n}\n\n/** Creates a new run for an agent thread (internal implementation). */\nexport async function createRunInternal(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): Promise<ThreadRun> {\n const result = await _createRunSend(context, threadId, assistantId, options);\n return _createRunDeserialize(result);\n}\n\n/** Creates a new run for an agent thread. */\nexport function createRun(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): AgentRunResponse {\n async function executeCreateRun(): Promise<ThreadRun> {\n return createRunInternal(context, threadId, assistantId, options);\n }\n\n return {\n then: function (onFulfilled, onRejected) {\n return executeCreateRun().then(onFulfilled, onRejected).catch(onRejected);\n },\n async stream(): Promise<AgentEventMessageStream> {\n return createRunStreaming(context, assistantId, threadId, options);\n },\n };\n}\n\n/** Creates a new run for an agent thread with polling */\nexport function createRunAndPoll(\n context: Client,\n threadId: string,\n assistantId: string,\n options: RunsCreateRunOptionalParams = { requestOptions: {} },\n): PollerLike<OperationState<ThreadRun>, ThreadRun> {\n return createPoller<ThreadRun>({\n initOperation: async () => {\n return createRunInternal(context, threadId, assistantId, options);\n },\n pollOperation: async (currentRun: ThreadRun) => {\n return getRun(context, threadId, currentRun.id, options);\n },\n getOperationStatus: getLroOperationStatus,\n getOperationError: (result: ThreadRun) => {\n return getLroOperationStatus(result) === \"failed\" && result.lastError\n ? new Error(`Operation failed: ${result.lastError.message}`)\n : undefined;\n },\n intervalInMs: options.pollingOptions?.intervalInMs,\n });\n}\n\nfunction getLroOperationStatus(result: ThreadRun): OperationStatus {\n switch (result.status) {\n case \"queued\":\n return \"notStarted\";\n case \"in_progress\":\n return \"running\";\n case \"requires_action\":\n return \"running\";\n case \"completed\":\n return \"succeeded\";\n case \"cancelled\":\n case \"expired\":\n default:\n return \"failed\";\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolDefinitionUnion, ToolResources, AgentsResponseFormatOption, ThreadMessageOptions, TruncationObject, AgentsToolChoiceOption,
|
|
1
|
+
import type { ToolDefinitionUnion, ToolResources, AgentsResponseFormatOption, ThreadMessageOptions, TruncationObject, AgentsToolChoiceOption, ListSortOrder, RunAdditionalFieldList } from "../../models/models.js";
|
|
2
2
|
import type { OperationOptions } from "@azure-rest/core-client";
|
|
3
3
|
import type { PollingOptionsParams } from "../options.js";
|
|
4
4
|
/** Optional parameters. */
|
|
@@ -6,10 +6,6 @@ export interface RunsCancelRunOptionalParams extends OperationOptions {
|
|
|
6
6
|
}
|
|
7
7
|
/** Optional parameters. */
|
|
8
8
|
export interface RunsSubmitToolOutputsToRunOptionalParams extends OperationOptions {
|
|
9
|
-
/** A list of tools for which the outputs are being submitted */
|
|
10
|
-
toolOutputs?: ToolOutput[];
|
|
11
|
-
/** A list of tool approvals allowing data to be sent to tools. */
|
|
12
|
-
toolApprovals?: ToolApproval[];
|
|
13
9
|
/** If true, returns a stream of events that happen during the Run as SSE, terminating at `[DONE]`. */
|
|
14
10
|
stream?: boolean | null;
|
|
15
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../src/api/runs/options.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,0BAA0B,EAC1B,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../src/api/runs/options.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,0BAA0B,EAC1B,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,EACb,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,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AAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC7C,qEAAqE;IACrE,UAAU,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC3C,uDAAuD;IACvD,cAAc,CAAC,EAAE,0BAA0B,GAAG,IAAI,CAAC;IACnD,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,yPAAyP;IACzP,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/api/runs/options.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n ToolDefinitionUnion,\n ToolResources,\n AgentsResponseFormatOption,\n ThreadMessageOptions,\n TruncationObject,\n AgentsToolChoiceOption,\n
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../src/api/runs/options.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n ToolDefinitionUnion,\n ToolResources,\n AgentsResponseFormatOption,\n ThreadMessageOptions,\n TruncationObject,\n AgentsToolChoiceOption,\n ListSortOrder,\n RunAdditionalFieldList,\n} from \"../../models/models.js\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type { PollingOptionsParams } from \"../options.js\";\n\n/** Optional parameters. */\nexport interface RunsCancelRunOptionalParams extends OperationOptions {}\n\n/** Optional parameters. */\nexport interface RunsSubmitToolOutputsToRunOptionalParams extends OperationOptions {\n /** If true, returns a stream of events that happen during the Run as SSE, terminating at `[DONE]`. */\n stream?: boolean | null;\n}\n\n/** Optional parameters. */\nexport interface RunsUpdateRunOptionalParams extends OperationOptions {\n /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */\n metadata?: Record<string, string> | null;\n}\n\n/** Optional parameters. */\nexport interface RunsGetRunOptionalParams extends OperationOptions {}\n\n/** Optional parameters. */\nexport interface RunsListRunsOptionalParams extends OperationOptions {\n /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */\n limit?: number;\n /** Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. */\n order?: ListSortOrder;\n /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */\n after?: string;\n /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */\n before?: string;\n}\n\n/** Optional parameters. */\nexport interface RunsCreateRunOptionalParams extends OperationOptions, PollingOptionsParams {\n /**\n * A list of additional fields to include in the response.\n * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content`\n * to fetch the file search result content.\n */\n include?: RunAdditionalFieldList[];\n /** The overridden model name that the agent should use to run the thread. */\n model?: string | null;\n /** The overridden system instructions that the agent should use to run the thread. */\n instructions?: string | null;\n /**\n * Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior\n * on a per-run basis without overriding other instructions.\n */\n additionalInstructions?: string | null;\n /** Adds additional messages to the thread before creating the run. */\n additionalMessages?: ThreadMessageOptions[] | null;\n /** The overridden list of enabled tools that the agent should use to run the thread. */\n tools?: ToolDefinitionUnion[] | null;\n /** The overridden enabled tool resources that the agent should use to run the thread. */\n toolResources?: ToolResources | null;\n /**\n * If `true`, returns a stream of events that happen during the Run as server-sent events,\n * terminating when the Run enters a terminal state with a `data: [DONE]` message.\n */\n stream?: boolean;\n /**\n * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output\n * more random, while lower values like 0.2 will make it more focused and deterministic.\n */\n temperature?: number | null;\n /**\n * An alternative to sampling with temperature, called nucleus sampling, where the model\n * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens\n * comprising the top 10% probability mass are considered.\n *\n * We generally recommend altering this or temperature but not both.\n */\n topP?: number | null;\n /**\n * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only\n * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified,\n * the run will end with status `incomplete`. See `incomplete_details` for more info.\n */\n maxPromptTokens?: number | null;\n /**\n * The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort\n * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of\n * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info.\n */\n maxCompletionTokens?: number | null;\n /** The strategy to use for dropping messages as the context windows moves forward. */\n truncationStrategy?: TruncationObject | null;\n /** Controls whether or not and which tool is called by the model. */\n toolChoice?: AgentsToolChoiceOption | null;\n /** Specifies the format that the model must output. */\n responseFormat?: AgentsResponseFormatOption | null;\n /** If `true` functions will run in parallel during tool use. */\n parallelToolCalls?: boolean;\n /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */\n metadata?: Record<string, string> | null;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,YAAY,qBAAqB,CAAC"}
|