@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
package/README.md
CHANGED
|
@@ -9,9 +9,9 @@ Use the AI Projects client library (in preview) to:
|
|
|
9
9
|
|
|
10
10
|
[Product documentation](https://aka.ms/azsdk/azure-ai-projects/product-doc)
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
| [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples)
|
|
13
|
+
| [Package (npm)](https://www.npmjs.com/package/@azure/ai-projects)
|
|
14
|
+
| [API reference documentation](https://learn.microsoft.com/javascript/api/overview/azure/ai-projects-readme?view=azure-node-preview)
|
|
15
15
|
|
|
16
16
|
## Table of contents
|
|
17
17
|
|
|
@@ -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:
|
|
@@ -49,7 +50,7 @@ Use the AI Projects client library (in preview) to:
|
|
|
49
50
|
- [Troubleshooting](#troubleshooting)
|
|
50
51
|
- [Exceptions](#exceptions)
|
|
51
52
|
- [Reporting issues](#reporting-issues)
|
|
52
|
-
|
|
53
|
+
- [Next steps](#next-steps)
|
|
53
54
|
- [Contributing](#contributing)
|
|
54
55
|
|
|
55
56
|
## Getting started
|
|
@@ -69,7 +70,7 @@ Use the AI Projects client library (in preview) to:
|
|
|
69
70
|
### Install the package
|
|
70
71
|
|
|
71
72
|
```bash
|
|
72
|
-
npm install @azure/ai-projects
|
|
73
|
+
npm install @azure/ai-projects @azure/identity
|
|
73
74
|
```
|
|
74
75
|
|
|
75
76
|
## Key concepts
|
|
@@ -78,14 +79,11 @@ npm install @azure/ai-projects
|
|
|
78
79
|
|
|
79
80
|
The class factory method `fromConnectionString` is used to construct the client. To construct a client:
|
|
80
81
|
|
|
81
|
-
```
|
|
82
|
+
```ts snippet:setup
|
|
82
83
|
import { AIProjectsClient } from "@azure/ai-projects";
|
|
83
84
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const connectionString = process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || "<connectionString>";
|
|
88
|
-
|
|
86
|
+
const connectionString = process.env.AZURE_AI_PROJECTS_CONNECTION_STRING ?? "<connectionString>";
|
|
89
87
|
const client = AIProjectsClient.fromConnectionString(
|
|
90
88
|
connectionString,
|
|
91
89
|
new DefaultAzureCredential(),
|
|
@@ -98,13 +96,13 @@ const client = AIProjectsClient.fromConnectionString(
|
|
|
98
96
|
|
|
99
97
|
Your Azure AI Foundry project has a "Management center". When you enter it, you will see a tab named "Connected resources" under your project. The `.connections` operations on the client allow you to enumerate the connections and get connection properties. Connection properties include the resource URL and authentication credentials, among other things.
|
|
100
98
|
|
|
101
|
-
Below are code examples of the connection operations. Full samples can be found under the "connections" folder in the [package samples]
|
|
99
|
+
Below are code examples of the connection operations. Full samples can be found under the "connections" folder in the [package samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples).
|
|
102
100
|
|
|
103
101
|
#### Get properties of all connections
|
|
104
102
|
|
|
105
103
|
To list the properties of all the connections in the Azure AI Foundry project:
|
|
106
104
|
|
|
107
|
-
```
|
|
105
|
+
```ts snippet:listConnections
|
|
108
106
|
const connections = await client.connections.listConnections();
|
|
109
107
|
for (const connection of connections) {
|
|
110
108
|
console.log(connection);
|
|
@@ -115,7 +113,7 @@ for (const connection of connections) {
|
|
|
115
113
|
|
|
116
114
|
To list the properties of connections of a certain type (here Azure OpenAI):
|
|
117
115
|
|
|
118
|
-
```
|
|
116
|
+
```ts snippet:filterConnections
|
|
119
117
|
const connections = await client.connections.listConnections({ category: "AzureOpenAI" });
|
|
120
118
|
for (const connection of connections) {
|
|
121
119
|
console.log(connection);
|
|
@@ -126,21 +124,21 @@ for (const connection of connections) {
|
|
|
126
124
|
|
|
127
125
|
To get the connection properties of a connection named `connectionName`:
|
|
128
126
|
|
|
129
|
-
```
|
|
127
|
+
```ts snippet:getConnection
|
|
130
128
|
const connection = await client.connections.getConnection("connectionName");
|
|
131
129
|
console.log(connection);
|
|
132
130
|
```
|
|
133
131
|
|
|
134
132
|
To get the connection properties with its authentication credentials:
|
|
135
133
|
|
|
136
|
-
```
|
|
134
|
+
```ts snippet:getConnectionWithSecrets
|
|
137
135
|
const connection = await client.connections.getConnectionWithSecrets("connectionName");
|
|
138
136
|
console.log(connection);
|
|
139
137
|
```
|
|
140
138
|
|
|
141
139
|
### Agents (Preview)
|
|
142
140
|
|
|
143
|
-
Agents in the Azure AI Projects client library are designed to facilitate various interactions and operations within your AI projects. They serve as the core components that manage and execute tasks, leveraging different tools and resources to achieve specific goals. The following steps outline the typical sequence for interacting with Agents. See the "agents" folder in the [package samples]
|
|
141
|
+
Agents in the Azure AI Projects client library are designed to facilitate various interactions and operations within your AI projects. They serve as the core components that manage and execute tasks, leveraging different tools and resources to achieve specific goals. The following steps outline the typical sequence for interacting with Agents. See the "agents" folder in the [package samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples) for additional Agent samples.
|
|
144
142
|
|
|
145
143
|
Agents are actively being developed. A sign-up form for private preview is coming soon.
|
|
146
144
|
|
|
@@ -148,7 +146,7 @@ Agents are actively being developed. A sign-up form for private preview is comin
|
|
|
148
146
|
|
|
149
147
|
Here is an example of how to create an Agent:
|
|
150
148
|
|
|
151
|
-
```
|
|
149
|
+
```ts snippet:createAgent
|
|
152
150
|
const agent = await client.agents.createAgent("gpt-4o", {
|
|
153
151
|
name: "my-agent",
|
|
154
152
|
instructions: "You are a helpful assistant",
|
|
@@ -159,12 +157,12 @@ To allow Agents to access your resources or custom functions, you need tools. Yo
|
|
|
159
157
|
|
|
160
158
|
You can use `ToolSet` to do this:
|
|
161
159
|
|
|
162
|
-
```
|
|
160
|
+
```ts snippet:toolSet
|
|
161
|
+
import { ToolSet } from "@azure/ai-projects";
|
|
162
|
+
|
|
163
163
|
const toolSet = new ToolSet();
|
|
164
164
|
toolSet.addFileSearchTool([vectorStore.id]);
|
|
165
165
|
toolSet.addCodeInterpreterTool([codeInterpreterFile.id]);
|
|
166
|
-
|
|
167
|
-
// Create agent with tool set
|
|
168
166
|
const agent = await client.agents.createAgent("gpt-4o", {
|
|
169
167
|
name: "my-agent",
|
|
170
168
|
instructions: "You are a helpful agent",
|
|
@@ -178,21 +176,20 @@ console.log(`Created agent, agent ID: ${agent.id}`);
|
|
|
178
176
|
|
|
179
177
|
To perform file search by an Agent, we first need to upload a file, create a vector store, and associate the file to the vector store. Here is an example:
|
|
180
178
|
|
|
181
|
-
```
|
|
182
|
-
|
|
179
|
+
```ts snippet:fileSearch
|
|
180
|
+
import { ToolUtility } from "@azure/ai-projects";
|
|
181
|
+
|
|
182
|
+
const localFileStream = fs.createReadStream(filePath);
|
|
183
183
|
const file = await client.agents.uploadFile(localFileStream, "assistants", {
|
|
184
184
|
fileName: "sample_file_for_upload.txt",
|
|
185
185
|
});
|
|
186
186
|
console.log(`Uploaded file, ID: ${file.id}`);
|
|
187
|
-
|
|
188
187
|
const vectorStore = await client.agents.createVectorStore({
|
|
189
188
|
fileIds: [file.id],
|
|
190
189
|
name: "my_vector_store",
|
|
191
190
|
});
|
|
192
191
|
console.log(`Created vector store, ID: ${vectorStore.id}`);
|
|
193
|
-
|
|
194
192
|
const fileSearchTool = ToolUtility.createFileSearchTool([vectorStore.id]);
|
|
195
|
-
|
|
196
193
|
const agent = await client.agents.createAgent("gpt-4o", {
|
|
197
194
|
name: "SDK Test Agent - Retrieval",
|
|
198
195
|
instructions: "You are helpful agent that can help fetch data from files you know about.",
|
|
@@ -206,15 +203,15 @@ console.log(`Created agent, agent ID : ${agent.id}`);
|
|
|
206
203
|
|
|
207
204
|
Here is an example to upload a file and use it for code interpreter by an Agent:
|
|
208
205
|
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
const fFile = await client.agents.uploadFile(fileStream, "assistants", {
|
|
212
|
-
fileName: "nifty_500_quarterly_results.csv",
|
|
213
|
-
});
|
|
214
|
-
console.log(`Uploaded local file, file ID : ${file.id}`);
|
|
215
|
-
|
|
216
|
-
const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([file.id]);
|
|
206
|
+
```ts snippet:codeInterpreter
|
|
207
|
+
import { ToolUtility } from "@azure/ai-projects";
|
|
217
208
|
|
|
209
|
+
const localFileStream = fs.createReadStream(filePath);
|
|
210
|
+
const localFile = await client.agents.uploadFile(localFileStream, "assistants", {
|
|
211
|
+
fileName: "localFile",
|
|
212
|
+
});
|
|
213
|
+
console.log(`Uploaded local file, file ID : ${localFile.id}`);
|
|
214
|
+
const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([localFile.id]);
|
|
218
215
|
// Notice that CodeInterpreter must be enabled in the agent creation, otherwise the agent will not be able to see the file attachment
|
|
219
216
|
const agent = await client.agents.createAgent("gpt-4o-mini", {
|
|
220
217
|
name: "my-agent",
|
|
@@ -231,13 +228,15 @@ To enable your Agent to perform search through Bing search API, you use `ToolUti
|
|
|
231
228
|
|
|
232
229
|
Here is an example:
|
|
233
230
|
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
const bingTool = ToolUtility.createConnectionTool(connectionToolType.BingGrounding, [
|
|
237
|
-
bingGroundingConnectionId,
|
|
238
|
-
]);
|
|
231
|
+
```ts snippet:bingGrounding
|
|
232
|
+
import { ToolUtility, connectionToolType } from "@azure/ai-projects";
|
|
239
233
|
|
|
240
|
-
const
|
|
234
|
+
const bingConnection = await client.connections.getConnection(
|
|
235
|
+
process.env.BING_CONNECTION_NAME ?? "<connection-name>",
|
|
236
|
+
);
|
|
237
|
+
const connectionId = bingConnection.id;
|
|
238
|
+
const bingTool = ToolUtility.createConnectionTool(connectionToolType.BingGrounding, [connectionId]);
|
|
239
|
+
const agent = await client.agents.createAgent("gpt-4o", {
|
|
241
240
|
name: "my-agent",
|
|
242
241
|
instructions: "You are a helpful agent",
|
|
243
242
|
tools: [bingTool.definition],
|
|
@@ -251,17 +250,13 @@ Azure AI Search is an enterprise search system for high-performance applications
|
|
|
251
250
|
|
|
252
251
|
Here is an example to integrate Azure AI Search:
|
|
253
252
|
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
const cognitiveServicesConnection = await client.connections.getConnection(
|
|
257
|
-
cognitiveServicesConnectionName,
|
|
258
|
-
);
|
|
259
|
-
const azureAISearchTool = ToolUtility.createAzureAISearchTool(
|
|
260
|
-
cognitiveServicesConnection.id,
|
|
261
|
-
cognitiveServicesConnection.name,
|
|
262
|
-
);
|
|
253
|
+
```ts snippet:AISearch
|
|
254
|
+
import { ToolUtility } from "@azure/ai-projects";
|
|
263
255
|
|
|
264
|
-
|
|
256
|
+
const connectionName =
|
|
257
|
+
process.env.AZURE_AI_SEARCH_CONNECTION_NAME ?? "<AzureAISearchConnectionName>";
|
|
258
|
+
const connection = await client.connections.getConnection(connectionName);
|
|
259
|
+
const azureAISearchTool = ToolUtility.createAzureAISearchTool(connection.id, connection.name);
|
|
265
260
|
const agent = await client.agents.createAgent("gpt-4-0125-preview", {
|
|
266
261
|
name: "my-agent",
|
|
267
262
|
instructions: "You are a helpful agent",
|
|
@@ -277,48 +272,71 @@ You can enhance your Agents by defining callback functions as function tools. Th
|
|
|
277
272
|
|
|
278
273
|
Here is an example:
|
|
279
274
|
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
|
|
275
|
+
```ts snippet:functionTools
|
|
276
|
+
import {
|
|
277
|
+
FunctionToolDefinition,
|
|
278
|
+
ToolUtility,
|
|
279
|
+
RequiredToolCallOutput,
|
|
280
|
+
FunctionToolDefinitionOutput,
|
|
281
|
+
ToolOutput,
|
|
282
|
+
} from "@azure/ai-projects";
|
|
283
283
|
|
|
284
|
+
class FunctionToolExecutor {
|
|
285
|
+
private functionTools: {
|
|
286
|
+
func: Function;
|
|
287
|
+
definition: FunctionToolDefinition;
|
|
288
|
+
}[];
|
|
284
289
|
constructor() {
|
|
285
|
-
this.functionTools = [
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
290
|
+
this.functionTools = [
|
|
291
|
+
{
|
|
292
|
+
func: this.getUserFavoriteCity,
|
|
293
|
+
...ToolUtility.createFunctionTool({
|
|
294
|
+
name: "getUserFavoriteCity",
|
|
295
|
+
description: "Gets the user's favorite city.",
|
|
296
|
+
parameters: {},
|
|
297
|
+
}),
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
func: this.getCityNickname,
|
|
301
|
+
...ToolUtility.createFunctionTool({
|
|
302
|
+
name: "getCityNickname",
|
|
303
|
+
description: "Gets the nickname of a city, e.g. 'LA' for 'Los Angeles, CA'.",
|
|
304
|
+
parameters: {
|
|
305
|
+
type: "object",
|
|
306
|
+
properties: {
|
|
307
|
+
location: { type: "string", description: "The city and state, e.g. Seattle, Wa" },
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
}),
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
func: this.getWeather,
|
|
314
|
+
...ToolUtility.createFunctionTool({
|
|
315
|
+
name: "getWeather",
|
|
316
|
+
description: "Gets the weather for a location.",
|
|
317
|
+
parameters: {
|
|
318
|
+
type: "object",
|
|
319
|
+
properties: {
|
|
320
|
+
location: { type: "string", description: "The city and state, e.g. Seattle, Wa" },
|
|
321
|
+
unit: { type: "string", enum: ["c", "f"] },
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
}),
|
|
325
|
+
},
|
|
326
|
+
];
|
|
307
327
|
}
|
|
308
|
-
|
|
309
328
|
private getUserFavoriteCity(): {} {
|
|
310
|
-
return {
|
|
329
|
+
return { location: "Seattle, WA" };
|
|
311
330
|
}
|
|
312
|
-
|
|
313
331
|
private getCityNickname(location: string): {} {
|
|
314
|
-
return {
|
|
332
|
+
return { nickname: "The Emerald City" };
|
|
315
333
|
}
|
|
316
|
-
|
|
317
334
|
private getWeather(location: string, unit: string): {} {
|
|
318
|
-
return {
|
|
335
|
+
return { weather: unit === "f" ? "72f" : "22c" };
|
|
319
336
|
}
|
|
320
|
-
|
|
321
|
-
|
|
337
|
+
public invokeTool(
|
|
338
|
+
toolCall: RequiredToolCallOutput & FunctionToolDefinitionOutput,
|
|
339
|
+
): ToolOutput | undefined {
|
|
322
340
|
console.log(`Function tool call - ${toolCall.function.name}`);
|
|
323
341
|
const args = [];
|
|
324
342
|
if (toolCall.function.parameters) {
|
|
@@ -334,34 +352,62 @@ class FunctionToolExecutor {
|
|
|
334
352
|
return undefined;
|
|
335
353
|
}
|
|
336
354
|
}
|
|
337
|
-
const result = this.functionTools
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
355
|
+
const result = this.functionTools
|
|
356
|
+
.find((tool) => tool.definition.function.name === toolCall.function.name)
|
|
357
|
+
?.func(...args);
|
|
358
|
+
return result
|
|
359
|
+
? {
|
|
360
|
+
toolCallId: toolCall.id,
|
|
361
|
+
output: JSON.stringify(result),
|
|
362
|
+
}
|
|
363
|
+
: undefined;
|
|
342
364
|
}
|
|
343
|
-
|
|
344
365
|
public getFunctionDefinitions(): FunctionToolDefinition[] {
|
|
345
|
-
return this.functionTools.map(tool => {
|
|
366
|
+
return this.functionTools.map((tool) => {
|
|
367
|
+
return tool.definition;
|
|
368
|
+
});
|
|
346
369
|
}
|
|
347
370
|
}
|
|
348
|
-
|
|
349
371
|
const functionToolExecutor = new FunctionToolExecutor();
|
|
350
372
|
const functionTools = functionToolExecutor.getFunctionDefinitions();
|
|
351
|
-
const agent = await client.agents.createAgent("gpt-4o",
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
373
|
+
const agent = await client.agents.createAgent("gpt-4o", {
|
|
374
|
+
name: "my-agent",
|
|
375
|
+
instructions:
|
|
376
|
+
"You are a weather bot. Use the provided functions to help answer questions. Customize your responses to the user's preferences as much as possible and use friendly nicknames for cities whenever possible.",
|
|
377
|
+
tools: functionTools,
|
|
378
|
+
});
|
|
357
379
|
console.log(`Created agent, agent ID: ${agent.id}`);
|
|
358
380
|
```
|
|
359
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
|
+
|
|
360
406
|
#### Create Thread
|
|
361
407
|
|
|
362
408
|
For each session or conversation, a thread is required. Here is an example:
|
|
363
409
|
|
|
364
|
-
```
|
|
410
|
+
```ts snippet:createThread
|
|
365
411
|
const thread = await client.agents.createThread();
|
|
366
412
|
```
|
|
367
413
|
|
|
@@ -369,28 +415,25 @@ const thread = await client.agents.createThread();
|
|
|
369
415
|
|
|
370
416
|
In some scenarios, you might need to assign specific resources to individual threads. To achieve this, you provide the `toolResources` argument to `createThread`. In the following example, you create a vector store and upload a file, enable an Agent for file search using the `tools` argument, and then associate the file with the thread using the `toolResources` argument.
|
|
371
417
|
|
|
372
|
-
```
|
|
373
|
-
|
|
418
|
+
```ts snippet:threadWithTool
|
|
419
|
+
import { ToolUtility } from "@azure/ai-projects";
|
|
420
|
+
|
|
421
|
+
const localFileStream = fs.createReadStream(filePath);
|
|
374
422
|
const file = await client.agents.uploadFile(localFileStream, "assistants", {
|
|
375
|
-
fileName: "sample_file_for_upload.
|
|
423
|
+
fileName: "sample_file_for_upload.csv",
|
|
376
424
|
});
|
|
377
425
|
console.log(`Uploaded file, ID: ${file.id}`);
|
|
378
|
-
|
|
379
426
|
const vectorStore = await client.agents.createVectorStore({
|
|
380
427
|
fileIds: [file.id],
|
|
381
|
-
name: "my_vector_store",
|
|
382
428
|
});
|
|
383
429
|
console.log(`Created vector store, ID: ${vectorStore.id}`);
|
|
384
|
-
|
|
385
430
|
const fileSearchTool = ToolUtility.createFileSearchTool([vectorStore.id]);
|
|
386
|
-
|
|
387
431
|
const agent = await client.agents.createAgent("gpt-4o", {
|
|
388
|
-
name: "
|
|
432
|
+
name: "myAgent",
|
|
389
433
|
instructions: "You are helpful agent that can help fetch data from files you know about.",
|
|
390
434
|
tools: [fileSearchTool.definition],
|
|
391
435
|
});
|
|
392
436
|
console.log(`Created agent, agent ID : ${agent.id}`);
|
|
393
|
-
|
|
394
437
|
// Create thread with file resources.
|
|
395
438
|
// If the agent has multiple threads, only this thread can search this file.
|
|
396
439
|
const thread = await client.agents.createThread({ toolResources: fileSearchTool.resources });
|
|
@@ -400,18 +443,21 @@ const thread = await client.agents.createThread({ toolResources: fileSearchTool.
|
|
|
400
443
|
|
|
401
444
|
To create a message for assistant to process, you pass `user` as `role` and a question as `content`:
|
|
402
445
|
|
|
403
|
-
```
|
|
446
|
+
```ts snippet:createMessage
|
|
404
447
|
const message = await client.agents.createMessage(thread.id, {
|
|
405
448
|
role: "user",
|
|
406
449
|
content: "hello, world!",
|
|
407
450
|
});
|
|
451
|
+
console.log(`Created message, message ID: ${message.id}`);
|
|
408
452
|
```
|
|
409
453
|
|
|
410
454
|
#### Create Message with File Search Attachment
|
|
411
455
|
|
|
412
456
|
To attach a file to a message for content searching, you use `ToolUtility.createFileSearchTool()` and the `attachments` argument:
|
|
413
457
|
|
|
414
|
-
```
|
|
458
|
+
```ts snippet:messageWithFileSearch
|
|
459
|
+
import { ToolUtility } from "@azure/ai-projects";
|
|
460
|
+
|
|
415
461
|
const fileSearchTool = ToolUtility.createFileSearchTool();
|
|
416
462
|
const message = await client.agents.createMessage(thread.id, {
|
|
417
463
|
role: "user",
|
|
@@ -429,7 +475,9 @@ To attach a file to a message for data analysis, you use `ToolUtility.createCode
|
|
|
429
475
|
|
|
430
476
|
Here is an example:
|
|
431
477
|
|
|
432
|
-
```
|
|
478
|
+
```ts snippet:messageWithCodeInterpreter
|
|
479
|
+
import { ToolUtility } from "@azure/ai-projects";
|
|
480
|
+
|
|
433
481
|
// notice that CodeInterpreter must be enabled in the agent creation,
|
|
434
482
|
// otherwise the agent will not be able to see the file attachment for code interpretation
|
|
435
483
|
const codeInterpreterTool = ToolUtility.createCodeInterpreterTool();
|
|
@@ -439,10 +487,8 @@ const agent = await client.agents.createAgent("gpt-4-1106-preview", {
|
|
|
439
487
|
tools: [codeInterpreterTool.definition],
|
|
440
488
|
});
|
|
441
489
|
console.log(`Created agent, agent ID: ${agent.id}`);
|
|
442
|
-
|
|
443
|
-
const thread = client.agents.createThread();
|
|
490
|
+
const thread = await client.agents.createThread();
|
|
444
491
|
console.log(`Created thread, thread ID: ${thread.id}`);
|
|
445
|
-
|
|
446
492
|
const message = await client.agents.createMessage(thread.id, {
|
|
447
493
|
role: "user",
|
|
448
494
|
content:
|
|
@@ -459,9 +505,8 @@ console.log(`Created message, message ID: ${message.id}`);
|
|
|
459
505
|
|
|
460
506
|
Here is an example of `createRun` and poll until the run is completed:
|
|
461
507
|
|
|
462
|
-
```
|
|
508
|
+
```ts snippet:createRun
|
|
463
509
|
let run = await client.agents.createRun(thread.id, agent.id);
|
|
464
|
-
|
|
465
510
|
// Poll the run as long as run status is queued or in progress
|
|
466
511
|
while (
|
|
467
512
|
run.status === "queued" ||
|
|
@@ -478,48 +523,66 @@ To have the SDK poll on your behalf, use the `createThreadAndRun` method.
|
|
|
478
523
|
|
|
479
524
|
Here is an example:
|
|
480
525
|
|
|
481
|
-
```
|
|
482
|
-
const run = await client.agents.createThreadAndRun(
|
|
526
|
+
```ts snippet:createThreadAndRun
|
|
527
|
+
const run = await client.agents.createThreadAndRun(agent.id, {
|
|
528
|
+
thread: {
|
|
529
|
+
messages: [
|
|
530
|
+
{
|
|
531
|
+
role: "user",
|
|
532
|
+
content: "hello, world!",
|
|
533
|
+
},
|
|
534
|
+
],
|
|
535
|
+
},
|
|
536
|
+
});
|
|
483
537
|
```
|
|
484
538
|
|
|
485
539
|
With streaming, polling also need not be considered.
|
|
486
540
|
|
|
487
541
|
Here is an example:
|
|
488
542
|
|
|
489
|
-
```
|
|
543
|
+
```ts snippet:createRunStream
|
|
490
544
|
const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream();
|
|
491
545
|
```
|
|
492
546
|
|
|
493
547
|
Event handling can be done as follows:
|
|
494
548
|
|
|
495
|
-
```
|
|
549
|
+
```ts snippet:eventHandling
|
|
550
|
+
import {
|
|
551
|
+
RunStreamEvent,
|
|
552
|
+
ThreadRunOutput,
|
|
553
|
+
MessageStreamEvent,
|
|
554
|
+
MessageDeltaChunk,
|
|
555
|
+
MessageDeltaTextContent,
|
|
556
|
+
DoneEvent,
|
|
557
|
+
} from "@azure/ai-projects";
|
|
558
|
+
|
|
559
|
+
const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream();
|
|
496
560
|
for await (const eventMessage of streamEventMessages) {
|
|
497
|
-
switch (eventMessage.event) {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
break;
|
|
561
|
+
switch (eventMessage.event) {
|
|
562
|
+
case RunStreamEvent.ThreadRunCreated:
|
|
563
|
+
console.log(`ThreadRun status: ${(eventMessage.data as ThreadRunOutput).status}`);
|
|
564
|
+
break;
|
|
565
|
+
case MessageStreamEvent.ThreadMessageDelta:
|
|
566
|
+
{
|
|
567
|
+
const messageDelta = eventMessage.data as MessageDeltaChunk;
|
|
568
|
+
messageDelta.delta.content.forEach((contentPart) => {
|
|
569
|
+
if (contentPart.type === "text") {
|
|
570
|
+
const textContent = contentPart as MessageDeltaTextContent;
|
|
571
|
+
const textValue = textContent.text?.value || "No text";
|
|
572
|
+
console.log(`Text delta received:: ${textValue}`);
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
break;
|
|
577
|
+
case RunStreamEvent.ThreadRunCompleted:
|
|
578
|
+
console.log("Thread Run Completed");
|
|
579
|
+
break;
|
|
580
|
+
case ErrorEvent.Error:
|
|
581
|
+
console.log(`An error occurred. Data ${eventMessage.data}`);
|
|
582
|
+
break;
|
|
583
|
+
case DoneEvent.Done:
|
|
584
|
+
console.log("Stream completed.");
|
|
585
|
+
break;
|
|
523
586
|
}
|
|
524
587
|
}
|
|
525
588
|
```
|
|
@@ -528,18 +591,29 @@ switch (eventMessage.event) {
|
|
|
528
591
|
|
|
529
592
|
To retrieve messages from agents, use the following example:
|
|
530
593
|
|
|
531
|
-
```
|
|
532
|
-
|
|
594
|
+
```ts snippet:listMessages
|
|
595
|
+
import { MessageContentOutput, isOutputOfType, MessageTextContentOutput } from "../src/index.js";
|
|
533
596
|
|
|
597
|
+
const messages = await client.agents.listMessages(thread.id);
|
|
598
|
+
while (messages.hasMore) {
|
|
599
|
+
const nextMessages = await client.agents.listMessages(currentRun.threadId, {
|
|
600
|
+
after: messages.lastId,
|
|
601
|
+
});
|
|
602
|
+
messages.data = messages.data.concat(nextMessages.data);
|
|
603
|
+
messages.hasMore = nextMessages.hasMore;
|
|
604
|
+
messages.lastId = nextMessages.lastId;
|
|
605
|
+
}
|
|
534
606
|
// The messages are following in the reverse order,
|
|
535
607
|
// we will iterate them and output only text contents.
|
|
536
608
|
for (const dataPoint of messages.data.reverse()) {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
609
|
+
const lastMessageContent: MessageContentOutput = dataPoint.content[dataPoint.content.length - 1];
|
|
610
|
+
console.log(lastMessageContent);
|
|
611
|
+
if (isOutputOfType<MessageTextContentOutput>(lastMessageContent, "text")) {
|
|
612
|
+
console.log(
|
|
613
|
+
`${dataPoint.role}: ${(lastMessageContent as MessageTextContentOutput).text.value}`,
|
|
614
|
+
);
|
|
542
615
|
}
|
|
616
|
+
}
|
|
543
617
|
```
|
|
544
618
|
|
|
545
619
|
### Retrieve File
|
|
@@ -548,12 +622,29 @@ Files uploaded by Agents cannot be retrieved back. If your use case needs to acc
|
|
|
548
622
|
|
|
549
623
|
Here is an example retrieving file ids from messages:
|
|
550
624
|
|
|
551
|
-
```
|
|
625
|
+
```ts snippet:retrieveFile
|
|
626
|
+
import {
|
|
627
|
+
isOutputOfType,
|
|
628
|
+
MessageTextContentOutput,
|
|
629
|
+
MessageImageFileContentOutput,
|
|
630
|
+
} from "../src/index.js";
|
|
631
|
+
|
|
552
632
|
const messages = await client.agents.listMessages(thread.id);
|
|
633
|
+
// Get most recent message from the assistant
|
|
634
|
+
const assistantMessage = messages.data.find((msg) => msg.role === "assistant");
|
|
635
|
+
if (assistantMessage) {
|
|
636
|
+
const textContent = assistantMessage.content.find((content) =>
|
|
637
|
+
isOutputOfType<MessageTextContentOutput>(content, "text"),
|
|
638
|
+
) as MessageTextContentOutput;
|
|
639
|
+
if (textContent) {
|
|
640
|
+
console.log(`Last message: ${textContent.text.value}`);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
553
643
|
const imageFile = (messages.data[0].content[0] as MessageImageFileContentOutput).imageFile;
|
|
554
644
|
const imageFileName = (await client.agents.getFile(imageFile.fileId)).filename;
|
|
555
|
-
|
|
556
|
-
|
|
645
|
+
const fileContent = await (
|
|
646
|
+
await client.agents.getFileContent(imageFile.fileId).asNodeStream()
|
|
647
|
+
).body;
|
|
557
648
|
if (fileContent) {
|
|
558
649
|
const chunks: Buffer[] = [];
|
|
559
650
|
for await (const chunk of fileContent) {
|
|
@@ -571,13 +662,11 @@ console.log(`Saved image file to: ${imageFileName}`);
|
|
|
571
662
|
|
|
572
663
|
To remove resources after completing tasks, use the following functions:
|
|
573
664
|
|
|
574
|
-
```
|
|
665
|
+
```ts snippet:teardown
|
|
575
666
|
await client.agents.deleteVectorStore(vectorStore.id);
|
|
576
667
|
console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`);
|
|
577
|
-
|
|
578
668
|
await client.agents.deleteFile(file.id);
|
|
579
669
|
console.log(`Deleted file, file ID: ${file.id}`);
|
|
580
|
-
|
|
581
670
|
client.agents.deleteAgent(agent.id);
|
|
582
671
|
console.log(`Deleted agent, agent ID: ${agent.id}`);
|
|
583
672
|
```
|
|
@@ -611,39 +700,34 @@ npm install @opentelemetry/exporter-trace-otlp-proto \
|
|
|
611
700
|
|
|
612
701
|
Here is a code sample to be included above `createAgent`:
|
|
613
702
|
|
|
614
|
-
```
|
|
615
|
-
import { trace } from "@opentelemetry/api";
|
|
616
|
-
import { AzureMonitorTraceExporter } from "@azure/monitor-opentelemetry-exporter"
|
|
703
|
+
```ts snippet:tracing
|
|
617
704
|
import {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
705
|
+
NodeTracerProvider,
|
|
706
|
+
SimpleSpanProcessor,
|
|
707
|
+
ConsoleSpanExporter,
|
|
621
708
|
} from "@opentelemetry/sdk-trace-node";
|
|
709
|
+
import { trace } from "@opentelemetry/api";
|
|
710
|
+
import { AzureMonitorTraceExporter } from "@azure/monitor-opentelemetry-exporter";
|
|
622
711
|
|
|
623
712
|
const provider = new NodeTracerProvider();
|
|
624
713
|
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
|
|
625
714
|
provider.register();
|
|
626
|
-
|
|
627
715
|
const tracer = trace.getTracer("Agents Sample", "1.0.0");
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
);
|
|
632
|
-
|
|
633
|
-
if (!appInsightsConnectionString) {
|
|
716
|
+
let appInsightsConnectionString =
|
|
717
|
+
process.env.APP_INSIGHTS_CONNECTION_STRING ?? "<appInsightsConnectionString>";
|
|
718
|
+
if (appInsightsConnectionString == "<appInsightsConnectionString>") {
|
|
634
719
|
appInsightsConnectionString = await client.telemetry.getConnectionString();
|
|
635
720
|
}
|
|
636
|
-
|
|
637
721
|
if (appInsightsConnectionString) {
|
|
638
722
|
const exporter = new AzureMonitorTraceExporter({
|
|
639
|
-
connectionString: appInsightsConnectionString
|
|
723
|
+
connectionString: appInsightsConnectionString,
|
|
640
724
|
});
|
|
641
725
|
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
|
|
642
726
|
}
|
|
643
|
-
|
|
644
727
|
await tracer.startActiveSpan("main", async (span) => {
|
|
645
|
-
|
|
646
|
-
// ...
|
|
728
|
+
client.telemetry.updateSettings({ enableContentRecording: true });
|
|
729
|
+
// ...
|
|
730
|
+
});
|
|
647
731
|
```
|
|
648
732
|
|
|
649
733
|
## Troubleshooting
|
|
@@ -652,16 +736,18 @@ await tracer.startActiveSpan("main", async (span) => {
|
|
|
652
736
|
|
|
653
737
|
Client methods that make service calls raise an [RestError](https://learn.microsoft.com/javascript/api/%40azure/core-rest-pipeline/resterror) for a non-success HTTP status code response from the service. The exception's `code` will hold the HTTP response status code. The exception's `error.message` contains a detailed message that may be helpful in diagnosing the issue:
|
|
654
738
|
|
|
655
|
-
```
|
|
656
|
-
import { RestError } from "@azure/core-rest-pipeline"
|
|
657
|
-
|
|
658
|
-
// ...
|
|
739
|
+
```ts snippet:exceptions
|
|
740
|
+
import { RestError } from "@azure/core-rest-pipeline";
|
|
659
741
|
|
|
660
742
|
try {
|
|
661
743
|
const result = await client.connections.listConnections();
|
|
662
|
-
} catch (e
|
|
663
|
-
|
|
664
|
-
|
|
744
|
+
} catch (e) {
|
|
745
|
+
if (e instanceof RestError) {
|
|
746
|
+
console.log(`Status code: ${e.code}`);
|
|
747
|
+
console.log(e.message);
|
|
748
|
+
} else {
|
|
749
|
+
console.error(e);
|
|
750
|
+
}
|
|
665
751
|
}
|
|
666
752
|
```
|
|
667
753
|
|
|
@@ -676,9 +762,9 @@ Operation returned an invalid status 'Unauthorized'
|
|
|
676
762
|
|
|
677
763
|
To report issues with the client library, or request additional features, please open a GitHub issue [here](https://github.com/Azure/azure-sdk-for-js/issues)
|
|
678
764
|
|
|
679
|
-
|
|
765
|
+
## Next steps
|
|
680
766
|
|
|
681
|
-
Have a look at the [
|
|
767
|
+
Have a look at the [package samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples) folder, containing fully runnable code.
|
|
682
768
|
|
|
683
769
|
## Contributing
|
|
684
770
|
|
|
@@ -699,8 +785,6 @@ additional questions or comments.
|
|
|
699
785
|
|
|
700
786
|
<!-- LINKS -->
|
|
701
787
|
|
|
702
|
-
<!-- [samples]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples -->
|
|
703
|
-
|
|
704
788
|
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
|
|
705
789
|
[entra_id]: https://learn.microsoft.com/azure/ai-services/authentication?tabs=powershell#authenticate-with-microsoft-entra-id
|
|
706
790
|
[azure_identity_npm]: https://www.npmjs.com/package/@azure/identity
|