@azure/ai-projects 1.0.0-beta.3 → 1.0.0-beta.4
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 +26 -3
- package/dist/browser/agents/assistants.js +2 -2
- package/dist/browser/agents/assistants.js.map +1 -1
- package/dist/browser/agents/inputValidations.js +2 -2
- package/dist/browser/agents/inputValidations.js.map +1 -1
- package/dist/browser/agents/utils.d.ts +19 -1
- package/dist/browser/agents/utils.d.ts.map +1 -1
- package/dist/browser/agents/utils.js +29 -2
- package/dist/browser/agents/utils.js.map +1 -1
- package/dist/browser/constants.d.ts +1 -1
- package/dist/browser/constants.js +1 -1
- package/dist/browser/constants.js.map +1 -1
- package/dist/browser/customization/convertModelsToWrite.d.ts.map +1 -1
- package/dist/browser/customization/convertModelsToWrite.js +2 -2
- package/dist/browser/customization/convertModelsToWrite.js.map +1 -1
- package/dist/browser/customization/convertOutputModelsFromWire.d.ts.map +1 -1
- package/dist/browser/customization/convertOutputModelsFromWire.js +5 -5
- package/dist/browser/customization/convertOutputModelsFromWire.js.map +1 -1
- package/dist/browser/customization/models.d.ts +5 -5
- package/dist/browser/customization/models.d.ts.map +1 -1
- package/dist/browser/customization/models.js.map +1 -1
- package/dist/browser/customization/outputModels.d.ts +8 -8
- package/dist/browser/customization/outputModels.d.ts.map +1 -1
- package/dist/browser/customization/outputModels.js.map +1 -1
- package/dist/browser/generated/src/clientDefinitions.d.ts +3 -3
- package/dist/browser/generated/src/clientDefinitions.d.ts.map +1 -1
- package/dist/browser/generated/src/clientDefinitions.js.map +1 -1
- package/dist/browser/generated/src/isUnexpected.d.ts +1 -1
- package/dist/browser/generated/src/isUnexpected.d.ts.map +1 -1
- package/dist/browser/generated/src/isUnexpected.js.map +1 -1
- package/dist/browser/generated/src/models.d.ts +65 -12
- package/dist/browser/generated/src/models.d.ts.map +1 -1
- package/dist/browser/generated/src/models.js.map +1 -1
- package/dist/browser/generated/src/outputModels.d.ts +98 -19
- package/dist/browser/generated/src/outputModels.d.ts.map +1 -1
- package/dist/browser/generated/src/outputModels.js.map +1 -1
- package/dist/browser/generated/src/paginateHelper.d.ts +1 -1
- package/dist/browser/generated/src/paginateHelper.d.ts.map +1 -1
- package/dist/browser/generated/src/paginateHelper.js +1 -1
- package/dist/browser/generated/src/paginateHelper.js.map +1 -1
- package/dist/browser/generated/src/parameters.d.ts +67 -10
- package/dist/browser/generated/src/parameters.d.ts.map +1 -1
- package/dist/browser/generated/src/parameters.js.map +1 -1
- package/dist/browser/generated/src/projectsClient.d.ts +3 -3
- package/dist/browser/generated/src/projectsClient.d.ts.map +1 -1
- package/dist/browser/generated/src/projectsClient.js +1 -1
- package/dist/browser/generated/src/projectsClient.js.map +1 -1
- package/dist/browser/generated/src/responses.d.ts +5 -4
- package/dist/browser/generated/src/responses.d.ts.map +1 -1
- package/dist/browser/generated/src/responses.js.map +1 -1
- package/dist/commonjs/agents/assistants.js +2 -2
- package/dist/commonjs/agents/assistants.js.map +1 -1
- package/dist/commonjs/agents/inputValidations.js +2 -2
- package/dist/commonjs/agents/inputValidations.js.map +1 -1
- package/dist/commonjs/agents/utils.d.ts +19 -1
- package/dist/commonjs/agents/utils.d.ts.map +1 -1
- package/dist/commonjs/agents/utils.js +29 -2
- package/dist/commonjs/agents/utils.js.map +1 -1
- package/dist/commonjs/constants.d.ts +1 -1
- package/dist/commonjs/constants.js +1 -1
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/commonjs/customization/convertModelsToWrite.d.ts.map +1 -1
- package/dist/commonjs/customization/convertModelsToWrite.js +2 -2
- package/dist/commonjs/customization/convertModelsToWrite.js.map +1 -1
- package/dist/commonjs/customization/convertOutputModelsFromWire.d.ts.map +1 -1
- package/dist/commonjs/customization/convertOutputModelsFromWire.js +5 -5
- package/dist/commonjs/customization/convertOutputModelsFromWire.js.map +1 -1
- package/dist/commonjs/customization/models.d.ts +5 -5
- package/dist/commonjs/customization/models.d.ts.map +1 -1
- package/dist/commonjs/customization/models.js.map +1 -1
- package/dist/commonjs/customization/outputModels.d.ts +8 -8
- package/dist/commonjs/customization/outputModels.d.ts.map +1 -1
- package/dist/commonjs/customization/outputModels.js.map +1 -1
- package/dist/commonjs/generated/src/clientDefinitions.d.ts +3 -3
- package/dist/commonjs/generated/src/clientDefinitions.d.ts.map +1 -1
- package/dist/commonjs/generated/src/clientDefinitions.js.map +1 -1
- package/dist/commonjs/generated/src/isUnexpected.d.ts +1 -1
- package/dist/commonjs/generated/src/isUnexpected.d.ts.map +1 -1
- package/dist/commonjs/generated/src/isUnexpected.js.map +1 -1
- package/dist/commonjs/generated/src/models.d.ts +65 -12
- package/dist/commonjs/generated/src/models.d.ts.map +1 -1
- package/dist/commonjs/generated/src/models.js.map +1 -1
- package/dist/commonjs/generated/src/outputModels.d.ts +98 -19
- package/dist/commonjs/generated/src/outputModels.d.ts.map +1 -1
- package/dist/commonjs/generated/src/outputModels.js.map +1 -1
- package/dist/commonjs/generated/src/paginateHelper.d.ts +1 -1
- package/dist/commonjs/generated/src/paginateHelper.d.ts.map +1 -1
- package/dist/commonjs/generated/src/paginateHelper.js.map +1 -1
- package/dist/commonjs/generated/src/parameters.d.ts +67 -10
- package/dist/commonjs/generated/src/parameters.d.ts.map +1 -1
- package/dist/commonjs/generated/src/parameters.js.map +1 -1
- package/dist/commonjs/generated/src/projectsClient.d.ts +3 -3
- package/dist/commonjs/generated/src/projectsClient.d.ts.map +1 -1
- package/dist/commonjs/generated/src/projectsClient.js +1 -1
- package/dist/commonjs/generated/src/projectsClient.js.map +1 -1
- package/dist/commonjs/generated/src/responses.d.ts +5 -4
- package/dist/commonjs/generated/src/responses.d.ts.map +1 -1
- package/dist/commonjs/generated/src/responses.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/esm/agents/assistants.js +2 -2
- package/dist/esm/agents/assistants.js.map +1 -1
- package/dist/esm/agents/inputValidations.js +2 -2
- package/dist/esm/agents/inputValidations.js.map +1 -1
- package/dist/esm/agents/utils.d.ts +19 -1
- package/dist/esm/agents/utils.d.ts.map +1 -1
- package/dist/esm/agents/utils.js +29 -2
- package/dist/esm/agents/utils.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/customization/convertModelsToWrite.d.ts.map +1 -1
- package/dist/esm/customization/convertModelsToWrite.js +2 -2
- package/dist/esm/customization/convertModelsToWrite.js.map +1 -1
- package/dist/esm/customization/convertOutputModelsFromWire.d.ts.map +1 -1
- package/dist/esm/customization/convertOutputModelsFromWire.js +5 -5
- package/dist/esm/customization/convertOutputModelsFromWire.js.map +1 -1
- package/dist/esm/customization/models.d.ts +5 -5
- package/dist/esm/customization/models.d.ts.map +1 -1
- package/dist/esm/customization/models.js.map +1 -1
- package/dist/esm/customization/outputModels.d.ts +8 -8
- package/dist/esm/customization/outputModels.d.ts.map +1 -1
- package/dist/esm/customization/outputModels.js.map +1 -1
- package/dist/esm/generated/src/clientDefinitions.d.ts +3 -3
- package/dist/esm/generated/src/clientDefinitions.d.ts.map +1 -1
- package/dist/esm/generated/src/clientDefinitions.js.map +1 -1
- package/dist/esm/generated/src/isUnexpected.d.ts +1 -1
- package/dist/esm/generated/src/isUnexpected.d.ts.map +1 -1
- package/dist/esm/generated/src/isUnexpected.js.map +1 -1
- package/dist/esm/generated/src/models.d.ts +65 -12
- package/dist/esm/generated/src/models.d.ts.map +1 -1
- package/dist/esm/generated/src/models.js.map +1 -1
- package/dist/esm/generated/src/outputModels.d.ts +98 -19
- package/dist/esm/generated/src/outputModels.d.ts.map +1 -1
- package/dist/esm/generated/src/outputModels.js.map +1 -1
- package/dist/esm/generated/src/paginateHelper.d.ts +1 -1
- package/dist/esm/generated/src/paginateHelper.d.ts.map +1 -1
- package/dist/esm/generated/src/paginateHelper.js +1 -1
- package/dist/esm/generated/src/paginateHelper.js.map +1 -1
- package/dist/esm/generated/src/parameters.d.ts +67 -10
- package/dist/esm/generated/src/parameters.d.ts.map +1 -1
- package/dist/esm/generated/src/parameters.js.map +1 -1
- package/dist/esm/generated/src/projectsClient.d.ts +3 -3
- package/dist/esm/generated/src/projectsClient.d.ts.map +1 -1
- package/dist/esm/generated/src/projectsClient.js +1 -1
- package/dist/esm/generated/src/projectsClient.js.map +1 -1
- package/dist/esm/generated/src/responses.d.ts +5 -4
- package/dist/esm/generated/src/responses.d.ts.map +1 -1
- package/dist/esm/generated/src/responses.js.map +1 -1
- package/dist/react-native/agents/assistants.js +2 -2
- package/dist/react-native/agents/assistants.js.map +1 -1
- package/dist/react-native/agents/inputValidations.js +2 -2
- package/dist/react-native/agents/inputValidations.js.map +1 -1
- package/dist/react-native/agents/utils.d.ts +19 -1
- package/dist/react-native/agents/utils.d.ts.map +1 -1
- package/dist/react-native/agents/utils.js +29 -2
- package/dist/react-native/agents/utils.js.map +1 -1
- package/dist/react-native/constants.d.ts +1 -1
- package/dist/react-native/constants.js +1 -1
- package/dist/react-native/constants.js.map +1 -1
- package/dist/react-native/customization/convertModelsToWrite.d.ts.map +1 -1
- package/dist/react-native/customization/convertModelsToWrite.js +2 -2
- package/dist/react-native/customization/convertModelsToWrite.js.map +1 -1
- package/dist/react-native/customization/convertOutputModelsFromWire.d.ts.map +1 -1
- package/dist/react-native/customization/convertOutputModelsFromWire.js +5 -5
- package/dist/react-native/customization/convertOutputModelsFromWire.js.map +1 -1
- package/dist/react-native/customization/models.d.ts +5 -5
- package/dist/react-native/customization/models.d.ts.map +1 -1
- package/dist/react-native/customization/models.js.map +1 -1
- package/dist/react-native/customization/outputModels.d.ts +8 -8
- package/dist/react-native/customization/outputModels.d.ts.map +1 -1
- package/dist/react-native/customization/outputModels.js.map +1 -1
- package/dist/react-native/generated/src/clientDefinitions.d.ts +3 -3
- package/dist/react-native/generated/src/clientDefinitions.d.ts.map +1 -1
- package/dist/react-native/generated/src/clientDefinitions.js.map +1 -1
- package/dist/react-native/generated/src/isUnexpected.d.ts +1 -1
- package/dist/react-native/generated/src/isUnexpected.d.ts.map +1 -1
- package/dist/react-native/generated/src/isUnexpected.js.map +1 -1
- package/dist/react-native/generated/src/models.d.ts +65 -12
- package/dist/react-native/generated/src/models.d.ts.map +1 -1
- package/dist/react-native/generated/src/models.js.map +1 -1
- package/dist/react-native/generated/src/outputModels.d.ts +98 -19
- package/dist/react-native/generated/src/outputModels.d.ts.map +1 -1
- package/dist/react-native/generated/src/outputModels.js.map +1 -1
- package/dist/react-native/generated/src/paginateHelper.d.ts +1 -1
- package/dist/react-native/generated/src/paginateHelper.d.ts.map +1 -1
- package/dist/react-native/generated/src/paginateHelper.js +1 -1
- package/dist/react-native/generated/src/paginateHelper.js.map +1 -1
- package/dist/react-native/generated/src/parameters.d.ts +67 -10
- package/dist/react-native/generated/src/parameters.d.ts.map +1 -1
- package/dist/react-native/generated/src/parameters.js.map +1 -1
- package/dist/react-native/generated/src/projectsClient.d.ts +3 -3
- package/dist/react-native/generated/src/projectsClient.d.ts.map +1 -1
- package/dist/react-native/generated/src/projectsClient.js +1 -1
- package/dist/react-native/generated/src/projectsClient.js.map +1 -1
- package/dist/react-native/generated/src/responses.d.ts +5 -4
- package/dist/react-native/generated/src/responses.d.ts.map +1 -1
- package/dist/react-native/generated/src/responses.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ Use the AI Projects client library (in preview) to:
|
|
|
33
33
|
- [Bing grounding](#create-agent-with-bing-grounding)
|
|
34
34
|
- [Azure AI Search](#create-agent-with-azure-ai-search)
|
|
35
35
|
- [Function call](#create-agent-with-function-call)
|
|
36
|
+
- [Fabric Data](#create-an-agent-with-fabric)
|
|
36
37
|
- [Create thread](#create-thread) with
|
|
37
38
|
- [Tool resource](#create-thread-with-tool-resource)
|
|
38
39
|
- [Create message](#create-message) with:
|
|
@@ -378,6 +379,30 @@ const agent = await client.agents.createAgent("gpt-4o", {
|
|
|
378
379
|
console.log(`Created agent, agent ID: ${agent.id}`);
|
|
379
380
|
```
|
|
380
381
|
|
|
382
|
+
#### Create an Agent with Fabric
|
|
383
|
+
|
|
384
|
+
To enable your Agent to answer queries using Fabric data, use `FabricTool` along with a connection to the Fabric resource.
|
|
385
|
+
|
|
386
|
+
Here is an example:
|
|
387
|
+
|
|
388
|
+
```ts snippet:createAgentWithFabric
|
|
389
|
+
import { ToolUtility } from "@azure/ai-projects";
|
|
390
|
+
|
|
391
|
+
const fabricConnection = await client.connections.getConnection(
|
|
392
|
+
process.env["FABRIC_CONNECTION_NAME"] || "<connection-name>",
|
|
393
|
+
);
|
|
394
|
+
const connectionId = fabricConnection.id;
|
|
395
|
+
// Initialize agent Microsoft Fabric tool with the connection id
|
|
396
|
+
const fabricTool = ToolUtility.createFabricTool(connectionId);
|
|
397
|
+
// Create agent with the Microsoft Fabric tool and process assistant run
|
|
398
|
+
const agent = await client.agents.createAgent("gpt-4o", {
|
|
399
|
+
name: "my-agent",
|
|
400
|
+
instructions: "You are a helpful agent",
|
|
401
|
+
tools: [fabricTool.definition],
|
|
402
|
+
});
|
|
403
|
+
console.log(`Created agent, agent ID : ${agent.id}`);
|
|
404
|
+
```
|
|
405
|
+
|
|
381
406
|
#### Create Thread
|
|
382
407
|
|
|
383
408
|
For each session or conversation, a thread is required. Here is an example:
|
|
@@ -462,7 +487,6 @@ const agent = await client.agents.createAgent("gpt-4-1106-preview", {
|
|
|
462
487
|
tools: [codeInterpreterTool.definition],
|
|
463
488
|
});
|
|
464
489
|
console.log(`Created agent, agent ID: ${agent.id}`);
|
|
465
|
-
|
|
466
490
|
const thread = await client.agents.createThread();
|
|
467
491
|
console.log(`Created thread, thread ID: ${thread.id}`);
|
|
468
492
|
const message = await client.agents.createMessage(thread.id, {
|
|
@@ -499,7 +523,7 @@ To have the SDK poll on your behalf, use the `createThreadAndRun` method.
|
|
|
499
523
|
|
|
500
524
|
Here is an example:
|
|
501
525
|
|
|
502
|
-
```
|
|
526
|
+
```ts snippet:createThreadAndRun
|
|
503
527
|
const run = await client.agents.createThreadAndRun(agent.id, {
|
|
504
528
|
thread: {
|
|
505
529
|
messages: [
|
|
@@ -579,7 +603,6 @@ while (messages.hasMore) {
|
|
|
579
603
|
messages.hasMore = nextMessages.hasMore;
|
|
580
604
|
messages.lastId = nextMessages.lastId;
|
|
581
605
|
}
|
|
582
|
-
|
|
583
606
|
// The messages are following in the reverse order,
|
|
584
607
|
// we will iterate them and output only text contents.
|
|
585
608
|
for (const dataPoint of messages.data.reverse()) {
|
|
@@ -16,7 +16,7 @@ var Tools;
|
|
|
16
16
|
Tools["FileSearch"] = "file_search";
|
|
17
17
|
Tools["Function"] = "function";
|
|
18
18
|
Tools["BingGrounding"] = "bing_grounding";
|
|
19
|
-
Tools["MicrosoftFabric"] = "
|
|
19
|
+
Tools["MicrosoftFabric"] = "fabric_dataagent";
|
|
20
20
|
Tools["SharepointGrounding"] = "sharepoint_grounding";
|
|
21
21
|
Tools["AzureAISearch"] = "azure_ai_search";
|
|
22
22
|
Tools["OpenApi"] = "openapi";
|
|
@@ -97,7 +97,7 @@ function validateCreateAgentParameters(options) {
|
|
|
97
97
|
var _a;
|
|
98
98
|
if (options.body.tools) {
|
|
99
99
|
if (options.body.tools.some((value) => !Object.values(Tools).includes(value.type))) {
|
|
100
|
-
throw new Error("Tool type must be one of 'code_interpreter', 'file_search', 'function', 'bing_grounding', '
|
|
100
|
+
throw new Error("Tool type must be one of 'code_interpreter', 'file_search', 'function', 'bing_grounding', 'fabric_dataagent', 'sharepoint_grounding', 'azure_ai_search', 'azure_function'");
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
if (options.body.tool_resources) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistants.js","sourceRoot":"","sources":["../../../src/agents/assistants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAM9E,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,2BAA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O,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,0CAAE,KAAK,EAAE,CAAC;QACpC,aAAa,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,WAAmB;IAC9C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,SAAS,6BAA6B,CACpC,WAAmB,EACnB,OAAmD;IAEnD,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACjC,IAAI,OAAO,EAAE,CAAC;QACZ,6BAA6B,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client } from \"@azure-rest/core-client\";\nimport { operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type {\n AgentDeletionStatusOutput,\n AgentOutput,\n OpenAIPageableListOfAgentOutput,\n} from \"../customization/outputModels.js\";\nimport {\n validateLimit,\n validateMetadata,\n validateOrder,\n validateVectorStoreDataType,\n} from \"./inputValidations.js\";\nimport { TracingUtility } from \"../tracing.js\";\nimport { traceEndCreateOrUpdateAgent, traceStartCreateOrUpdateAgent } from \"./assistantsTrace.js\";\nimport { traceEndAgentGeneric, traceStartAgentGeneric } from \"./traceUtility.js\";\nimport type {\n CreateAgentOptionalParams,\n DeleteAgentOptionalParams,\n GetAgentOptionalParams,\n ListAgentsOptionalParams,\n UpdateAgentOptionalParams,\n} from \"./customModels.js\";\nimport type * as GeneratedParameters from \"../generated/src/parameters.js\";\nimport * as ConvertFromWire from \"../customization/convertOutputModelsFromWire.js\";\nimport * as ConverterToWire from \"../customization/convertModelsToWrite.js\";\nimport { convertToListQueryParameters } from \"../customization/convertParametersToWire.js\";\nimport { createOpenAIError } from \"./openAIError.js\";\n\nconst expectedStatuses = [\"200\"];\n\nenum Tools {\n CodeInterpreter = \"code_interpreter\",\n FileSearch = \"file_search\",\n Function = \"function\",\n BingGrounding = \"bing_grounding\",\n MicrosoftFabric = \"microsoft_fabric\",\n SharepointGrounding = \"sharepoint_grounding\",\n AzureAISearch = \"azure_ai_search\",\n OpenApi = \"openapi\",\n AzureFunction = \"azure_function\",\n}\n\n/** Creates a new agent. */\nexport async function createAgent(\n context: Client,\n model: string,\n options: CreateAgentOptionalParams = {},\n): Promise<AgentOutput> {\n const createOptions: GeneratedParameters.CreateAgentParameters = {\n ...operationOptionsToRequestParameters(options),\n body: {\n ...ConverterToWire.convertCreateAgentOptions({ ...options, model }),\n },\n };\n\n validateCreateAgentParameters(createOptions);\n const response = await TracingUtility.withSpan(\n \"CreateAgent\",\n createOptions,\n async (updatedOptions) => {\n const result = await context.path(\"/assistants\").post(updatedOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return result.body;\n },\n traceStartCreateOrUpdateAgent,\n traceEndCreateOrUpdateAgent,\n );\n return ConvertFromWire.convertAgentOutput(response);\n}\n\n/** Gets a list of agents that were previously created. */\nexport async function listAgents(\n context: Client,\n options: ListAgentsOptionalParams = {},\n): Promise<OpenAIPageableListOfAgentOutput> {\n const listAgentsOptions: GeneratedParameters.ListAgentsParameters = {\n ...operationOptionsToRequestParameters(options),\n queryParameters: convertToListQueryParameters(options),\n };\n\n validateListAgentsParameters(listAgentsOptions);\n const response = await TracingUtility.withSpan(\n \"ListAgents\",\n listAgentsOptions || {},\n async (updateOptions) => {\n const result = await context.path(\"/assistants\").get(updateOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return result.body;\n },\n );\n\n return ConvertFromWire.convertOpenAIPageableListOfAgentOutput(response);\n}\n\n/** Retrieves an existing agent. */\nexport async function getAgent(\n context: Client,\n assistantId: string,\n options: GetAgentOptionalParams = {},\n): Promise<AgentOutput> {\n const getAgentOptions: GeneratedParameters.GetAgentParameters = {\n ...operationOptionsToRequestParameters(options),\n };\n\n validateAssistantId(assistantId);\n const response = await TracingUtility.withSpan(\n \"GetAgent\",\n getAgentOptions,\n async (updateOptions) => {\n const result = await context\n .path(\"/assistants/{assistantId}\", assistantId)\n .get(updateOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return result.body;\n },\n (span, updatedOptions) =>\n traceStartAgentGeneric(span, {\n ...updatedOptions,\n tracingAttributeOptions: { agentId: assistantId },\n }),\n );\n\n return ConvertFromWire.convertAgentOutput(response);\n}\n\n/** Modifies an existing agent. */\nexport async function updateAgent(\n context: Client,\n assistantId: string,\n options: UpdateAgentOptionalParams = {},\n): Promise<AgentOutput> {\n const updateAgentOptions: GeneratedParameters.UpdateAgentParameters = {\n ...operationOptionsToRequestParameters(options),\n body: {\n ...ConverterToWire.convertUpdateAgentOptions(options),\n },\n };\n\n validateUpdateAgentParameters(assistantId, updateAgentOptions);\n const response = await TracingUtility.withSpan(\n \"UpdateAgent\",\n updateAgentOptions,\n async (updateOptions) => {\n const result = await context\n .path(\"/assistants/{assistantId}\", assistantId)\n .post(updateOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return result.body;\n },\n (span, updatedOptions) => traceStartCreateOrUpdateAgent(span, updatedOptions, assistantId),\n traceEndCreateOrUpdateAgent,\n );\n return ConvertFromWire.convertAgentOutput(response);\n}\n\n/** Deletes an agent. */\nexport async function deleteAgent(\n context: Client,\n assistantId: string,\n options: DeleteAgentOptionalParams = {},\n): Promise<AgentDeletionStatusOutput> {\n const deleteAgentOptions: GeneratedParameters.DeleteAgentParameters = {\n ...operationOptionsToRequestParameters(options),\n };\n\n validateAssistantId(assistantId);\n const response = await TracingUtility.withSpan(\n \"DeleteAgent\",\n deleteAgentOptions,\n async (updateOptions) => {\n const result = await context\n .path(\"/assistants/{assistantId}\", assistantId)\n .delete(updateOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return result.body;\n },\n traceStartAgentGeneric,\n traceEndAgentGeneric,\n );\n return ConvertFromWire.convertAgentDeletionStatusOutput(response);\n}\n\nfunction validateCreateAgentParameters(\n options: GeneratedParameters.CreateAgentParameters | GeneratedParameters.UpdateAgentParameters,\n): void {\n if (options.body.tools) {\n if (options.body.tools.some((value) => !Object.values(Tools).includes(value.type as Tools))) {\n throw new Error(\n \"Tool type must be one of 'code_interpreter', 'file_search', 'function', 'bing_grounding', 'microsoft_fabric', 'sharepoint_grounding', 'azure_ai_search', 'azure_function'\",\n );\n }\n }\n if (options.body.tool_resources) {\n if (options.body.tool_resources.code_interpreter) {\n if (\n options.body.tool_resources.code_interpreter.file_ids &&\n options.body.tool_resources.code_interpreter.data_sources\n ) {\n throw new Error(\"Only file_ids or data_sources can be provided, not both\");\n }\n if (\n options.body.tool_resources.code_interpreter.file_ids &&\n options.body.tool_resources.code_interpreter.file_ids.length > 20\n ) {\n throw new Error(\"A maximum of 20 file IDs are allowed\");\n }\n if (options.body.tool_resources.code_interpreter.data_sources) {\n validateVectorStoreDataType(options.body.tool_resources.code_interpreter.data_sources);\n }\n }\n if (options.body.tool_resources.file_search) {\n if (\n options.body.tool_resources.file_search.vector_store_ids &&\n options.body.tool_resources.file_search.vector_store_ids.length > 1\n ) {\n throw new Error(\"Only one vector store ID is allowed\");\n }\n if (options.body.tool_resources.file_search.vector_stores) {\n if (options.body.tool_resources.file_search.vector_stores.length > 1) {\n throw new Error(\"Only one vector store is allowed\");\n }\n validateVectorStoreDataType(\n options.body.tool_resources.file_search.vector_stores[0]?.configuration.data_sources,\n );\n }\n }\n if (options.body.tool_resources.azure_ai_search) {\n if (\n options.body.tool_resources.azure_ai_search.indexes &&\n options.body.tool_resources.azure_ai_search.indexes.length > 1\n ) {\n throw new Error(\"Only one index is allowed\");\n }\n }\n }\n if (options.body.temperature && (options.body.temperature < 0 || options.body.temperature > 2)) {\n throw new Error(\"Temperature must be between 0 and 2\");\n }\n if (options.body.metadata) {\n validateMetadata(options.body.metadata);\n }\n}\n\nfunction validateListAgentsParameters(options?: GeneratedParameters.ListAgentsParameters): void {\n if (options?.queryParameters?.limit) {\n validateLimit(options.queryParameters.limit);\n }\n if (options?.queryParameters?.order) {\n validateOrder(options.queryParameters.order);\n }\n}\n\nfunction validateAssistantId(assistantId: string): void {\n if (!assistantId) {\n throw new Error(\"Assistant ID is required\");\n }\n}\n\nfunction validateUpdateAgentParameters(\n assistantId: string,\n options?: GeneratedParameters.UpdateAgentParameters,\n): void {\n validateAssistantId(assistantId);\n if (options) {\n validateCreateAgentParameters(options);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"assistants.js","sourceRoot":"","sources":["../../../src/agents/assistants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAM9E,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AASjF,OAAO,KAAK,eAAe,MAAM,iDAAiD,CAAC;AACnF,OAAO,KAAK,eAAe,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,CAAC;AAEjC,IAAK,KAUJ;AAVD,WAAK,KAAK;IACR,6CAAoC,CAAA;IACpC,mCAA0B,CAAA;IAC1B,8BAAqB,CAAA;IACrB,yCAAgC,CAAA;IAChC,6CAAoC,CAAA;IACpC,qDAA4C,CAAA;IAC5C,0CAAiC,CAAA;IACjC,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,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC;QAC/F,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC1B,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,SAAS,4BAA4B,CAAC,OAAkD;;IACtF,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,0CAAE,KAAK,EAAE,CAAC;QACpC,aAAa,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,0CAAE,KAAK,EAAE,CAAC;QACpC,aAAa,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,WAAmB;IAC9C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,SAAS,6BAA6B,CACpC,WAAmB,EACnB,OAAmD;IAEnD,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACjC,IAAI,OAAO,EAAE,CAAC;QACZ,6BAA6B,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client } from \"@azure-rest/core-client\";\nimport { operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type {\n AgentDeletionStatusOutput,\n AgentOutput,\n OpenAIPageableListOfAgentOutput,\n} from \"../customization/outputModels.js\";\nimport {\n validateLimit,\n validateMetadata,\n validateOrder,\n validateVectorStoreDataType,\n} from \"./inputValidations.js\";\nimport { TracingUtility } from \"../tracing.js\";\nimport { traceEndCreateOrUpdateAgent, traceStartCreateOrUpdateAgent } from \"./assistantsTrace.js\";\nimport { traceEndAgentGeneric, traceStartAgentGeneric } from \"./traceUtility.js\";\nimport type {\n CreateAgentOptionalParams,\n DeleteAgentOptionalParams,\n GetAgentOptionalParams,\n ListAgentsOptionalParams,\n UpdateAgentOptionalParams,\n} from \"./customModels.js\";\nimport type * as GeneratedParameters from \"../generated/src/parameters.js\";\nimport * as ConvertFromWire from \"../customization/convertOutputModelsFromWire.js\";\nimport * as ConverterToWire from \"../customization/convertModelsToWrite.js\";\nimport { convertToListQueryParameters } from \"../customization/convertParametersToWire.js\";\nimport { createOpenAIError } from \"./openAIError.js\";\n\nconst expectedStatuses = [\"200\"];\n\nenum Tools {\n CodeInterpreter = \"code_interpreter\",\n FileSearch = \"file_search\",\n Function = \"function\",\n BingGrounding = \"bing_grounding\",\n MicrosoftFabric = \"fabric_dataagent\",\n SharepointGrounding = \"sharepoint_grounding\",\n AzureAISearch = \"azure_ai_search\",\n OpenApi = \"openapi\",\n AzureFunction = \"azure_function\",\n}\n\n/** Creates a new agent. */\nexport async function createAgent(\n context: Client,\n model: string,\n options: CreateAgentOptionalParams = {},\n): Promise<AgentOutput> {\n const createOptions: GeneratedParameters.CreateAgentParameters = {\n ...operationOptionsToRequestParameters(options),\n body: {\n ...ConverterToWire.convertCreateAgentOptions({ ...options, model }),\n },\n };\n\n validateCreateAgentParameters(createOptions);\n const response = await TracingUtility.withSpan(\n \"CreateAgent\",\n createOptions,\n async (updatedOptions) => {\n const result = await context.path(\"/assistants\").post(updatedOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return result.body;\n },\n traceStartCreateOrUpdateAgent,\n traceEndCreateOrUpdateAgent,\n );\n return ConvertFromWire.convertAgentOutput(response);\n}\n\n/** Gets a list of agents that were previously created. */\nexport async function listAgents(\n context: Client,\n options: ListAgentsOptionalParams = {},\n): Promise<OpenAIPageableListOfAgentOutput> {\n const listAgentsOptions: GeneratedParameters.ListAgentsParameters = {\n ...operationOptionsToRequestParameters(options),\n queryParameters: convertToListQueryParameters(options),\n };\n\n validateListAgentsParameters(listAgentsOptions);\n const response = await TracingUtility.withSpan(\n \"ListAgents\",\n listAgentsOptions || {},\n async (updateOptions) => {\n const result = await context.path(\"/assistants\").get(updateOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return result.body;\n },\n );\n\n return ConvertFromWire.convertOpenAIPageableListOfAgentOutput(response);\n}\n\n/** Retrieves an existing agent. */\nexport async function getAgent(\n context: Client,\n assistantId: string,\n options: GetAgentOptionalParams = {},\n): Promise<AgentOutput> {\n const getAgentOptions: GeneratedParameters.GetAgentParameters = {\n ...operationOptionsToRequestParameters(options),\n };\n\n validateAssistantId(assistantId);\n const response = await TracingUtility.withSpan(\n \"GetAgent\",\n getAgentOptions,\n async (updateOptions) => {\n const result = await context\n .path(\"/assistants/{assistantId}\", assistantId)\n .get(updateOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return result.body;\n },\n (span, updatedOptions) =>\n traceStartAgentGeneric(span, {\n ...updatedOptions,\n tracingAttributeOptions: { agentId: assistantId },\n }),\n );\n\n return ConvertFromWire.convertAgentOutput(response);\n}\n\n/** Modifies an existing agent. */\nexport async function updateAgent(\n context: Client,\n assistantId: string,\n options: UpdateAgentOptionalParams = {},\n): Promise<AgentOutput> {\n const updateAgentOptions: GeneratedParameters.UpdateAgentParameters = {\n ...operationOptionsToRequestParameters(options),\n body: {\n ...ConverterToWire.convertUpdateAgentOptions(options),\n },\n };\n\n validateUpdateAgentParameters(assistantId, updateAgentOptions);\n const response = await TracingUtility.withSpan(\n \"UpdateAgent\",\n updateAgentOptions,\n async (updateOptions) => {\n const result = await context\n .path(\"/assistants/{assistantId}\", assistantId)\n .post(updateOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return result.body;\n },\n (span, updatedOptions) => traceStartCreateOrUpdateAgent(span, updatedOptions, assistantId),\n traceEndCreateOrUpdateAgent,\n );\n return ConvertFromWire.convertAgentOutput(response);\n}\n\n/** Deletes an agent. */\nexport async function deleteAgent(\n context: Client,\n assistantId: string,\n options: DeleteAgentOptionalParams = {},\n): Promise<AgentDeletionStatusOutput> {\n const deleteAgentOptions: GeneratedParameters.DeleteAgentParameters = {\n ...operationOptionsToRequestParameters(options),\n };\n\n validateAssistantId(assistantId);\n const response = await TracingUtility.withSpan(\n \"DeleteAgent\",\n deleteAgentOptions,\n async (updateOptions) => {\n const result = await context\n .path(\"/assistants/{assistantId}\", assistantId)\n .delete(updateOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return result.body;\n },\n traceStartAgentGeneric,\n traceEndAgentGeneric,\n );\n return ConvertFromWire.convertAgentDeletionStatusOutput(response);\n}\n\nfunction validateCreateAgentParameters(\n options: GeneratedParameters.CreateAgentParameters | GeneratedParameters.UpdateAgentParameters,\n): void {\n if (options.body.tools) {\n if (options.body.tools.some((value) => !Object.values(Tools).includes(value.type as Tools))) {\n throw new Error(\n \"Tool type must be one of 'code_interpreter', 'file_search', 'function', 'bing_grounding', 'fabric_dataagent', 'sharepoint_grounding', 'azure_ai_search', 'azure_function'\",\n );\n }\n }\n if (options.body.tool_resources) {\n if (options.body.tool_resources.code_interpreter) {\n if (\n options.body.tool_resources.code_interpreter.file_ids &&\n options.body.tool_resources.code_interpreter.data_sources\n ) {\n throw new Error(\"Only file_ids or data_sources can be provided, not both\");\n }\n if (\n options.body.tool_resources.code_interpreter.file_ids &&\n options.body.tool_resources.code_interpreter.file_ids.length > 20\n ) {\n throw new Error(\"A maximum of 20 file IDs are allowed\");\n }\n if (options.body.tool_resources.code_interpreter.data_sources) {\n validateVectorStoreDataType(options.body.tool_resources.code_interpreter.data_sources);\n }\n }\n if (options.body.tool_resources.file_search) {\n if (\n options.body.tool_resources.file_search.vector_store_ids &&\n options.body.tool_resources.file_search.vector_store_ids.length > 1\n ) {\n throw new Error(\"Only one vector store ID is allowed\");\n }\n if (options.body.tool_resources.file_search.vector_stores) {\n if (options.body.tool_resources.file_search.vector_stores.length > 1) {\n throw new Error(\"Only one vector store is allowed\");\n }\n validateVectorStoreDataType(\n options.body.tool_resources.file_search.vector_stores[0]?.configuration.data_sources,\n );\n }\n }\n if (options.body.tool_resources.azure_ai_search) {\n if (\n options.body.tool_resources.azure_ai_search.indexes &&\n options.body.tool_resources.azure_ai_search.indexes.length > 1\n ) {\n throw new Error(\"Only one index is allowed\");\n }\n }\n }\n if (options.body.temperature && (options.body.temperature < 0 || options.body.temperature > 2)) {\n throw new Error(\"Temperature must be between 0 and 2\");\n }\n if (options.body.metadata) {\n validateMetadata(options.body.metadata);\n }\n}\n\nfunction validateListAgentsParameters(options?: GeneratedParameters.ListAgentsParameters): void {\n if (options?.queryParameters?.limit) {\n validateLimit(options.queryParameters.limit);\n }\n if (options?.queryParameters?.order) {\n validateOrder(options.queryParameters.order);\n }\n}\n\nfunction validateAssistantId(assistantId: string): void {\n if (!assistantId) {\n throw new Error(\"Assistant ID is required\");\n }\n}\n\nfunction validateUpdateAgentParameters(\n assistantId: string,\n options?: GeneratedParameters.UpdateAgentParameters,\n): void {\n validateAssistantId(assistantId);\n if (options) {\n validateCreateAgentParameters(options);\n }\n}\n"]}
|
|
@@ -31,14 +31,14 @@ var Tools;
|
|
|
31
31
|
Tools["FileSearch"] = "file_search";
|
|
32
32
|
Tools["Function"] = "function";
|
|
33
33
|
Tools["BingGrounding"] = "bing_grounding";
|
|
34
|
-
Tools["MicrosoftFabric"] = "
|
|
34
|
+
Tools["MicrosoftFabric"] = "fabric_dataagent";
|
|
35
35
|
Tools["SharepointGrounding"] = "sharepoint_grounding";
|
|
36
36
|
Tools["AzureAISearch"] = "azure_ai_search";
|
|
37
37
|
Tools["AzureFunction"] = "azure_function";
|
|
38
38
|
})(Tools || (Tools = {}));
|
|
39
39
|
export function validateTools(value) {
|
|
40
40
|
if (value.some((tool) => !Object.values(Tools).includes(tool))) {
|
|
41
|
-
throw new Error("Tool type must be one of 'code_interpreter', 'file_search', 'function', 'bing_grounding', '
|
|
41
|
+
throw new Error("Tool type must be one of 'code_interpreter', 'file_search', 'function', 'bing_grounding', 'fabric_dataagent', 'sharepoint_grounding', 'azure_ai_search', 'azure_function'");
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
export function validateMetadata(metadata) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputValidations.js","sourceRoot":"","sources":["../../../src/agents/inputValidations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,MAAM,UAAU,2BAA2B,CAAC,YAAqC;IAC/E,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACnF,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,iCAAiC,C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0CAAuB,CAAA;IACvB,oCAAiB,CAAA;IACjB,0CAAuB,CAAA;AACzB,CAAC,EALI,eAAe,KAAf,eAAe,QAKnB;AAED,MAAM,UAAU,wBAAwB,CAAC,MAAc;IACrD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,MAAyB,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CACb,qFAAqF,CACtF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,IAAK,QAGJ;AAHD,WAAK,QAAQ;IACX,yBAAa,CAAA;IACb,oCAAwB,CAAA;AAC1B,CAAC,EAHI,QAAQ,KAAR,QAAQ,QAGZ;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAiB,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAED,IAAK,kBAGJ;AAHD,WAAK,kBAAkB;IACrB,mCAAa,CAAA;IACb,oDAA8B,CAAA;AAChC,CAAC,EAHI,kBAAkB,KAAlB,kBAAkB,QAGtB;AAED,MAAM,UAAU,0BAA0B,CAAC,KAAa;IACtD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,KAA2B,CAAC,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n ToolDefinition,\n UpdateToolResourcesOptions,\n VectorStoreDataSource,\n} from \"../generated/src/models.js\";\n\nexport function validateVectorStoreDataType(data_sources: VectorStoreDataSource[]): void {\n if (!data_sources.some((value) => ![\"uri_asset\", \"id_asset\"].includes(value.type))) {\n throw new Error(\"Vector store data type must be one of 'uri_asset', 'id_asset'\");\n }\n}\n\nexport function validateThreadId(threadId: string): void {\n if (!threadId) {\n throw new Error(\"Thread ID is required\");\n }\n}\n\nexport function validateRunId(runId: string): void {\n if (!runId) {\n throw new Error(\"Run ID is required\");\n }\n}\n\nexport function validateLimit(limit: number): void {\n if (limit < 1 || limit > 100) {\n throw new Error(\"Limit must be between 1 and 100\");\n }\n}\n\nexport function validateOrder(order: string): void {\n if (![\"asc\", \"desc\"].includes(order)) {\n throw new Error(\"Order must be 'asc' or 'desc'\");\n }\n}\n\nenum Tools {\n CodeInterpreter = \"code_interpreter\",\n FileSearch = \"file_search\",\n Function = \"function\",\n BingGrounding = \"bing_grounding\",\n MicrosoftFabric = \"
|
|
1
|
+
{"version":3,"file":"inputValidations.js","sourceRoot":"","sources":["../../../src/agents/inputValidations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,MAAM,UAAU,2BAA2B,CAAC,YAAqC;IAC/E,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACnF,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC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D,WAAK,eAAe;IAClB,6CAA0B,CAAA;IAC1B,0CAAuB,CAAA;IACvB,oCAAiB,CAAA;IACjB,0CAAuB,CAAA;AACzB,CAAC,EALI,eAAe,KAAf,eAAe,QAKnB;AAED,MAAM,UAAU,wBAAwB,CAAC,MAAc;IACrD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,MAAyB,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CACb,qFAAqF,CACtF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,IAAK,QAGJ;AAHD,WAAK,QAAQ;IACX,yBAAa,CAAA;IACb,oCAAwB,CAAA;AAC1B,CAAC,EAHI,QAAQ,KAAR,QAAQ,QAGZ;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAiB,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAED,IAAK,kBAGJ;AAHD,WAAK,kBAAkB;IACrB,mCAAa,CAAA;IACb,oDAA8B,CAAA;AAChC,CAAC,EAHI,kBAAkB,KAAlB,kBAAkB,QAGtB;AAED,MAAM,UAAU,0BAA0B,CAAC,KAAa;IACtD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,KAA2B,CAAC,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n ToolDefinition,\n UpdateToolResourcesOptions,\n VectorStoreDataSource,\n} from \"../generated/src/models.js\";\n\nexport function validateVectorStoreDataType(data_sources: VectorStoreDataSource[]): void {\n if (!data_sources.some((value) => ![\"uri_asset\", \"id_asset\"].includes(value.type))) {\n throw new Error(\"Vector store data type must be one of 'uri_asset', 'id_asset'\");\n }\n}\n\nexport function validateThreadId(threadId: string): void {\n if (!threadId) {\n throw new Error(\"Thread ID is required\");\n }\n}\n\nexport function validateRunId(runId: string): void {\n if (!runId) {\n throw new Error(\"Run ID is required\");\n }\n}\n\nexport function validateLimit(limit: number): void {\n if (limit < 1 || limit > 100) {\n throw new Error(\"Limit must be between 1 and 100\");\n }\n}\n\nexport function validateOrder(order: string): void {\n if (![\"asc\", \"desc\"].includes(order)) {\n throw new Error(\"Order must be 'asc' or 'desc'\");\n }\n}\n\nenum Tools {\n CodeInterpreter = \"code_interpreter\",\n FileSearch = \"file_search\",\n Function = \"function\",\n BingGrounding = \"bing_grounding\",\n MicrosoftFabric = \"fabric_dataagent\",\n SharepointGrounding = \"sharepoint_grounding\",\n AzureAISearch = \"azure_ai_search\",\n AzureFunction = \"azure_function\",\n}\n\nexport function validateTools(value: Array<ToolDefinition>): void {\n if (value.some((tool) => !Object.values(Tools).includes(tool as unknown as Tools))) {\n throw new Error(\n \"Tool type must be one of 'code_interpreter', 'file_search', 'function', 'bing_grounding', 'fabric_dataagent', 'sharepoint_grounding', 'azure_ai_search', 'azure_function'\",\n );\n }\n}\n\nexport function validateMetadata(metadata: Record<string, string>): void {\n if (Object.keys(metadata).length > 16) {\n throw new Error(\"Only 16 key/value pairs are allowed\");\n }\n if (Object.keys(metadata).some((value) => value.length > 64)) {\n throw new Error(\"Keys must be less than 64 characters\");\n }\n if (Object.values(metadata).some((value) => value.length > 512)) {\n throw new Error(\"Values must be less than 512 characters\");\n }\n}\n\nexport function validateToolResources(toolResource: UpdateToolResourcesOptions): void {\n if (toolResource.code_interpreter) {\n if (\n toolResource.code_interpreter.file_ids &&\n toolResource.code_interpreter.file_ids.length > 20\n ) {\n throw new Error(\"A maximum of 20 file IDs are allowed\");\n }\n }\n if (toolResource.file_search) {\n if (\n toolResource.file_search.vector_store_ids &&\n toolResource.file_search.vector_store_ids.length > 1\n ) {\n throw new Error(\"Only one vector store ID is allowed\");\n }\n }\n if (toolResource.azure_ai_search) {\n if (toolResource.azure_ai_search.indexes && toolResource.azure_ai_search.indexes.length > 1) {\n throw new Error(\"Only one index is allowed\");\n }\n }\n}\n\nexport function validateVectorStoreId(vectorStoreId: string): void {\n if (!vectorStoreId) {\n throw new Error(\"Vector store ID is required\");\n }\n}\n\nexport function validateFileId(fileId: string): void {\n if (!fileId) {\n throw new Error(\"File ID is required\");\n }\n}\n\nenum FileBatchStatus {\n InProgress = \"in_progress\",\n Completed = \"completed\",\n Failed = \"failed\",\n Cancelled = \"cancelled\",\n}\n\nexport function validateFileStatusFilter(filter: string): void {\n if (!Object.values(FileBatchStatus).includes(filter as FileBatchStatus)) {\n throw new Error(\n \"File status filter must be one of 'in_progress', 'completed', 'failed', 'cancelled'\",\n );\n }\n}\n\nenum Messages {\n User = \"user\",\n Assistants = \"assistant\",\n}\n\nexport function validateMessages(value: string): void {\n if (!Object.values(Messages).includes(value as Messages)) {\n throw new Error(\"Role must be either 'user' or 'assistant'\");\n }\n}\n\nenum TruncationStrategy {\n Auto = \"auto\",\n LastMessages = \"last_messages\",\n}\n\nexport function validateTruncationStrategy(value: string): void {\n if (!Object.values(TruncationStrategy).includes(value as TruncationStrategy)) {\n throw new Error(\"Role must be either 'auto' or 'last_messages'\");\n }\n}\n"]}
|
|
@@ -15,7 +15,7 @@ export declare enum connectionToolType {
|
|
|
15
15
|
/** Bing grounding search tool */
|
|
16
16
|
BingGrounding = "bing_grounding",
|
|
17
17
|
/** Microsoft Fabric tool */
|
|
18
|
-
MicrosoftFabric = "
|
|
18
|
+
MicrosoftFabric = "fabric_dataagent",
|
|
19
19
|
/** Sharepoint tool */
|
|
20
20
|
SharepointGrounding = "sharepoint_grounding",
|
|
21
21
|
/** Azure Function tool */
|
|
@@ -85,6 +85,15 @@ export declare class ToolUtility {
|
|
|
85
85
|
definition: AzureAISearchToolDefinition;
|
|
86
86
|
resources: ToolResources;
|
|
87
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* Creates a Microsoft Fabric tool
|
|
90
|
+
*
|
|
91
|
+
* @param connectionIds - A list of the IDs of the Fabric connections to use.
|
|
92
|
+
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
93
|
+
*/
|
|
94
|
+
static createFabricTool(connectionId: string): {
|
|
95
|
+
definition: ToolDefinition;
|
|
96
|
+
};
|
|
88
97
|
/**
|
|
89
98
|
* Creates a function tool
|
|
90
99
|
*
|
|
@@ -187,5 +196,14 @@ export declare class ToolSet {
|
|
|
187
196
|
definition: AzureFunctionToolDefinition;
|
|
188
197
|
resources: ToolResources;
|
|
189
198
|
};
|
|
199
|
+
/**
|
|
200
|
+
* Adds a Microsoft Fabric tool to the tool set.
|
|
201
|
+
*
|
|
202
|
+
* @param connectionId - The ID of the Fabric connection to use.
|
|
203
|
+
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
204
|
+
*/
|
|
205
|
+
addFabricTool(connectionId: string): {
|
|
206
|
+
definition: ToolDefinition;
|
|
207
|
+
};
|
|
190
208
|
}
|
|
191
209
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/agents/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,2BAA2B,EAC3B,2BAA2B,EAC3B,6BAA6B,EAC7B,wBAAwB,EACxB,+BAA+B,EAC/B,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,0BAA0B,EAC1B,aAAa,EACb,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EACvD,MAAM,EAAE,oBAAoB,G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,2BAA2B,CAAC;QAAC,SAAS,EAAE,aAAa,CAAA;KAAE;IAaxE;;;;;OAKG;IACH,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG;QAAE,UAAU,EAAE,cAAc,CAAA;KAAE;CAKpE"}
|
|
@@ -17,7 +17,7 @@ export var connectionToolType;
|
|
|
17
17
|
/** Bing grounding search tool */
|
|
18
18
|
connectionToolType["BingGrounding"] = "bing_grounding";
|
|
19
19
|
/** Microsoft Fabric tool */
|
|
20
|
-
connectionToolType["MicrosoftFabric"] = "
|
|
20
|
+
connectionToolType["MicrosoftFabric"] = "fabric_dataagent";
|
|
21
21
|
/** Sharepoint tool */
|
|
22
22
|
connectionToolType["SharepointGrounding"] = "sharepoint_grounding";
|
|
23
23
|
/** Azure Function tool */
|
|
@@ -25,7 +25,7 @@ export var connectionToolType;
|
|
|
25
25
|
})(connectionToolType || (connectionToolType = {}));
|
|
26
26
|
const toolMap = {
|
|
27
27
|
bing_grounding: "bingGrounding",
|
|
28
|
-
|
|
28
|
+
fabric_dataagent: "fabric_dataagent",
|
|
29
29
|
sharepoint_grounding: "sharepointGrounding",
|
|
30
30
|
azure_function: "azureFunction",
|
|
31
31
|
};
|
|
@@ -123,6 +123,22 @@ export class ToolUtility {
|
|
|
123
123
|
},
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Creates a Microsoft Fabric tool
|
|
128
|
+
*
|
|
129
|
+
* @param connectionIds - A list of the IDs of the Fabric connections to use.
|
|
130
|
+
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
131
|
+
*/
|
|
132
|
+
static createFabricTool(connectionId) {
|
|
133
|
+
return {
|
|
134
|
+
definition: {
|
|
135
|
+
type: "fabric_dataagent",
|
|
136
|
+
fabricDataAgent: {
|
|
137
|
+
connections: [{ connectionId: connectionId }],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
126
142
|
/**
|
|
127
143
|
* Creates a function tool
|
|
128
144
|
*
|
|
@@ -249,5 +265,16 @@ export class ToolSet {
|
|
|
249
265
|
this.toolResources = Object.assign(Object.assign({}, this.toolResources), tool.resources);
|
|
250
266
|
return tool;
|
|
251
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Adds a Microsoft Fabric tool to the tool set.
|
|
270
|
+
*
|
|
271
|
+
* @param connectionId - The ID of the Fabric connection to use.
|
|
272
|
+
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
273
|
+
*/
|
|
274
|
+
addFabricTool(connectionId) {
|
|
275
|
+
const tool = ToolUtility.createFabricTool(connectionId);
|
|
276
|
+
this.toolDefinitions.push(tool.definition);
|
|
277
|
+
return tool;
|
|
278
|
+
}
|
|
252
279
|
}
|
|
253
280
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/agents/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAuBlC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAkF,EAClF,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,MAAM,CAAN,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,iCAAiC;IACjC,sDAAgC,CAAA;IAChC,4BAA4B;IAC5B,0DAAoC,CAAA;IACpC,sBAAsB;IACtB,kEAA4C,CAAA;IAC5C,0BAA0B;IAC1B,sDAAgC,CAAA;AAClC,CAAC,EATW,kBAAkB,KAAlB,kBAAkB,QAS7B;AAED,MAAM,OAAO,GAAG;IACd,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,iBAAiB;IACnC,oBAAoB,EAAE,qBAAqB;IAC3C,cAAc,EAAE,eAAe;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,WAAW;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACz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EACZ,WAAmB,EACnB,UAAmB,EACnB,UAAqC,EACrC,WAAsC,EACtC,iBAA0C;QAE1C,MAAM,IAAI,GAAG,WAAW,CAAC,uBAAuB,CAC9C,IAAI,EACJ,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,CAClB,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,CAAC,aAAa,mCAAQ,IAAI,CAAC,aAAa,GAAK,IAAI,CAAC,SAAS,CAAE,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AzureAISearchToolDefinition,\n AzureFunctionToolDefinition,\n CodeInterpreterToolDefinition,\n FileSearchToolDefinition,\n FileSearchToolDefinitionDetails,\n FunctionDefinition,\n FunctionToolDefinition,\n OpenApiFunctionDefinition,\n OpenApiToolDefinition,\n RequiredActionOutput,\n RequiredToolCallOutput,\n ToolDefinition,\n ToolDefinitionOutputParent,\n ToolResources,\n VectorStoreConfigurations,\n VectorStoreDataSource,\n AzureFunctionStorageQueue,\n AzureFunctionDefinition,\n} from \"./inputOutputs.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 `RequiredActionOutput`, `RequiredToolCallOutput`, or `ToolDefinitionOutputParent`.\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: RequiredActionOutput | RequiredToolCallOutput | ToolDefinitionOutputParent,\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 = \"microsoft_fabric\",\n /** Sharepoint tool */\n SharepointGrounding = \"sharepoint_grounding\",\n /** Azure Function tool */\n AzureFunction = \"azure_function\",\n}\n\nconst toolMap = {\n bing_grounding: \"bingGrounding\",\n microsoft_fabric: \"microsoftFabric\",\n sharepoint_grounding: \"sharepointGrounding\",\n azure_function: \"azureFunction\",\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: ToolDefinition } {\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 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 Function tool\n * @param name - The name of the Azure Function.\n * @param description - The description of the Azure Function.\n * @param parameters - The parameters of the Azure Function.\n * @param inputQueue - The input queue configuration.\n * @param outputQueue - The output queue configuration.\n * @returns An object containing the definition and resources for the Azure Function tool.\n */\n static createAzureFunctionTool(\n name: string,\n description: string,\n parameters: unknown,\n inputQueue: AzureFunctionStorageQueue,\n outputQueue: AzureFunctionStorageQueue,\n definitionDetails: AzureFunctionDefinition,\n ): { definition: AzureFunctionToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_function\", azureFunction: definitionDetails },\n resources: {\n azureFunction: {\n name: name,\n description: description,\n parameters: parameters,\n inputQueue: inputQueue,\n outputQueue: outputQueue,\n },\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 ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexes: [{ indexConnectionId: indexConnectionId, indexName: indexName }],\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: openApiFunctionDefinition,\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 an Azure Function tool to the tool set.\n *\n * @param name - The name of the Azure Function.\n * @param description - The description of the Azure Function.\n * @param parameters - The parameters of the Azure Function.\n * @param inputQueue - The input queue configuration.\n * @param outputQueue - The output queue configuration.\n *\n * @returns An object containing the definition and resources for the Azure Function tool.\n */\n addAzureFunctionTool(\n name: string,\n description: string,\n parameters: unknown,\n inputQueue: AzureFunctionStorageQueue,\n outputQueue: AzureFunctionStorageQueue,\n definitionDetails: AzureFunctionDefinition,\n ): { definition: AzureFunctionToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createAzureFunctionTool(\n name,\n description,\n parameters,\n inputQueue,\n outputQueue,\n definitionDetails,\n );\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/agents/utils.ts"],"names":[],"mappings":"AAA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,IAAI,CAAC;IACd,CAAC;IACD;;;;;OAKG;IACH,aAAa,CAAC,YAAoB;QAChC,MAAM,IAAI,GAAG,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACxD,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 AzureFunctionToolDefinition,\n CodeInterpreterToolDefinition,\n FileSearchToolDefinition,\n FileSearchToolDefinitionDetails,\n FunctionDefinition,\n FunctionToolDefinition,\n OpenApiFunctionDefinition,\n OpenApiToolDefinition,\n RequiredActionOutput,\n RequiredToolCallOutput,\n ToolDefinition,\n ToolDefinitionOutputParent,\n ToolResources,\n VectorStoreConfigurations,\n VectorStoreDataSource,\n AzureFunctionStorageQueue,\n AzureFunctionDefinition,\n} from \"./inputOutputs.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 `RequiredActionOutput`, `RequiredToolCallOutput`, or `ToolDefinitionOutputParent`.\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: RequiredActionOutput | RequiredToolCallOutput | ToolDefinitionOutputParent,\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}\n\nconst toolMap = {\n bing_grounding: \"bingGrounding\",\n fabric_dataagent: \"fabric_dataagent\",\n sharepoint_grounding: \"sharepointGrounding\",\n azure_function: \"azureFunction\",\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: ToolDefinition } {\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 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 Function tool\n * @param name - The name of the Azure Function.\n * @param description - The description of the Azure Function.\n * @param parameters - The parameters of the Azure Function.\n * @param inputQueue - The input queue configuration.\n * @param outputQueue - The output queue configuration.\n * @returns An object containing the definition and resources for the Azure Function tool.\n */\n static createAzureFunctionTool(\n name: string,\n description: string,\n parameters: unknown,\n inputQueue: AzureFunctionStorageQueue,\n outputQueue: AzureFunctionStorageQueue,\n definitionDetails: AzureFunctionDefinition,\n ): { definition: AzureFunctionToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_function\", azureFunction: definitionDetails },\n resources: {\n azureFunction: {\n name: name,\n description: description,\n parameters: parameters,\n inputQueue: inputQueue,\n outputQueue: outputQueue,\n },\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 ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexes: [{ indexConnectionId: indexConnectionId, indexName: indexName }],\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: ToolDefinition } {\n return {\n definition: {\n type: \"fabric_dataagent\",\n fabricDataAgent: {\n connections: [{ 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: openApiFunctionDefinition,\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 an Azure Function tool to the tool set.\n *\n * @param name - The name of the Azure Function.\n * @param description - The description of the Azure Function.\n * @param parameters - The parameters of the Azure Function.\n * @param inputQueue - The input queue configuration.\n * @param outputQueue - The output queue configuration.\n *\n * @returns An object containing the definition and resources for the Azure Function tool.\n */\n addAzureFunctionTool(\n name: string,\n description: string,\n parameters: unknown,\n inputQueue: AzureFunctionStorageQueue,\n outputQueue: AzureFunctionStorageQueue,\n definitionDetails: AzureFunctionDefinition,\n ): { definition: AzureFunctionToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createAzureFunctionTool(\n name,\n description,\n parameters,\n inputQueue,\n outputQueue,\n definitionDetails,\n );\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\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: ToolDefinition } {\n const tool = ToolUtility.createFabricTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Current version of the `@azure/ai-projects` package.\n */\nexport const SDK_VERSION = `1.0.0-beta.
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Current version of the `@azure/ai-projects` package.\n */\nexport const SDK_VERSION = `1.0.0-beta.4`;\n\n/**\n * The package name of the `@azure/ai-projects` package.\n */\nexport const PACKAGE_NAME = \"@azure/ai-projects\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertModelsToWrite.d.ts","sourceRoot":"","sources":["../../../src/customization/convertModelsToWrite.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,YAAY,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,KAAK,eAAe,MAAM,4BAA4B,CAAC;AAGnE,wBAAgB,yBAAyB,CACvC,MAAM,EAA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CACvD,MAAM,EAAE,YAAY,CAAC,kCAAkC,GACtD,eAAe,CAAC,kCAAkC,CAWpD;AAoBD,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,YAAY,CAAC,wBAAwB,GAC5C,eAAe,CAAC,wBAAwB,CAQ1C"}
|
|
@@ -33,7 +33,7 @@ function convertToolDefinition(source) {
|
|
|
33
33
|
return convertFunctionToolDefinition(source);
|
|
34
34
|
case "bing_grounding":
|
|
35
35
|
return convertBingGroundingToolDefinition(source);
|
|
36
|
-
case "
|
|
36
|
+
case "fabric_dataagent":
|
|
37
37
|
return convertMicrosoftFabricToolDefinition(source);
|
|
38
38
|
case "sharepoint_grounding":
|
|
39
39
|
return convertSharepointToolDefinition(source);
|
|
@@ -72,7 +72,7 @@ function convertBingGroundingToolDefinition(source) {
|
|
|
72
72
|
function convertMicrosoftFabricToolDefinition(source) {
|
|
73
73
|
return {
|
|
74
74
|
type: source.type,
|
|
75
|
-
|
|
75
|
+
fabric_dataagent: convertToolConnectionList(source.fabricDataAgent),
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
function convertSharepointToolDefinition(source) {
|