@azure/ai-projects 1.0.0-beta.2 → 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/LICENSE +4 -4
- package/README.md +270 -186
- package/dist/browser/agents/assistants.d.ts.map +1 -1
- package/dist/browser/agents/assistants.js +4 -2
- package/dist/browser/agents/assistants.js.map +1 -1
- package/dist/browser/agents/customModels.d.ts +4 -29
- package/dist/browser/agents/customModels.d.ts.map +1 -1
- package/dist/browser/agents/customModels.js.map +1 -1
- package/dist/browser/agents/files.d.ts +5 -4
- package/dist/browser/agents/files.d.ts.map +1 -1
- package/dist/browser/agents/files.js +55 -27
- package/dist/browser/agents/files.js.map +1 -1
- package/dist/browser/agents/index.d.ts +10 -10
- package/dist/browser/agents/index.d.ts.map +1 -1
- package/dist/browser/agents/index.js.map +1 -1
- package/dist/browser/agents/inputOutputs.d.ts +3 -3
- package/dist/browser/agents/inputOutputs.d.ts.map +1 -1
- package/dist/browser/agents/inputOutputs.js.map +1 -1
- package/dist/browser/agents/inputValidations.d.ts.map +1 -1
- package/dist/browser/agents/inputValidations.js +3 -2
- package/dist/browser/agents/inputValidations.js.map +1 -1
- package/dist/browser/agents/messages.js +2 -2
- package/dist/browser/agents/messages.js.map +1 -1
- package/dist/browser/agents/poller.d.ts +8 -33
- package/dist/browser/agents/poller.d.ts.map +1 -1
- package/dist/browser/agents/poller.js +130 -53
- package/dist/browser/agents/poller.js.map +1 -1
- package/dist/browser/agents/streamingModels.d.ts +17 -15
- package/dist/browser/agents/streamingModels.d.ts.map +1 -1
- package/dist/browser/agents/streamingModels.js.map +1 -1
- package/dist/browser/agents/traceUtility.d.ts +3 -3
- package/dist/browser/agents/traceUtility.d.ts.map +1 -1
- package/dist/browser/agents/traceUtility.js.map +1 -1
- package/dist/browser/agents/utils.d.ts +72 -4
- package/dist/browser/agents/utils.d.ts.map +1 -1
- package/dist/browser/agents/utils.js +100 -3
- package/dist/browser/agents/utils.js.map +1 -1
- package/dist/browser/agents/vectorStores.d.ts +3 -4
- package/dist/browser/agents/vectorStores.d.ts.map +1 -1
- package/dist/browser/agents/vectorStores.js +44 -26
- package/dist/browser/agents/vectorStores.js.map +1 -1
- package/dist/browser/agents/vectorStoresFileBatches.d.ts +5 -4
- package/dist/browser/agents/vectorStoresFileBatches.d.ts.map +1 -1
- package/dist/browser/agents/vectorStoresFileBatches.js +46 -32
- package/dist/browser/agents/vectorStoresFileBatches.js.map +1 -1
- package/dist/browser/agents/vectorStoresFiles.d.ts +4 -4
- package/dist/browser/agents/vectorStoresFiles.d.ts.map +1 -1
- package/dist/browser/agents/vectorStoresFiles.js +57 -28
- package/dist/browser/agents/vectorStoresFiles.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 +43 -94
- 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 +53 -11
- package/dist/browser/customization/convertOutputModelsFromWire.js.map +1 -1
- package/dist/browser/customization/convertParametersToWire.d.ts +1 -1
- package/dist/browser/customization/convertParametersToWire.d.ts.map +1 -1
- package/dist/browser/customization/convertParametersToWire.js.map +1 -1
- package/dist/browser/customization/models.d.ts +146 -151
- 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 +188 -37
- package/dist/browser/customization/outputModels.d.ts.map +1 -1
- package/dist/browser/customization/outputModels.js.map +1 -1
- package/dist/browser/customization/streamingModels.d.ts +2 -1
- package/dist/browser/customization/streamingModels.d.ts.map +1 -1
- package/dist/browser/customization/streamingModels.js.map +1 -1
- package/dist/browser/customization/streamingWireModels.d.ts +2 -1
- package/dist/browser/customization/streamingWireModels.d.ts.map +1 -1
- package/dist/browser/customization/streamingWireModels.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 +191 -157
- 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 +277 -47
- 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 +28 -3
- package/dist/browser/generated/src/paginateHelper.d.ts.map +1 -1
- package/dist/browser/generated/src/paginateHelper.js +99 -2
- 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 +5 -5
- package/dist/browser/generated/src/projectsClient.d.ts.map +1 -1
- package/dist/browser/generated/src/projectsClient.js +3 -3
- 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.d.ts.map +1 -1
- package/dist/commonjs/agents/assistants.js +4 -2
- package/dist/commonjs/agents/assistants.js.map +1 -1
- package/dist/commonjs/agents/customModels.d.ts +4 -29
- package/dist/commonjs/agents/customModels.d.ts.map +1 -1
- package/dist/commonjs/agents/customModels.js.map +1 -1
- package/dist/commonjs/agents/files.d.ts +5 -4
- package/dist/commonjs/agents/files.d.ts.map +1 -1
- package/dist/commonjs/agents/files.js +55 -26
- package/dist/commonjs/agents/files.js.map +1 -1
- package/dist/commonjs/agents/index.d.ts +10 -10
- package/dist/commonjs/agents/index.d.ts.map +1 -1
- package/dist/commonjs/agents/index.js.map +1 -1
- package/dist/commonjs/agents/inputOutputs.d.ts +3 -3
- package/dist/commonjs/agents/inputOutputs.d.ts.map +1 -1
- package/dist/commonjs/agents/inputOutputs.js.map +1 -1
- package/dist/commonjs/agents/inputValidations.d.ts.map +1 -1
- package/dist/commonjs/agents/inputValidations.js +3 -2
- package/dist/commonjs/agents/inputValidations.js.map +1 -1
- package/dist/commonjs/agents/messages.js +2 -2
- package/dist/commonjs/agents/messages.js.map +1 -1
- package/dist/commonjs/agents/poller.d.ts +8 -33
- package/dist/commonjs/agents/poller.d.ts.map +1 -1
- package/dist/commonjs/agents/poller.js +131 -55
- package/dist/commonjs/agents/poller.js.map +1 -1
- package/dist/commonjs/agents/streamingModels.d.ts +17 -15
- package/dist/commonjs/agents/streamingModels.d.ts.map +1 -1
- package/dist/commonjs/agents/streamingModels.js.map +1 -1
- package/dist/commonjs/agents/traceUtility.d.ts +3 -3
- package/dist/commonjs/agents/traceUtility.d.ts.map +1 -1
- package/dist/commonjs/agents/traceUtility.js.map +1 -1
- package/dist/commonjs/agents/utils.d.ts +72 -4
- package/dist/commonjs/agents/utils.d.ts.map +1 -1
- package/dist/commonjs/agents/utils.js +100 -3
- package/dist/commonjs/agents/utils.js.map +1 -1
- package/dist/commonjs/agents/vectorStores.d.ts +3 -4
- package/dist/commonjs/agents/vectorStores.d.ts.map +1 -1
- package/dist/commonjs/agents/vectorStores.js +43 -25
- package/dist/commonjs/agents/vectorStores.js.map +1 -1
- package/dist/commonjs/agents/vectorStoresFileBatches.d.ts +5 -4
- package/dist/commonjs/agents/vectorStoresFileBatches.d.ts.map +1 -1
- package/dist/commonjs/agents/vectorStoresFileBatches.js +46 -31
- package/dist/commonjs/agents/vectorStoresFileBatches.js.map +1 -1
- package/dist/commonjs/agents/vectorStoresFiles.d.ts +4 -4
- package/dist/commonjs/agents/vectorStoresFiles.d.ts.map +1 -1
- package/dist/commonjs/agents/vectorStoresFiles.js +56 -27
- package/dist/commonjs/agents/vectorStoresFiles.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 +43 -94
- 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 +53 -11
- package/dist/commonjs/customization/convertOutputModelsFromWire.js.map +1 -1
- package/dist/commonjs/customization/convertParametersToWire.d.ts +1 -1
- package/dist/commonjs/customization/convertParametersToWire.d.ts.map +1 -1
- package/dist/commonjs/customization/convertParametersToWire.js.map +1 -1
- package/dist/commonjs/customization/models.d.ts +146 -151
- 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 +188 -37
- package/dist/commonjs/customization/outputModels.d.ts.map +1 -1
- package/dist/commonjs/customization/outputModels.js.map +1 -1
- package/dist/commonjs/customization/streamingModels.d.ts +2 -1
- package/dist/commonjs/customization/streamingModels.d.ts.map +1 -1
- package/dist/commonjs/customization/streamingModels.js.map +1 -1
- package/dist/commonjs/customization/streamingWireModels.d.ts +2 -1
- package/dist/commonjs/customization/streamingWireModels.d.ts.map +1 -1
- package/dist/commonjs/customization/streamingWireModels.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 +191 -157
- 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 +277 -47
- 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 +28 -3
- package/dist/commonjs/generated/src/paginateHelper.d.ts.map +1 -1
- package/dist/commonjs/generated/src/paginateHelper.js +99 -2
- 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 +5 -5
- package/dist/commonjs/generated/src/projectsClient.d.ts.map +1 -1
- package/dist/commonjs/generated/src/projectsClient.js +3 -3
- 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.d.ts.map +1 -1
- package/dist/esm/agents/assistants.js +4 -2
- package/dist/esm/agents/assistants.js.map +1 -1
- package/dist/esm/agents/customModels.d.ts +4 -29
- package/dist/esm/agents/customModels.d.ts.map +1 -1
- package/dist/esm/agents/customModels.js.map +1 -1
- package/dist/esm/agents/files.d.ts +5 -4
- package/dist/esm/agents/files.d.ts.map +1 -1
- package/dist/esm/agents/files.js +55 -27
- package/dist/esm/agents/files.js.map +1 -1
- package/dist/esm/agents/index.d.ts +10 -10
- package/dist/esm/agents/index.d.ts.map +1 -1
- package/dist/esm/agents/index.js.map +1 -1
- package/dist/esm/agents/inputOutputs.d.ts +3 -3
- package/dist/esm/agents/inputOutputs.d.ts.map +1 -1
- package/dist/esm/agents/inputOutputs.js.map +1 -1
- package/dist/esm/agents/inputValidations.d.ts.map +1 -1
- package/dist/esm/agents/inputValidations.js +3 -2
- package/dist/esm/agents/inputValidations.js.map +1 -1
- package/dist/esm/agents/messages.js +2 -2
- package/dist/esm/agents/messages.js.map +1 -1
- package/dist/esm/agents/poller.d.ts +8 -33
- package/dist/esm/agents/poller.d.ts.map +1 -1
- package/dist/esm/agents/poller.js +130 -53
- package/dist/esm/agents/poller.js.map +1 -1
- package/dist/esm/agents/streamingModels.d.ts +17 -15
- package/dist/esm/agents/streamingModels.d.ts.map +1 -1
- package/dist/esm/agents/streamingModels.js.map +1 -1
- package/dist/esm/agents/traceUtility.d.ts +3 -3
- package/dist/esm/agents/traceUtility.d.ts.map +1 -1
- package/dist/esm/agents/traceUtility.js.map +1 -1
- package/dist/esm/agents/utils.d.ts +72 -4
- package/dist/esm/agents/utils.d.ts.map +1 -1
- package/dist/esm/agents/utils.js +100 -3
- package/dist/esm/agents/utils.js.map +1 -1
- package/dist/esm/agents/vectorStores.d.ts +3 -4
- package/dist/esm/agents/vectorStores.d.ts.map +1 -1
- package/dist/esm/agents/vectorStores.js +44 -26
- package/dist/esm/agents/vectorStores.js.map +1 -1
- package/dist/esm/agents/vectorStoresFileBatches.d.ts +5 -4
- package/dist/esm/agents/vectorStoresFileBatches.d.ts.map +1 -1
- package/dist/esm/agents/vectorStoresFileBatches.js +46 -32
- package/dist/esm/agents/vectorStoresFileBatches.js.map +1 -1
- package/dist/esm/agents/vectorStoresFiles.d.ts +4 -4
- package/dist/esm/agents/vectorStoresFiles.d.ts.map +1 -1
- package/dist/esm/agents/vectorStoresFiles.js +57 -28
- package/dist/esm/agents/vectorStoresFiles.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 +43 -94
- 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 +53 -11
- package/dist/esm/customization/convertOutputModelsFromWire.js.map +1 -1
- package/dist/esm/customization/convertParametersToWire.d.ts +1 -1
- package/dist/esm/customization/convertParametersToWire.d.ts.map +1 -1
- package/dist/esm/customization/convertParametersToWire.js.map +1 -1
- package/dist/esm/customization/models.d.ts +146 -151
- 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 +188 -37
- package/dist/esm/customization/outputModels.d.ts.map +1 -1
- package/dist/esm/customization/outputModels.js.map +1 -1
- package/dist/esm/customization/streamingModels.d.ts +2 -1
- package/dist/esm/customization/streamingModels.d.ts.map +1 -1
- package/dist/esm/customization/streamingModels.js.map +1 -1
- package/dist/esm/customization/streamingWireModels.d.ts +2 -1
- package/dist/esm/customization/streamingWireModels.d.ts.map +1 -1
- package/dist/esm/customization/streamingWireModels.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 +191 -157
- 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 +277 -47
- 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 +28 -3
- package/dist/esm/generated/src/paginateHelper.d.ts.map +1 -1
- package/dist/esm/generated/src/paginateHelper.js +99 -2
- 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 +5 -5
- package/dist/esm/generated/src/projectsClient.d.ts.map +1 -1
- package/dist/esm/generated/src/projectsClient.js +3 -3
- 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.d.ts.map +1 -1
- package/dist/react-native/agents/assistants.js +4 -2
- package/dist/react-native/agents/assistants.js.map +1 -1
- package/dist/react-native/agents/customModels.d.ts +4 -29
- package/dist/react-native/agents/customModels.d.ts.map +1 -1
- package/dist/react-native/agents/customModels.js.map +1 -1
- package/dist/react-native/agents/files.d.ts +5 -4
- package/dist/react-native/agents/files.d.ts.map +1 -1
- package/dist/react-native/agents/files.js +55 -27
- package/dist/react-native/agents/files.js.map +1 -1
- package/dist/react-native/agents/index.d.ts +10 -10
- package/dist/react-native/agents/index.d.ts.map +1 -1
- package/dist/react-native/agents/index.js.map +1 -1
- package/dist/react-native/agents/inputOutputs.d.ts +3 -3
- package/dist/react-native/agents/inputOutputs.d.ts.map +1 -1
- package/dist/react-native/agents/inputOutputs.js.map +1 -1
- package/dist/react-native/agents/inputValidations.d.ts.map +1 -1
- package/dist/react-native/agents/inputValidations.js +3 -2
- package/dist/react-native/agents/inputValidations.js.map +1 -1
- package/dist/react-native/agents/messages.js +2 -2
- package/dist/react-native/agents/messages.js.map +1 -1
- package/dist/react-native/agents/poller.d.ts +8 -33
- package/dist/react-native/agents/poller.d.ts.map +1 -1
- package/dist/react-native/agents/poller.js +130 -53
- package/dist/react-native/agents/poller.js.map +1 -1
- package/dist/react-native/agents/streamingModels.d.ts +17 -15
- package/dist/react-native/agents/streamingModels.d.ts.map +1 -1
- package/dist/react-native/agents/streamingModels.js.map +1 -1
- package/dist/react-native/agents/traceUtility.d.ts +3 -3
- package/dist/react-native/agents/traceUtility.d.ts.map +1 -1
- package/dist/react-native/agents/traceUtility.js.map +1 -1
- package/dist/react-native/agents/utils.d.ts +72 -4
- package/dist/react-native/agents/utils.d.ts.map +1 -1
- package/dist/react-native/agents/utils.js +100 -3
- package/dist/react-native/agents/utils.js.map +1 -1
- package/dist/react-native/agents/vectorStores.d.ts +3 -4
- package/dist/react-native/agents/vectorStores.d.ts.map +1 -1
- package/dist/react-native/agents/vectorStores.js +44 -26
- package/dist/react-native/agents/vectorStores.js.map +1 -1
- package/dist/react-native/agents/vectorStoresFileBatches.d.ts +5 -4
- package/dist/react-native/agents/vectorStoresFileBatches.d.ts.map +1 -1
- package/dist/react-native/agents/vectorStoresFileBatches.js +46 -32
- package/dist/react-native/agents/vectorStoresFileBatches.js.map +1 -1
- package/dist/react-native/agents/vectorStoresFiles.d.ts +4 -4
- package/dist/react-native/agents/vectorStoresFiles.d.ts.map +1 -1
- package/dist/react-native/agents/vectorStoresFiles.js +57 -28
- package/dist/react-native/agents/vectorStoresFiles.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 +43 -94
- 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 +53 -11
- package/dist/react-native/customization/convertOutputModelsFromWire.js.map +1 -1
- package/dist/react-native/customization/convertParametersToWire.d.ts +1 -1
- package/dist/react-native/customization/convertParametersToWire.d.ts.map +1 -1
- package/dist/react-native/customization/convertParametersToWire.js.map +1 -1
- package/dist/react-native/customization/models.d.ts +146 -151
- 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 +188 -37
- 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/customization/streamingModels.d.ts +2 -1
- package/dist/react-native/customization/streamingModels.d.ts.map +1 -1
- package/dist/react-native/customization/streamingModels.js.map +1 -1
- package/dist/react-native/customization/streamingWireModels.d.ts +2 -1
- package/dist/react-native/customization/streamingWireModels.d.ts.map +1 -1
- package/dist/react-native/customization/streamingWireModels.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 +191 -157
- 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 +277 -47
- 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 +28 -3
- package/dist/react-native/generated/src/paginateHelper.d.ts.map +1 -1
- package/dist/react-native/generated/src/paginateHelper.js +99 -2
- 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 +5 -5
- package/dist/react-native/generated/src/projectsClient.d.ts.map +1 -1
- package/dist/react-native/generated/src/projectsClient.js +3 -3
- 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 +33 -34
|
@@ -1,60 +1,137 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { delay } from "@azure/core-util";
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
abortSignal: pollingOptions === null || pollingOptions === void 0 ? void 0 : pollingOptions.abortSignal,
|
|
4
|
+
const DEFAULT_POLL_INTERVAL_IN_MS = 1000;
|
|
5
|
+
export function createPoller({ initOperation, pollOperation, getOperationStatus, getOperationError, intervalInMs, }) {
|
|
6
|
+
let state;
|
|
7
|
+
const statePromise = initOperation().then((result) => {
|
|
8
|
+
state = {
|
|
9
|
+
result,
|
|
10
|
+
status: getOperationStatus(result),
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
12
|
+
return state;
|
|
13
|
+
});
|
|
14
|
+
let resultPromise;
|
|
15
|
+
const abortController = new AbortController();
|
|
16
|
+
const handlers = new Map();
|
|
17
|
+
const handleProgressEvents = async () => handlers.forEach((h) => h(state));
|
|
18
|
+
const currentPollIntervalInMs = intervalInMs !== null && intervalInMs !== void 0 ? intervalInMs : DEFAULT_POLL_INTERVAL_IN_MS;
|
|
19
|
+
const poller = {
|
|
20
|
+
get operationState() {
|
|
21
|
+
return state;
|
|
22
|
+
},
|
|
23
|
+
get result() {
|
|
24
|
+
return state === null || state === void 0 ? void 0 : state.result;
|
|
25
|
+
},
|
|
26
|
+
get isDone() {
|
|
27
|
+
var _a;
|
|
28
|
+
return ["succeeded", "failed", "canceled"].includes((_a = state === null || state === void 0 ? void 0 : state.status) !== null && _a !== void 0 ? _a : "");
|
|
29
|
+
},
|
|
30
|
+
onProgress: (callback) => {
|
|
31
|
+
const s = Symbol();
|
|
32
|
+
handlers.set(s, callback);
|
|
33
|
+
return () => handlers.delete(s);
|
|
34
|
+
},
|
|
35
|
+
serialize: async () => {
|
|
36
|
+
await statePromise;
|
|
37
|
+
return JSON.stringify({
|
|
38
|
+
state,
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
submitted: async () => {
|
|
42
|
+
await statePromise;
|
|
43
|
+
},
|
|
44
|
+
pollUntilDone: async (pollOptions) => {
|
|
45
|
+
resultPromise !== null && resultPromise !== void 0 ? resultPromise : (resultPromise = (async () => {
|
|
46
|
+
var _a;
|
|
47
|
+
await statePromise;
|
|
48
|
+
if (!state) {
|
|
49
|
+
throw new Error("Poller is not initialized");
|
|
50
|
+
}
|
|
51
|
+
const { abortSignal: inputAbortSignal } = pollOptions || {};
|
|
52
|
+
function abortListener() {
|
|
53
|
+
abortController.abort();
|
|
54
|
+
}
|
|
55
|
+
const abortSignal = abortController.signal;
|
|
56
|
+
if (inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.aborted) {
|
|
57
|
+
abortController.abort();
|
|
58
|
+
}
|
|
59
|
+
else if (!abortSignal.aborted) {
|
|
60
|
+
inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.addEventListener("abort", abortListener, { once: true });
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
if (!poller.isDone) {
|
|
64
|
+
await poller.poll({ abortSignal });
|
|
65
|
+
while (!poller.isDone) {
|
|
66
|
+
await delay(currentPollIntervalInMs, { abortSignal });
|
|
67
|
+
await poller.poll({ abortSignal });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
inputAbortSignal === null || inputAbortSignal === void 0 ? void 0 : inputAbortSignal.removeEventListener("abort", abortListener);
|
|
73
|
+
}
|
|
74
|
+
switch (state.status) {
|
|
75
|
+
case "succeeded":
|
|
76
|
+
return poller.result;
|
|
77
|
+
case "canceled":
|
|
78
|
+
throw new Error("Operation cancelled");
|
|
79
|
+
case "failed":
|
|
80
|
+
throw (_a = state.error) !== null && _a !== void 0 ? _a : new Error("Operation failed");
|
|
81
|
+
case "notStarted":
|
|
82
|
+
case "running":
|
|
83
|
+
throw new Error("Polling completed without succeeding or failing");
|
|
84
|
+
}
|
|
85
|
+
})().finally(() => {
|
|
86
|
+
resultPromise = undefined;
|
|
87
|
+
}));
|
|
88
|
+
return resultPromise;
|
|
89
|
+
},
|
|
90
|
+
async poll(pollOptions) {
|
|
91
|
+
var _a, _b, _c;
|
|
92
|
+
// Check state before polling
|
|
93
|
+
await statePromise;
|
|
94
|
+
if (!state || !state.result) {
|
|
95
|
+
throw new Error("Poller is not initialized");
|
|
96
|
+
}
|
|
97
|
+
switch (state.status) {
|
|
98
|
+
case "succeeded":
|
|
99
|
+
return state;
|
|
100
|
+
case "canceled":
|
|
101
|
+
throw new Error("Operation was canceled");
|
|
102
|
+
case "failed":
|
|
103
|
+
throw (_a = state.error) !== null && _a !== void 0 ? _a : new Error("Operation failed");
|
|
104
|
+
}
|
|
105
|
+
// Poll
|
|
106
|
+
if ((_b = pollOptions === null || pollOptions === void 0 ? void 0 : pollOptions.abortSignal) === null || _b === void 0 ? void 0 : _b.aborted) {
|
|
107
|
+
throw new Error("Operation aborted");
|
|
108
|
+
}
|
|
109
|
+
const result = await pollOperation(state.result);
|
|
110
|
+
state = {
|
|
111
|
+
result,
|
|
112
|
+
status: getOperationStatus(result),
|
|
113
|
+
error: getOperationError ? getOperationError(result) : undefined,
|
|
114
|
+
};
|
|
115
|
+
await handleProgressEvents();
|
|
116
|
+
switch (state.status) {
|
|
117
|
+
case "canceled":
|
|
118
|
+
throw new Error("Operation was canceled");
|
|
119
|
+
case "failed":
|
|
120
|
+
throw (_c = state.error) !== null && _c !== void 0 ? _c : new Error("Operation failed");
|
|
121
|
+
}
|
|
122
|
+
return state;
|
|
123
|
+
},
|
|
124
|
+
then(onfulfilled, onrejected) {
|
|
125
|
+
return poller.pollUntilDone().then(onfulfilled, onrejected);
|
|
126
|
+
},
|
|
127
|
+
catch(onrejected) {
|
|
128
|
+
return poller.pollUntilDone().catch(onrejected);
|
|
129
|
+
},
|
|
130
|
+
finally(onfinally) {
|
|
131
|
+
return poller.pollUntilDone().finally(onfinally);
|
|
132
|
+
},
|
|
133
|
+
[Symbol.toStringTag]: "Poller",
|
|
38
134
|
};
|
|
39
|
-
|
|
40
|
-
async function updateWrapper() {
|
|
41
|
-
var _a;
|
|
42
|
-
if ((_a = this.state.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
|
|
43
|
-
return makeOperation(this.state);
|
|
44
|
-
}
|
|
45
|
-
const { result, completed } = await this.state.updateInternal(this.state.result);
|
|
46
|
-
this.state.result = result;
|
|
47
|
-
this.state.isCompleted = completed;
|
|
48
|
-
return makeOperation(this.state);
|
|
49
|
-
}
|
|
50
|
-
async function cancelWrapper() {
|
|
51
|
-
if (!this.state.result || !this.state.cancelInternal) {
|
|
52
|
-
return makeOperation(Object.assign(Object.assign({}, this.state), { cancelled: false }));
|
|
53
|
-
}
|
|
54
|
-
const cancelled = await this.state.cancelInternal(this.state.result);
|
|
55
|
-
return makeOperation(Object.assign(Object.assign({}, this.state), { cancelled: cancelled }));
|
|
56
|
-
}
|
|
57
|
-
function toString() {
|
|
58
|
-
return JSON.stringify(this.state);
|
|
135
|
+
return poller;
|
|
59
136
|
}
|
|
60
137
|
//# sourceMappingURL=poller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../src/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AAM,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,CAAC,SAA2C;YACjD,OAAO,MAAM,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACnD,CAAC;QACD,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,QAAQ;KAC/B,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { delay } from \"@azure/core-util\";\nimport type { PollerLike, OperationState, OperationStatus } from \"@azure/core-lro\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\n\nconst DEFAULT_POLL_INTERVAL_IN_MS = 1000;\n\nexport function createPoller<T>({\n initOperation,\n pollOperation,\n getOperationStatus,\n getOperationError,\n intervalInMs,\n}: {\n initOperation: () => Promise<T>;\n pollOperation: (currentResult: T) => Promise<T>;\n getOperationStatus: (result: T) => OperationStatus;\n getOperationError?: (result: T) => Error | undefined;\n intervalInMs?: number;\n}): PollerLike<OperationState<T>, T> {\n let state: OperationState<T>;\n const statePromise = initOperation().then((result) => {\n state = {\n result,\n status: getOperationStatus(result),\n };\n return state;\n });\n\n let resultPromise: Promise<T> | undefined;\n const abortController = new AbortController();\n type Handler = (state: OperationState<T>) => void;\n const handlers = new Map<symbol, Handler>();\n const handleProgressEvents = async (): Promise<void> => handlers.forEach((h) => h(state));\n const currentPollIntervalInMs = intervalInMs ?? DEFAULT_POLL_INTERVAL_IN_MS;\n\n const poller: PollerLike<OperationState<T>, T> = {\n get operationState(): OperationState<T> | undefined {\n return state;\n },\n get result(): T | undefined {\n return state?.result;\n },\n get isDone(): boolean {\n return [\"succeeded\", \"failed\", \"canceled\"].includes(state?.status ?? \"\");\n },\n onProgress: (callback: (state: OperationState<T>) => void) => {\n const s = Symbol();\n handlers.set(s, callback);\n return () => handlers.delete(s);\n },\n serialize: async () => {\n await statePromise;\n return JSON.stringify({\n state,\n });\n },\n submitted: async () => {\n await statePromise;\n },\n pollUntilDone: async (pollOptions?: { abortSignal?: AbortSignalLike }) => {\n resultPromise ??= (async () => {\n await statePromise;\n if (!state) {\n throw new Error(\"Poller is not initialized\");\n }\n const { abortSignal: inputAbortSignal } = pollOptions || {};\n function abortListener(): void {\n abortController.abort();\n }\n const abortSignal = abortController.signal;\n if (inputAbortSignal?.aborted) {\n abortController.abort();\n } else if (!abortSignal.aborted) {\n inputAbortSignal?.addEventListener(\"abort\", abortListener, { once: true });\n }\n\n try {\n if (!poller.isDone) {\n await poller.poll({ abortSignal });\n while (!poller.isDone) {\n await delay(currentPollIntervalInMs, { abortSignal });\n await poller.poll({ abortSignal });\n }\n }\n } finally {\n inputAbortSignal?.removeEventListener(\"abort\", abortListener);\n }\n switch (state.status) {\n case \"succeeded\":\n return poller.result as T;\n case \"canceled\":\n throw new Error(\"Operation cancelled\");\n case \"failed\":\n throw state.error ?? new Error(\"Operation failed\");\n case \"notStarted\":\n case \"running\":\n throw new Error(\"Polling completed without succeeding or failing\");\n }\n })().finally(() => {\n resultPromise = undefined;\n });\n return resultPromise;\n },\n\n async poll(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<OperationState<T>> {\n // Check state before polling\n await statePromise;\n if (!state || !state.result) {\n throw new Error(\"Poller is not initialized\");\n }\n switch (state.status) {\n case \"succeeded\":\n return state;\n case \"canceled\":\n throw new Error(\"Operation was canceled\");\n case \"failed\":\n throw state.error ?? new Error(\"Operation failed\");\n }\n\n // Poll\n if (pollOptions?.abortSignal?.aborted) {\n throw new Error(\"Operation aborted\");\n }\n const result = await pollOperation(state.result);\n state = {\n result,\n status: getOperationStatus(result),\n error: getOperationError ? getOperationError(result) : undefined,\n };\n\n await handleProgressEvents();\n switch (state.status) {\n case \"canceled\":\n throw new Error(\"Operation was canceled\");\n case \"failed\":\n throw state.error ?? new Error(\"Operation failed\");\n }\n return state;\n },\n\n then<T1 = T, T2 = never>(\n onfulfilled?: ((value: T) => T1 | PromiseLike<T1>) | undefined | null,\n onrejected?: ((reason: any) => T2 | PromiseLike<T2>) | undefined | null,\n ): Promise<T1 | T2> {\n return poller.pollUntilDone().then(onfulfilled, onrejected);\n },\n catch<T2 = never>(\n onrejected?: ((reason: any) => T2 | PromiseLike<T2>) | undefined | null,\n ): Promise<T | T2> {\n return poller.pollUntilDone().catch(onrejected);\n },\n finally(onfinally?: (() => void) | undefined | null): Promise<T> {\n return poller.pollUntilDone().finally(onfinally);\n },\n [Symbol.toStringTag]: \"Poller\",\n };\n return poller;\n}\n"]}
|
|
@@ -2,21 +2,23 @@ import type { MessageDeltaChunk, RunStepDeltaChunk } from "../customization/stre
|
|
|
2
2
|
import type { AgentThreadOutput, RunStepOutput, ThreadMessageOutput, ThreadRunOutput } from "../customization/outputModels.js";
|
|
3
3
|
/**
|
|
4
4
|
Each event in a server-sent events stream has an `event` and `data` property:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
`thread.message.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ``` ts
|
|
8
|
+
* event: thread.created
|
|
9
|
+
* data: {"id": "thread_123", "object": "thread", ...}
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* We emit events whenever a new object is created, transitions to a new state, or is being
|
|
13
|
+
* streamed in parts (deltas). For example, we emit `thread.run.created` when a new run
|
|
14
|
+
* is created, `thread.run.completed` when a run completes, and so on. When an Agent chooses
|
|
15
|
+
* to create a message during a run, we emit a `thread.message.created event`, a
|
|
16
|
+
* `thread.message.in_progress` event, many `thread.message.delta` events, and finally a
|
|
17
|
+
* `thread.message.completed` event.
|
|
18
|
+
*
|
|
19
|
+
* We may add additional events over time, so we recommend handling unknown events gracefully
|
|
20
|
+
* in your code.
|
|
21
|
+
**/
|
|
20
22
|
export interface AgentEventMessage {
|
|
21
23
|
/** The data of the event. The data can be of type AgentThreadOutput, ThreadRunOutput, RunStepOutput, ThreadMessageOutput, MessageDeltaChunk,RunStepDeltaChunk */
|
|
22
24
|
data: AgentEventStreamDataOutput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamingModels.d.ts","sourceRoot":"","sources":["../../../src/agents/streamingModels.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAChG,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"streamingModels.d.ts","sourceRoot":"","sources":["../../../src/agents/streamingModels.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAChG,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAE1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,iBAAiB;IAChC,kKAAkK;IAClK,IAAI,EAAE,0BAA0B,CAAC;IACjC,6BAA6B;IAC7B,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAAC;CACtC;AAED,mDAAmD;AACnD,MAAM,MAAM,0BAA0B,GAClC,iBAAiB,GACjB,eAAe,GACf,aAAa,GACb,mBAAmB,GACnB,iBAAiB,GACjB,iBAAiB,GACjB,MAAM,CAAC;AAEX,gDAAgD;AAChD,oBAAY,iBAAiB;IAC3B,6FAA6F;IAC7F,aAAa,mBAAmB;CACjC;AAED,6CAA6C;AAC7C,oBAAY,cAAc;IACxB,wFAAwF;IACxF,gBAAgB,uBAAuB;IAEvC,kGAAkG;IAClG,eAAe,sBAAsB;IAErC,uGAAuG;I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../../../src/agents/streamingModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"streamingModels.js","sourceRoot":"","sources":["../../../src/agents/streamingModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA8ClC,gDAAgD;AAChD,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,6FAA6F;IAC7F,qDAAgC,CAAA;AAClC,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED,6CAA6C;AAC7C,MAAM,CAAN,IAAY,cA2BX;AA3BD,WAAY,cAAc;IACxB,wFAAwF;IACxF,yDAAuC,CAAA;IAEvC,kGAAkG;IAClG,uDAAqC,CAAA;IAErC,uGAAuG;IACvG,gEAA8C,CAAA;IAE9C,2GAA2G;IAC3G,wEAAsD,CAAA;IAEtD,sFAAsF;IACtF,6DAA2C,CAAA;IAE3C,+EAA+E;IAC/E,uDAAqC,CAAA;IAErC,sGAAsG;IACtG,+DAA6C,CAAA;IAE7C,sFAAsF;IACtF,6DAA2C,CAAA;IAE3C,oFAAoF;IACpF,yDAAuC,CAAA;AACzC,CAAC,EA3BW,cAAc,KAAd,cAAc,QA2BzB;AAED,kDAAkD;AAClD,MAAM,CAAN,IAAY,kBAqBX;AArBD,WAAY,kBAAkB;IAC5B,kGAAkG;IAClG,sEAAgD,CAAA;IAEhD,0GAA0G;IAC1G,6EAAuD,CAAA;IAEvD,wGAAwG;IACxG,kEAA4C,CAAA;IAE5C,yFAAyF;IACzF,0EAAoD,CAAA;IAEpD,kFAAkF;IAClF,oEAA8C,CAAA;IAE9C,yFAAyF;IACzF,0EAAoD,CAAA;IAEpD,uFAAuF;IACvF,sEAAgD,CAAA;AAClD,CAAC,EArBW,kBAAkB,KAAlB,kBAAkB,QAqB7B;AAED,iDAAiD;AACjD,MAAM,CAAN,IAAY,kBAeX;AAfD,WAAY,kBAAkB;IAC5B,gGAAgG;IAChG,qEAA+C,CAAA;IAE/C,+GAA+G;IAC/G,4EAAsD,CAAA;IAEtD,uGAAuG;IACvG,iEAA2C,CAAA;IAE3C,8FAA8F;IAC9F,yEAAmD,CAAA;IAEnD,gGAAgG;IAChG,2EAAqD,CAAA;AACvD,CAAC,EAfW,kBAAkB,KAAlB,kBAAkB,QAe7B;AAED,qEAAqE;AACrE,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,sFAAsF;IACtF,6BAAe,CAAA;AACjB,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AAED,gEAAgE;AAChE,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,0CAA0C;IAC1C,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { MessageDeltaChunk, RunStepDeltaChunk } from \"../customization/streamingModels.js\";\nimport type {\n AgentThreadOutput,\n RunStepOutput,\n ThreadMessageOutput,\n ThreadRunOutput,\n} from \"../customization/outputModels.js\";\n\n/**\nEach event in a server-sent events stream has an `event` and `data` property:\n* \n* @example\n* ``` ts\n* event: thread.created\n* data: {\"id\": \"thread_123\", \"object\": \"thread\", ...}\n* ``` \n* \n* We emit events whenever a new object is created, transitions to a new state, or is being\n* streamed in parts (deltas). For example, we emit `thread.run.created` when a new run\n* is created, `thread.run.completed` when a run completes, and so on. When an Agent chooses\n* to create a message during a run, we emit a `thread.message.created event`, a\n* `thread.message.in_progress` event, many `thread.message.delta` events, and finally a\n* `thread.message.completed` event.\n* \n* We may add additional events over time, so we recommend handling unknown events gracefully\n* in your code.\n**/\nexport interface AgentEventMessage {\n /** The data of the event. The data can be of type AgentThreadOutput, ThreadRunOutput, RunStepOutput, ThreadMessageOutput, MessageDeltaChunk,RunStepDeltaChunk */\n data: AgentEventStreamDataOutput;\n /** The type of the event. */\n event: AgentStreamEventType | string;\n}\n\n/** Represents a stream event data in the agent. */\nexport type AgentEventStreamDataOutput =\n | AgentThreadOutput\n | ThreadRunOutput\n | RunStepOutput\n | ThreadMessageOutput\n | MessageDeltaChunk\n | RunStepDeltaChunk\n | string;\n\n/** Thread operation related streaming events */\nexport enum ThreadStreamEvent {\n /** Event sent when a new thread is created. The data of this event is of type AgentThread */\n ThreadCreated = \"thread.created\",\n}\n\n/** Run operation related streaming events */\nexport enum RunStreamEvent {\n /** Event sent when a new run is created. The data of this event is of type ThreadRun */\n ThreadRunCreated = \"thread.run.created\",\n\n /** Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun */\n ThreadRunQueued = \"thread.run.queued\",\n\n /** Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun */\n ThreadRunInProgress = \"thread.run.in_progress\",\n\n /** Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun */\n ThreadRunRequiresAction = \"thread.run.requires_action\",\n\n /** Event sent when a run is completed. The data of this event is of type ThreadRun */\n ThreadRunCompleted = \"thread.run.completed\",\n\n /** Event sent when a run fails. The data of this event is of type ThreadRun */\n ThreadRunFailed = \"thread.run.failed\",\n\n /** Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun */\n ThreadRunCancelling = \"thread.run.cancelling\",\n\n /** Event sent when a run is cancelled. The data of this event is of type ThreadRun */\n ThreadRunCancelled = \"thread.run.cancelled\",\n\n /** Event sent when a run is expired. The data of this event is of type ThreadRun */\n ThreadRunExpired = \"thread.run.expired\",\n}\n\n/** Run step operation related streaming events */\nexport enum RunStepStreamEvent {\n /** Event sent when a new thread run step is created. The data of this event is of type RunStep */\n ThreadRunStepCreated = \"thread.run.step.created\",\n\n /** Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep */\n ThreadRunStepInProgress = \"thread.run.step.in_progress\",\n\n /** Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk */\n ThreadRunStepDelta = \"thread.run.step.delta\",\n\n /** Event sent when a run step is completed. The data of this event is of type RunStep */\n ThreadRunStepCompleted = \"thread.run.step.completed\",\n\n /** Event sent when a run step fails. The data of this event is of type RunStep */\n ThreadRunStepFailed = \"thread.run.step.failed\",\n\n /** Event sent when a run step is cancelled. The data of this event is of type RunStep */\n ThreadRunStepCancelled = \"thread.run.step.cancelled\",\n\n /** Event sent when a run step is expired. The data of this event is of type RunStep */\n ThreadRunStepExpired = \"thread.run.step.expired\",\n}\n\n/** Message operation related streaming events */\nexport enum MessageStreamEvent {\n /** Event sent when a new message is created. The data of this event is of type ThreadMessage */\n ThreadMessageCreated = \"thread.message.created\",\n\n /** Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage */\n ThreadMessageInProgress = \"thread.message.in_progress\",\n\n /** Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk */\n ThreadMessageDelta = \"thread.message.delta\",\n\n /** Event sent when a message is completed. The data of this event is of type ThreadMessage */\n ThreadMessageCompleted = \"thread.message.completed\",\n\n /** Event sent before a message is completed. The data of this event is of type ThreadMessage */\n ThreadMessageIncomplete = \"thread.message.incomplete\",\n}\n\n/** Terminal event indicating a server side error while streaming. */\nexport enum ErrorEvent {\n /** Event sent when an error occurs, such as an internal server error or a timeout. */\n Error = \"error\",\n}\n\n/** Terminal event indicating the successful end of a stream. */\nexport enum DoneEvent {\n /** Event sent when the stream is done. */\n Done = \"done\",\n}\n\n/**\n Represents the type of an agent stream event.\n */\nexport type AgentStreamEventType =\n | ThreadStreamEvent\n | RunStreamEvent\n | RunStepStreamEvent\n | MessageStreamEvent\n | ErrorEvent\n | DoneEvent;\n\n/** Represents a stream of agent event message. */\nexport interface AgentEventMessageStream\n extends AsyncDisposable,\n AsyncIterable<AgentEventMessage> {}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentsApiResponseFormatOption,
|
|
2
|
-
import type { RunStepCompletionUsageOutput } from "../generated/src/outputModels.js";
|
|
1
|
+
import type { AgentsApiResponseFormatOption, ThreadMessageOptions, ToolOutput } from "../generated/src/models.js";
|
|
2
|
+
import type { RunStepCompletionUsageOutput, ThreadMessageOutput } from "../generated/src/outputModels.js";
|
|
3
3
|
import type { OptionsWithTracing, Span, TracingAttributeOptions } from "../tracing.js";
|
|
4
4
|
export declare function traceStartAgentGeneric<Options extends OptionsWithTracing>(span: Span, options: Options): void;
|
|
5
5
|
export declare function traceEndAgentGeneric<Options extends OptionsWithTracing>(span: Span, _options: Options): void;
|
|
@@ -9,7 +9,7 @@ export declare function UpdateWithAgentAttributes(attributeOptions: Omit<Tracing
|
|
|
9
9
|
* @param span - The span to add the event to.
|
|
10
10
|
* @param messageAttributes - The attributes of the message event.
|
|
11
11
|
*/
|
|
12
|
-
export declare function addMessageEvent(span: Span, messageAttributes: ThreadMessageOptions |
|
|
12
|
+
export declare function addMessageEvent(span: Span, messageAttributes: ThreadMessageOptions | ThreadMessageOutput, usage?: RunStepCompletionUsageOutput): void;
|
|
13
13
|
/**
|
|
14
14
|
* Adds an instruction event to the span.
|
|
15
15
|
* @param span - The span to add the event to.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traceUtility.d.ts","sourceRoot":"","sources":["../../../src/agents/traceUtility.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,6BAA6B,
|
|
1
|
+
{"version":3,"file":"traceUtility.d.ts","sourceRoot":"","sources":["../../../src/agents/traceUtility.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,6BAA6B,EAC7B,oBAAoB,EACpB,UAAU,EACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAEV,4BAA4B,EAC5B,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAIvF,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,kBAAkB,EACvE,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,GACf,IAAI,CAON;AACD,wBAAgB,oBAAoB,CAAC,OAAO,SA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CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,MAAM,WAAW,GAA2B,EAAE,CAAC;IAC/C,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACjC,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;QAClC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAI,OAAkC,CAAC,YAAY,CAAC,CAAC;QACjF,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IACrD,CAAC,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AgentsApiResponseFormat,\n AgentsApiResponseFormatOption,\n MessageContent,\n ThreadMessage,\n ThreadMessageOptions,\n ToolOutput,\n} from \"../generated/src/models.js\";\nimport type { RunStepCompletionUsageOutput } from \"../generated/src/outputModels.js\";\nimport type { OptionsWithTracing, Span, TracingAttributeOptions } from \"../tracing.js\";\nimport { TracingAttributes, TracingUtility } from \"../tracing.js\";\nimport { getTelemetryOptions } from \"../telemetry/telemetry.js\";\n\nexport function traceStartAgentGeneric<Options extends OptionsWithTracing>(\n span: Span,\n options: Options,\n): void {\n const attributeOptions = options.tracingAttributeOptions || {};\n TracingUtility.setSpanAttributes(\n span,\n options.tracingAttributeOptions?.operationName || \"Agent_Operation\",\n UpdateWithAgentAttributes(attributeOptions),\n );\n}\nexport function traceEndAgentGeneric<Options extends OptionsWithTracing>(\n span: Span,\n _options: Options,\n): void {\n const attributeOptions = {};\n TracingUtility.updateSpanAttributes(span, UpdateWithAgentAttributes(attributeOptions));\n}\n\nexport function UpdateWithAgentAttributes(\n attributeOptions: Omit<TracingAttributeOptions, \"operationName\">,\n): Omit<TracingAttributeOptions, \"operationName\"> {\n attributeOptions.genAiSystem = TracingAttributes.AZ_AI_AGENT_SYSTEM;\n return attributeOptions;\n}\n\n/**\n * Adds a message event to the span.\n * @param span - The span to add the event to.\n * @param messageAttributes - The attributes of the message event.\n */\nexport function addMessageEvent(\n span: Span,\n messageAttributes: ThreadMessageOptions | ThreadMessage,\n usage?: RunStepCompletionUsageOutput,\n): void {\n const eventBody: Record<string, unknown> = {};\n const telemetryOptions = getTelemetryOptions();\n if (telemetryOptions.enableContentRecording) {\n eventBody.content = getMessageContent(messageAttributes.content);\n }\n eventBody.role = messageAttributes.role;\n if (messageAttributes.attachments) {\n eventBody.attachments = messageAttributes.attachments.map((attachment) => {\n return {\n id: attachment.file_id,\n tools: attachment.tools.map((tool) => tool.type),\n };\n });\n }\n const threadId = (messageAttributes as ThreadMessage).thread_id;\n const agentId = (messageAttributes as ThreadMessage).assistant_id ?? undefined;\n const threadRunId = (messageAttributes as ThreadMessage).run_id;\n const messageStatus = (messageAttributes as ThreadMessage).status;\n const messageId = (messageAttributes as ThreadMessage).id;\n const incompleteDetails = (messageAttributes as ThreadMessage).incomplete_details;\n if (incompleteDetails) {\n eventBody.incomplete_details = incompleteDetails;\n }\n const usagePromptTokens = usage?.prompt_tokens;\n const usageCompletionTokens = usage?.completion_tokens;\n const attributes = {\n eventContent: JSON.stringify(eventBody),\n threadId,\n agentId,\n threadRunId,\n messageStatus,\n messageId,\n usagePromptTokens,\n usageCompletionTokens,\n genAiSystem: TracingAttributes.AZ_AI_AGENT_SYSTEM,\n };\n TracingUtility.addSpanEvent(span, `gen_ai.${messageAttributes.role}.message`, attributes);\n}\n\n/**\n * Adds an instruction event to the span.\n * @param span - The span to add the event to.\n * @param instructionAttributes - The attributes of the instruction event.\n */\nexport function addInstructionsEvent(\n span: Span,\n instructionAttributes: {\n instructions?: string | null;\n additional_instructions?: string | null;\n threadId?: string;\n agentId?: string;\n },\n): void {\n const eventBody: Record<string, unknown> = {};\n if (instructionAttributes.instructions || instructionAttributes.additional_instructions) {\n eventBody.content =\n instructionAttributes.instructions && instructionAttributes.additional_instructions\n ? `${instructionAttributes.instructions} ${instructionAttributes.additional_instructions}`\n : instructionAttributes.instructions || instructionAttributes.additional_instructions;\n }\n const attributes = {\n eventContent: JSON.stringify(eventBody),\n threadId: instructionAttributes.threadId,\n agentId: instructionAttributes.agentId,\n genAiSystem: TracingAttributes.AZ_AI_AGENT_SYSTEM,\n };\n TracingUtility.addSpanEvent(span, \"gen_ai.system.message\", attributes);\n}\n\n/**\n * Formats the agent API response.\n * @param responseFormat - The response format option.\n * @returns The formatted response as a string, or null/undefined.\n */\nexport function formatAgentApiResponse(\n responseFormat: AgentsApiResponseFormatOption | null | undefined,\n): string | undefined {\n if (\n typeof responseFormat === \"string\" ||\n responseFormat === undefined ||\n responseFormat === null\n ) {\n return responseFormat ?? undefined;\n }\n if ((responseFormat as AgentsApiResponseFormat).type) {\n return (responseFormat as AgentsApiResponseFormat).type ?? undefined;\n }\n return undefined;\n}\n\n/**\n * Adds a tool messages event to the span\n * @param span - The span to add the event to.\n * @param tool_outputs - List of tool oupts\n */\nexport function addToolMessagesEvent(span: Span, tool_outputs: Array<ToolOutput>): void {\n tool_outputs.forEach((tool_output) => {\n const eventBody = { content: tool_output.output, id: tool_output.tool_call_id };\n TracingUtility.addSpanEvent(span, \"gen_ai.tool.message\", {\n eventContent: JSON.stringify(eventBody),\n genAiSystem: TracingAttributes.AZ_AI_AGENT_SYSTEM,\n });\n });\n}\n\nfunction getMessageContent(messageContent: string | MessageContent[]): string | {} {\n type MessageContentExtended = MessageContent & { [key: string]: any };\n if (!Array.isArray(messageContent)) {\n return messageContent;\n }\n const contentBody: { [key: string]: any } = {};\n messageContent.forEach((content) => {\n const typedContent = content.type;\n const { value, annotations } = (content as MessageContentExtended)[typedContent];\n contentBody[typedContent] = { value, annotations };\n });\n return contentBody;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"traceUtility.js","sourceRoot":"","sources":["../../../src/agents/traceUtility.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAclC,OAAO,EAAE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AY,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;YACvC,WAAW,EAAE,iBAAiB,CAAC,kBAAkB;SAClD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CAAC,cAA+C;IAExE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACnC,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,MAAM,WAAW,GAA2B,EAAE,CAAC;IAC/C,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACjC,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;QAClC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAI,OAAkC,CAAC,YAAY,CAAC,CAAC;QACjF,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IACrD,CAAC,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AgentsApiResponseFormat,\n AgentsApiResponseFormatOption,\n ThreadMessageOptions,\n ToolOutput,\n} from \"../generated/src/models.js\";\nimport type {\n MessageContentOutput,\n RunStepCompletionUsageOutput,\n ThreadMessageOutput,\n} from \"../generated/src/outputModels.js\";\nimport type { OptionsWithTracing, Span, TracingAttributeOptions } from \"../tracing.js\";\nimport { TracingAttributes, TracingUtility } from \"../tracing.js\";\nimport { getTelemetryOptions } from \"../telemetry/telemetry.js\";\n\nexport function traceStartAgentGeneric<Options extends OptionsWithTracing>(\n span: Span,\n options: Options,\n): void {\n const attributeOptions = options.tracingAttributeOptions || {};\n TracingUtility.setSpanAttributes(\n span,\n options.tracingAttributeOptions?.operationName || \"Agent_Operation\",\n UpdateWithAgentAttributes(attributeOptions),\n );\n}\nexport function traceEndAgentGeneric<Options extends OptionsWithTracing>(\n span: Span,\n _options: Options,\n): void {\n const attributeOptions = {};\n TracingUtility.updateSpanAttributes(span, UpdateWithAgentAttributes(attributeOptions));\n}\n\nexport function UpdateWithAgentAttributes(\n attributeOptions: Omit<TracingAttributeOptions, \"operationName\">,\n): Omit<TracingAttributeOptions, \"operationName\"> {\n attributeOptions.genAiSystem = TracingAttributes.AZ_AI_AGENT_SYSTEM;\n return attributeOptions;\n}\n\n/**\n * Adds a message event to the span.\n * @param span - The span to add the event to.\n * @param messageAttributes - The attributes of the message event.\n */\nexport function addMessageEvent(\n span: Span,\n messageAttributes: ThreadMessageOptions | ThreadMessageOutput,\n usage?: RunStepCompletionUsageOutput,\n): void {\n const eventBody: Record<string, unknown> = {};\n const telemetryOptions = getTelemetryOptions();\n if (telemetryOptions.enableContentRecording) {\n eventBody.content = getMessageContent(messageAttributes.content);\n }\n eventBody.role = messageAttributes.role;\n if (messageAttributes.attachments) {\n eventBody.attachments = messageAttributes.attachments.map((attachment) => {\n return {\n id: attachment.file_id,\n tools: attachment.tools.map((tool) => tool.type),\n };\n });\n }\n const threadId = (messageAttributes as ThreadMessageOutput).thread_id;\n const agentId = (messageAttributes as ThreadMessageOutput).assistant_id ?? undefined;\n const threadRunId = (messageAttributes as ThreadMessageOutput).run_id;\n const messageStatus = (messageAttributes as ThreadMessageOutput).status;\n const messageId = (messageAttributes as ThreadMessageOutput).id;\n const incompleteDetails = (messageAttributes as ThreadMessageOutput).incomplete_details;\n if (incompleteDetails) {\n eventBody.incomplete_details = incompleteDetails;\n }\n const usagePromptTokens = usage?.prompt_tokens;\n const usageCompletionTokens = usage?.completion_tokens;\n const attributes = {\n eventContent: JSON.stringify(eventBody),\n threadId,\n agentId,\n threadRunId,\n messageStatus,\n messageId,\n usagePromptTokens,\n usageCompletionTokens,\n genAiSystem: TracingAttributes.AZ_AI_AGENT_SYSTEM,\n };\n\n TracingUtility.addSpanEvent(span, `gen_ai.${messageAttributes.role}.message`, attributes);\n}\n\n/**\n * Adds an instruction event to the span.\n * @param span - The span to add the event to.\n * @param instructionAttributes - The attributes of the instruction event.\n */\nexport function addInstructionsEvent(\n span: Span,\n instructionAttributes: {\n instructions?: string | null;\n additional_instructions?: string | null;\n threadId?: string;\n agentId?: string;\n },\n): void {\n const eventBody: Record<string, unknown> = {};\n if (instructionAttributes.instructions || instructionAttributes.additional_instructions) {\n eventBody.content =\n instructionAttributes.instructions && instructionAttributes.additional_instructions\n ? `${instructionAttributes.instructions} ${instructionAttributes.additional_instructions}`\n : instructionAttributes.instructions || instructionAttributes.additional_instructions;\n }\n const attributes = {\n eventContent: JSON.stringify(eventBody),\n threadId: instructionAttributes.threadId,\n agentId: instructionAttributes.agentId,\n genAiSystem: TracingAttributes.AZ_AI_AGENT_SYSTEM,\n };\n TracingUtility.addSpanEvent(span, \"gen_ai.system.message\", attributes);\n}\n\n/**\n * Formats the agent API response.\n * @param responseFormat - The response format option.\n * @returns The formatted response as a string, or null/undefined.\n */\nexport function formatAgentApiResponse(\n responseFormat: AgentsApiResponseFormatOption | null | undefined,\n): string | undefined {\n if (\n typeof responseFormat === \"string\" ||\n responseFormat === undefined ||\n responseFormat === null\n ) {\n return responseFormat ?? undefined;\n }\n if ((responseFormat as AgentsApiResponseFormat).type) {\n return (responseFormat as AgentsApiResponseFormat).type ?? undefined;\n }\n return undefined;\n}\n\n/**\n * Adds a tool messages event to the span\n * @param span - The span to add the event to.\n * @param tool_outputs - List of tool oupts\n */\nexport function addToolMessagesEvent(span: Span, tool_outputs: Array<ToolOutput>): void {\n tool_outputs.forEach((tool_output) => {\n const eventBody = { content: tool_output.output, id: tool_output.tool_call_id };\n TracingUtility.addSpanEvent(span, \"gen_ai.tool.message\", {\n eventContent: JSON.stringify(eventBody),\n genAiSystem: TracingAttributes.AZ_AI_AGENT_SYSTEM,\n });\n });\n}\n\nfunction getMessageContent(messageContent: string | MessageContentOutput[]): string | {} {\n type MessageContentExtended = MessageContentOutput & { [key: string]: any };\n if (!Array.isArray(messageContent)) {\n return messageContent;\n }\n const contentBody: { [key: string]: any } = {};\n messageContent.forEach((content) => {\n const typedContent = content.type;\n const { value, annotations } = (content as MessageContentExtended)[typedContent];\n contentBody[typedContent] = { value, annotations };\n });\n return contentBody;\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { AzureAISearchToolDefinition, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, FunctionDefinition, FunctionToolDefinition, RequiredActionOutput, RequiredToolCallOutput, ToolDefinition, ToolDefinitionOutputParent, ToolResources, VectorStoreConfigurations, VectorStoreDataSource } from "./inputOutputs.js";
|
|
1
|
+
import type { AzureAISearchToolDefinition, AzureFunctionToolDefinition, CodeInterpreterToolDefinition, FileSearchToolDefinition, FileSearchToolDefinitionDetails, FunctionDefinition, FunctionToolDefinition, OpenApiFunctionDefinition, OpenApiToolDefinition, RequiredActionOutput, RequiredToolCallOutput, ToolDefinition, ToolDefinitionOutputParent, ToolResources, VectorStoreConfigurations, VectorStoreDataSource, AzureFunctionStorageQueue, AzureFunctionDefinition } from "./inputOutputs.js";
|
|
2
2
|
/**
|
|
3
3
|
* Determines if the given output is of the specified type.
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
5
|
+
* @typeParam T - The type to check against, which extends one of the possible output parent types.
|
|
6
6
|
* @param output - The action to check, which can be of type `RequiredActionOutput`, `RequiredToolCallOutput`, or `ToolDefinitionOutputParent`.
|
|
7
7
|
* @param type - The type to check the action against.
|
|
8
8
|
* @returns A boolean indicating whether the action is of the specified type.
|
|
@@ -15,9 +15,11 @@ 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
|
-
SharepointGrounding = "sharepoint_grounding"
|
|
20
|
+
SharepointGrounding = "sharepoint_grounding",
|
|
21
|
+
/** Azure Function tool */
|
|
22
|
+
AzureFunction = "azure_function"
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Utility class for creating various tools.
|
|
@@ -58,6 +60,19 @@ export declare class ToolUtility {
|
|
|
58
60
|
definition: CodeInterpreterToolDefinition;
|
|
59
61
|
resources: ToolResources;
|
|
60
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* Creates an Azure Function tool
|
|
65
|
+
* @param name - The name of the Azure Function.
|
|
66
|
+
* @param description - The description of the Azure Function.
|
|
67
|
+
* @param parameters - The parameters of the Azure Function.
|
|
68
|
+
* @param inputQueue - The input queue configuration.
|
|
69
|
+
* @param outputQueue - The output queue configuration.
|
|
70
|
+
* @returns An object containing the definition and resources for the Azure Function tool.
|
|
71
|
+
*/
|
|
72
|
+
static createAzureFunctionTool(name: string, description: string, parameters: unknown, inputQueue: AzureFunctionStorageQueue, outputQueue: AzureFunctionStorageQueue, definitionDetails: AzureFunctionDefinition): {
|
|
73
|
+
definition: AzureFunctionToolDefinition;
|
|
74
|
+
resources: ToolResources;
|
|
75
|
+
};
|
|
61
76
|
/**
|
|
62
77
|
* Creates an Azure AI search tool
|
|
63
78
|
*
|
|
@@ -70,6 +85,15 @@ export declare class ToolUtility {
|
|
|
70
85
|
definition: AzureAISearchToolDefinition;
|
|
71
86
|
resources: ToolResources;
|
|
72
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
|
+
};
|
|
73
97
|
/**
|
|
74
98
|
* Creates a function tool
|
|
75
99
|
*
|
|
@@ -80,6 +104,16 @@ export declare class ToolUtility {
|
|
|
80
104
|
static createFunctionTool(functionDefinition: FunctionDefinition): {
|
|
81
105
|
definition: FunctionToolDefinition;
|
|
82
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Creates an OpenApi tool
|
|
109
|
+
*
|
|
110
|
+
* @param openApiFunctionDefinition - The OpenApi function definition to use.
|
|
111
|
+
*
|
|
112
|
+
* @returns An object containing the definition for the OpenApi tool.
|
|
113
|
+
*/
|
|
114
|
+
static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {
|
|
115
|
+
definition: OpenApiToolDefinition;
|
|
116
|
+
};
|
|
83
117
|
}
|
|
84
118
|
/**
|
|
85
119
|
* Represents a set of tools with their definitions and resources.
|
|
@@ -137,5 +171,39 @@ export declare class ToolSet {
|
|
|
137
171
|
definition: AzureAISearchToolDefinition;
|
|
138
172
|
resources: ToolResources;
|
|
139
173
|
};
|
|
174
|
+
/**
|
|
175
|
+
* Adds an OpenApi tool to the tool set.
|
|
176
|
+
*
|
|
177
|
+
* @param openApiFunctionDefinition - The OpenApi function definition to use.
|
|
178
|
+
*
|
|
179
|
+
* @returns An object containing the definition for the OpenApi tool
|
|
180
|
+
*/
|
|
181
|
+
addOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {
|
|
182
|
+
definition: OpenApiToolDefinition;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Adds an Azure Function tool to the tool set.
|
|
186
|
+
*
|
|
187
|
+
* @param name - The name of the Azure Function.
|
|
188
|
+
* @param description - The description of the Azure Function.
|
|
189
|
+
* @param parameters - The parameters of the Azure Function.
|
|
190
|
+
* @param inputQueue - The input queue configuration.
|
|
191
|
+
* @param outputQueue - The output queue configuration.
|
|
192
|
+
*
|
|
193
|
+
* @returns An object containing the definition and resources for the Azure Function tool.
|
|
194
|
+
*/
|
|
195
|
+
addAzureFunctionTool(name: string, description: string, parameters: unknown, inputQueue: AzureFunctionStorageQueue, outputQueue: AzureFunctionStorageQueue, definitionDetails: AzureFunctionDefinition): {
|
|
196
|
+
definition: AzureFunctionToolDefinition;
|
|
197
|
+
resources: ToolResources;
|
|
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
|
+
};
|
|
140
208
|
}
|
|
141
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,6BAA6B,EAC7B,wBAAwB,EACxB,+BAA+B,EAC/B,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,0BAA0B,EAC1B,aAAa,EACb,yBAAyB,EACzB,qBAAqB,
|
|
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,GAAG,sBAAsB,GAAG,0BAA0B,EAClF,IAAI,EAAE,MAAM,GACX,MAAM,IAAI,CAAC,CAEb;AAED,2DAA2D;AAC3D,oBAAY,k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