@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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Determines if the given output is of the specified type.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
6
|
+
* @typeParam T - The type to check against, which extends one of the possible output parent types.
|
|
7
7
|
* @param output - The action to check, which can be of type `RequiredActionOutput`, `RequiredToolCallOutput`, or `ToolDefinitionOutputParent`.
|
|
8
8
|
* @param type - The type to check the action against.
|
|
9
9
|
* @returns A boolean indicating whether the action is of the specified type.
|
|
@@ -17,14 +17,17 @@ export var connectionToolType;
|
|
|
17
17
|
/** Bing grounding search tool */
|
|
18
18
|
connectionToolType["BingGrounding"] = "bing_grounding";
|
|
19
19
|
/** Microsoft Fabric tool */
|
|
20
|
-
connectionToolType["MicrosoftFabric"] = "
|
|
20
|
+
connectionToolType["MicrosoftFabric"] = "fabric_dataagent";
|
|
21
21
|
/** Sharepoint tool */
|
|
22
22
|
connectionToolType["SharepointGrounding"] = "sharepoint_grounding";
|
|
23
|
+
/** Azure Function tool */
|
|
24
|
+
connectionToolType["AzureFunction"] = "azure_function";
|
|
23
25
|
})(connectionToolType || (connectionToolType = {}));
|
|
24
26
|
const toolMap = {
|
|
25
27
|
bing_grounding: "bingGrounding",
|
|
26
|
-
|
|
28
|
+
fabric_dataagent: "fabric_dataagent",
|
|
27
29
|
sharepoint_grounding: "sharepointGrounding",
|
|
30
|
+
azure_function: "azureFunction",
|
|
28
31
|
};
|
|
29
32
|
/**
|
|
30
33
|
* Utility class for creating various tools.
|
|
@@ -79,6 +82,29 @@ export class ToolUtility {
|
|
|
79
82
|
resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } },
|
|
80
83
|
};
|
|
81
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Creates an Azure Function tool
|
|
87
|
+
* @param name - The name of the Azure Function.
|
|
88
|
+
* @param description - The description of the Azure Function.
|
|
89
|
+
* @param parameters - The parameters of the Azure Function.
|
|
90
|
+
* @param inputQueue - The input queue configuration.
|
|
91
|
+
* @param outputQueue - The output queue configuration.
|
|
92
|
+
* @returns An object containing the definition and resources for the Azure Function tool.
|
|
93
|
+
*/
|
|
94
|
+
static createAzureFunctionTool(name, description, parameters, inputQueue, outputQueue, definitionDetails) {
|
|
95
|
+
return {
|
|
96
|
+
definition: { type: "azure_function", azureFunction: definitionDetails },
|
|
97
|
+
resources: {
|
|
98
|
+
azureFunction: {
|
|
99
|
+
name: name,
|
|
100
|
+
description: description,
|
|
101
|
+
parameters: parameters,
|
|
102
|
+
inputQueue: inputQueue,
|
|
103
|
+
outputQueue: outputQueue,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
82
108
|
/**
|
|
83
109
|
* Creates an Azure AI search tool
|
|
84
110
|
*
|
|
@@ -97,6 +123,22 @@ export class ToolUtility {
|
|
|
97
123
|
},
|
|
98
124
|
};
|
|
99
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Creates a Microsoft Fabric tool
|
|
128
|
+
*
|
|
129
|
+
* @param connectionIds - A list of the IDs of the Fabric connections to use.
|
|
130
|
+
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
131
|
+
*/
|
|
132
|
+
static createFabricTool(connectionId) {
|
|
133
|
+
return {
|
|
134
|
+
definition: {
|
|
135
|
+
type: "fabric_dataagent",
|
|
136
|
+
fabricDataAgent: {
|
|
137
|
+
connections: [{ connectionId: connectionId }],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
100
142
|
/**
|
|
101
143
|
* Creates a function tool
|
|
102
144
|
*
|
|
@@ -112,6 +154,21 @@ export class ToolUtility {
|
|
|
112
154
|
},
|
|
113
155
|
};
|
|
114
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Creates an OpenApi tool
|
|
159
|
+
*
|
|
160
|
+
* @param openApiFunctionDefinition - The OpenApi function definition to use.
|
|
161
|
+
*
|
|
162
|
+
* @returns An object containing the definition for the OpenApi tool.
|
|
163
|
+
*/
|
|
164
|
+
static createOpenApiTool(openApiFunctionDefinition) {
|
|
165
|
+
return {
|
|
166
|
+
definition: {
|
|
167
|
+
type: "openapi",
|
|
168
|
+
openapi: openApiFunctionDefinition,
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
115
172
|
}
|
|
116
173
|
/**
|
|
117
174
|
* Represents a set of tools with their definitions and resources.
|
|
@@ -179,5 +236,45 @@ export class ToolSet {
|
|
|
179
236
|
this.toolResources = Object.assign(Object.assign({}, this.toolResources), tool.resources);
|
|
180
237
|
return tool;
|
|
181
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Adds an OpenApi tool to the tool set.
|
|
241
|
+
*
|
|
242
|
+
* @param openApiFunctionDefinition - The OpenApi function definition to use.
|
|
243
|
+
*
|
|
244
|
+
* @returns An object containing the definition for the OpenApi tool
|
|
245
|
+
*/
|
|
246
|
+
addOpenApiTool(openApiFunctionDefinition) {
|
|
247
|
+
const tool = ToolUtility.createOpenApiTool(openApiFunctionDefinition);
|
|
248
|
+
this.toolDefinitions.push(tool.definition);
|
|
249
|
+
return tool;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Adds an Azure Function tool to the tool set.
|
|
253
|
+
*
|
|
254
|
+
* @param name - The name of the Azure Function.
|
|
255
|
+
* @param description - The description of the Azure Function.
|
|
256
|
+
* @param parameters - The parameters of the Azure Function.
|
|
257
|
+
* @param inputQueue - The input queue configuration.
|
|
258
|
+
* @param outputQueue - The output queue configuration.
|
|
259
|
+
*
|
|
260
|
+
* @returns An object containing the definition and resources for the Azure Function tool.
|
|
261
|
+
*/
|
|
262
|
+
addAzureFunctionTool(name, description, parameters, inputQueue, outputQueue, definitionDetails) {
|
|
263
|
+
const tool = ToolUtility.createAzureFunctionTool(name, description, parameters, inputQueue, outputQueue, definitionDetails);
|
|
264
|
+
this.toolDefinitions.push(tool.definition);
|
|
265
|
+
this.toolResources = Object.assign(Object.assign({}, this.toolResources), tool.resources);
|
|
266
|
+
return tool;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Adds a Microsoft Fabric tool to the tool set.
|
|
270
|
+
*
|
|
271
|
+
* @param connectionId - The ID of the Fabric connection to use.
|
|
272
|
+
* @returns An object containing the definition for the Microsoft Fabric tool
|
|
273
|
+
*/
|
|
274
|
+
addFabricTool(connectionId) {
|
|
275
|
+
const tool = ToolUtility.createFabricTool(connectionId);
|
|
276
|
+
this.toolDefinitions.push(tool.definition);
|
|
277
|
+
return tool;
|
|
278
|
+
}
|
|
182
279
|
}
|
|
183
280
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/agents/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAkBlC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAkF,EAClF,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC5B,iCAAiC;IACjC,sDAAgC,CAAA;IAChC,4BAA4B;IAC5B,0DAAoC,CAAA;IACpC,sBAAsB;IACtB,kEAA4C,CAAA;AAC9C,CAAC,EAPW,kBAAkB,KAAlB,kBAAkB,QAO7B;AAED,MAAM,OAAO,GAAG;IACd,cAAc,EAAE,eAAe;IAC/B,gBAAgB,EAAE,iBAAiB;IACnC,oBAAoB,EAAE,qBAAqB;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,WAAW;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACzB,QAA4B,EAC5B,aAAuB;QAEvB,OAAO;YACL,UAAU,EAAE;gBACV,IAA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G;IACH,oBAAoB,CAClB,iBAAyB,EACzB,SAAiB;QAEjB,MAAM,IAAI,GAAG,WAAW,CAAC,uBAAuB,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;QAC/E,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,CAAC,aAAa,mCAAQ,IAAI,CAAC,aAAa,GAAK,IAAI,CAAC,SAAS,CAAE,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AzureAISearchToolDefinition,\n CodeInterpreterToolDefinition,\n FileSearchToolDefinition,\n FileSearchToolDefinitionDetails,\n FunctionDefinition,\n FunctionToolDefinition,\n RequiredActionOutput,\n RequiredToolCallOutput,\n ToolDefinition,\n ToolDefinitionOutputParent,\n ToolResources,\n VectorStoreConfigurations,\n VectorStoreDataSource,\n} from \"./inputOutputs.js\";\n\n/**\n * Determines if the given output is of the specified type.\n *\n * @template T - The type to check against, which extends one of the possible output parent types.\n * @param output - The action to check, which can be of type `RequiredActionOutput`, `RequiredToolCallOutput`, or `ToolDefinitionOutputParent`.\n * @param type - The type to check the action against.\n * @returns A boolean indicating whether the action is of the specified type.\n */\nexport function isOutputOfType<T extends { type: string }>(\n output: RequiredActionOutput | RequiredToolCallOutput | ToolDefinitionOutputParent,\n type: string,\n): output is T {\n return output.type === type;\n}\n\n/** Types of connection tools used to configure an agent */\nexport enum connectionToolType {\n /** Bing grounding search tool */\n BingGrounding = \"bing_grounding\",\n /** Microsoft Fabric tool */\n MicrosoftFabric = \"microsoft_fabric\",\n /** Sharepoint tool */\n SharepointGrounding = \"sharepoint_grounding\",\n}\n\nconst toolMap = {\n bing_grounding: \"bingGrounding\",\n microsoft_fabric: \"microsoftFabric\",\n sharepoint_grounding: \"sharepointGrounding\",\n};\n\n/**\n * Utility class for creating various tools.\n */\nexport class ToolUtility {\n /**\n * Creates a connection tool\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n * @returns An object containing the definition for the connection tool\n */\n static createConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinition } {\n return {\n definition: {\n type: toolType,\n [toolMap[toolType]]: {\n connections: connectionIds.map((connectionId) => ({ connectionId: connectionId })),\n },\n },\n };\n }\n\n /**\n * Creates a file search tool\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n static createFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"file_search\", fileSearch: definitionDetails },\n resources: { fileSearch: { vectorStoreIds: vectorStoreIds, vectorStores: vectorStores } },\n };\n }\n\n /**\n * Creates a code interpreter tool\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool.\n */\n static createCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n if (fileIds && dataSources) {\n throw new Error(\"Cannot specify both fileIds and dataSources\");\n }\n\n return {\n definition: { type: \"code_interpreter\" },\n resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } },\n };\n }\n\n /**\n * Creates an Azure AI search tool\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool.\n */\n static createAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexes: [{ indexConnectionId: indexConnectionId, indexName: indexName }],\n },\n },\n };\n }\n\n /**\n * Creates a function tool\n *\n * @param functionDefinition - The function definition to use.\n *\n * @returns An object containing the definition for the function tool.\n */\n static createFunctionTool(functionDefinition: FunctionDefinition): {\n definition: FunctionToolDefinition;\n } {\n return {\n definition: {\n type: \"function\",\n function: functionDefinition,\n },\n };\n }\n}\n\n/**\n * Represents a set of tools with their definitions and resources.\n */\nexport class ToolSet {\n /** A list of tool definitions that have been added to the tool set. */\n toolDefinitions: ToolDefinition[] = [];\n\n /** A collection of resources associated with the tools in the tool set. */\n toolResources: ToolResources = {};\n\n /**\n * Adds a connection tool to the tool set.\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n *\n * @returns An object containing the definition for the connection tool\n */\n addConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinition } {\n const tool = ToolUtility.createConnectionTool(toolType, connectionIds);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a file search tool to the tool set.\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n addFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createFileSearchTool(vectorStoreIds, vectorStores, definitionDetails);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds a code interpreter tool to the tool set.\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool\n */\n addCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createCodeInterpreterTool(fileIds, dataSources);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an Azure AI search tool to the tool set.\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool\n */\n addAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createAzureAISearchTool(indexConnectionId, indexName);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/agents/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAuBlC;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAkF,EAClF,IAAY;IAEZ,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;AAC9B,CAAC;AAED,2DAA2D;AAC3D,MAAM,CAAN,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,iCAAiC;IACjC,sDAAgC,CAAA;IAChC,4BAA4B;IAC5B,0DAAoC,CAAA;IACpC,sBAAsB;IACtB,kEAA4C,CAAA;IAC5C,0BAA0B;IAC1B,sDAAgC,CAAA;AAClC,CAAC,EATW,kBAAkB,KAAlB,kBAAkB,QAS7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,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,CAAC,aAAa,mCAAQ,IAAI,CAAC,aAAa,GAAK,IAAI,CAAC,SAAS,CAAE,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,cAAc,CAAC,yBAAoD;QAGjE,MAAM,IAAI,GAAG,WAAW,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;QACtE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;OAUG;IACH,oBAAoB,CAClB,IAAY,EACZ,WAAmB,EACnB,UAAmB,EACnB,UAAqC,EACrC,WAAsC,EACtC,iBAA0C;QAE1C,MAAM,IAAI,GAAG,WAAW,CAAC,uBAAuB,CAC9C,IAAI,EACJ,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,CAClB,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,CAAC,aAAa,mCAAQ,IAAI,CAAC,aAAa,GAAK,IAAI,CAAC,SAAS,CAAE,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;;;;OAKG;IACH,aAAa,CAAC,YAAoB;QAChC,MAAM,IAAI,GAAG,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n AzureAISearchToolDefinition,\n AzureFunctionToolDefinition,\n CodeInterpreterToolDefinition,\n FileSearchToolDefinition,\n FileSearchToolDefinitionDetails,\n FunctionDefinition,\n FunctionToolDefinition,\n OpenApiFunctionDefinition,\n OpenApiToolDefinition,\n RequiredActionOutput,\n RequiredToolCallOutput,\n ToolDefinition,\n ToolDefinitionOutputParent,\n ToolResources,\n VectorStoreConfigurations,\n VectorStoreDataSource,\n AzureFunctionStorageQueue,\n AzureFunctionDefinition,\n} from \"./inputOutputs.js\";\n\n/**\n * Determines if the given output is of the specified type.\n *\n * @typeParam T - The type to check against, which extends one of the possible output parent types.\n * @param output - The action to check, which can be of type `RequiredActionOutput`, `RequiredToolCallOutput`, or `ToolDefinitionOutputParent`.\n * @param type - The type to check the action against.\n * @returns A boolean indicating whether the action is of the specified type.\n */\nexport function isOutputOfType<T extends { type: string }>(\n output: RequiredActionOutput | RequiredToolCallOutput | ToolDefinitionOutputParent,\n type: string,\n): output is T {\n return output.type === type;\n}\n\n/** Types of connection tools used to configure an agent */\nexport enum connectionToolType {\n /** Bing grounding search tool */\n BingGrounding = \"bing_grounding\",\n /** Microsoft Fabric tool */\n MicrosoftFabric = \"fabric_dataagent\",\n /** Sharepoint tool */\n SharepointGrounding = \"sharepoint_grounding\",\n /** Azure Function tool */\n AzureFunction = \"azure_function\",\n}\n\nconst toolMap = {\n bing_grounding: \"bingGrounding\",\n fabric_dataagent: \"fabric_dataagent\",\n sharepoint_grounding: \"sharepointGrounding\",\n azure_function: \"azureFunction\",\n};\n\n/**\n * Utility class for creating various tools.\n */\nexport class ToolUtility {\n /**\n * Creates a connection tool\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n * @returns An object containing the definition for the connection tool\n */\n static createConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinition } {\n return {\n definition: {\n type: toolType,\n [toolMap[toolType]]: {\n connections: connectionIds.map((connectionId) => ({ connectionId: connectionId })),\n },\n },\n };\n }\n\n /**\n * Creates a file search tool\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n static createFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"file_search\", fileSearch: definitionDetails },\n resources: { fileSearch: { vectorStoreIds: vectorStoreIds, vectorStores: vectorStores } },\n };\n }\n\n /**\n * Creates a code interpreter tool\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool.\n */\n static createCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n if (fileIds && dataSources) {\n throw new Error(\"Cannot specify both fileIds and dataSources\");\n }\n\n return {\n definition: { type: \"code_interpreter\" },\n resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } },\n };\n }\n\n /**\n * Creates an Azure Function tool\n * @param name - The name of the Azure Function.\n * @param description - The description of the Azure Function.\n * @param parameters - The parameters of the Azure Function.\n * @param inputQueue - The input queue configuration.\n * @param outputQueue - The output queue configuration.\n * @returns An object containing the definition and resources for the Azure Function tool.\n */\n static createAzureFunctionTool(\n name: string,\n description: string,\n parameters: unknown,\n inputQueue: AzureFunctionStorageQueue,\n outputQueue: AzureFunctionStorageQueue,\n definitionDetails: AzureFunctionDefinition,\n ): { definition: AzureFunctionToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_function\", azureFunction: definitionDetails },\n resources: {\n azureFunction: {\n name: name,\n description: description,\n parameters: parameters,\n inputQueue: inputQueue,\n outputQueue: outputQueue,\n },\n },\n };\n }\n /**\n * Creates an Azure AI search tool\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool.\n */\n static createAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n return {\n definition: { type: \"azure_ai_search\" },\n resources: {\n azureAISearch: {\n indexes: [{ indexConnectionId: indexConnectionId, indexName: indexName }],\n },\n },\n };\n }\n\n /**\n * Creates a Microsoft Fabric tool\n *\n * @param connectionIds - A list of the IDs of the Fabric connections to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n static createFabricTool(connectionId: string): { definition: ToolDefinition } {\n return {\n definition: {\n type: \"fabric_dataagent\",\n fabricDataAgent: {\n connections: [{ connectionId: connectionId }],\n },\n },\n };\n }\n\n /**\n * Creates a function tool\n *\n * @param functionDefinition - The function definition to use.\n *\n * @returns An object containing the definition for the function tool.\n */\n static createFunctionTool(functionDefinition: FunctionDefinition): {\n definition: FunctionToolDefinition;\n } {\n return {\n definition: {\n type: \"function\",\n function: functionDefinition,\n },\n };\n }\n\n /**\n * Creates an OpenApi tool\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool.\n */\n static createOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n return {\n definition: {\n type: \"openapi\",\n openapi: openApiFunctionDefinition,\n },\n };\n }\n}\n\n/**\n * Represents a set of tools with their definitions and resources.\n */\nexport class ToolSet {\n /** A list of tool definitions that have been added to the tool set. */\n toolDefinitions: ToolDefinition[] = [];\n\n /** A collection of resources associated with the tools in the tool set. */\n toolResources: ToolResources = {};\n\n /**\n * Adds a connection tool to the tool set.\n *\n * @param toolType - The type of the connection tool.\n * @param connectionIds - A list of the IDs of the connections to use.\n *\n * @returns An object containing the definition for the connection tool\n */\n addConnectionTool(\n toolType: connectionToolType,\n connectionIds: string[],\n ): { definition: ToolDefinition } {\n const tool = ToolUtility.createConnectionTool(toolType, connectionIds);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds a file search tool to the tool set.\n *\n * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent.\n * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool.\n * @param definitionDetails - The input definition information for a file search tool as used to configure an agent.\n *\n * @returns An object containing the definition and resources for the file search tool\n */\n addFileSearchTool(\n vectorStoreIds?: string[],\n vectorStores?: Array<VectorStoreConfigurations>,\n definitionDetails?: FileSearchToolDefinitionDetails,\n ): { definition: FileSearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createFileSearchTool(vectorStoreIds, vectorStores, definitionDetails);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds a code interpreter tool to the tool set.\n *\n * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool.\n * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds.\n *\n * @returns An object containing the definition and resources for the code interpreter tool\n */\n addCodeInterpreterTool(\n fileIds?: string[],\n dataSources?: Array<VectorStoreDataSource>,\n ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createCodeInterpreterTool(fileIds, dataSources);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an Azure AI search tool to the tool set.\n *\n * @param indexConnectionId - The connection ID of the Azure AI search index.\n * @param indexName - The name of the Azure AI search index.\n *\n * @returns An object containing the definition and resources for the Azure AI search tool\n */\n addAzureAISearchTool(\n indexConnectionId: string,\n indexName: string,\n ): { definition: AzureAISearchToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createAzureAISearchTool(indexConnectionId, indexName);\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n\n /**\n * Adds an OpenApi tool to the tool set.\n *\n * @param openApiFunctionDefinition - The OpenApi function definition to use.\n *\n * @returns An object containing the definition for the OpenApi tool\n */\n addOpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition): {\n definition: OpenApiToolDefinition;\n } {\n const tool = ToolUtility.createOpenApiTool(openApiFunctionDefinition);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n\n /**\n * Adds an Azure Function tool to the tool set.\n *\n * @param name - The name of the Azure Function.\n * @param description - The description of the Azure Function.\n * @param parameters - The parameters of the Azure Function.\n * @param inputQueue - The input queue configuration.\n * @param outputQueue - The output queue configuration.\n *\n * @returns An object containing the definition and resources for the Azure Function tool.\n */\n addAzureFunctionTool(\n name: string,\n description: string,\n parameters: unknown,\n inputQueue: AzureFunctionStorageQueue,\n outputQueue: AzureFunctionStorageQueue,\n definitionDetails: AzureFunctionDefinition,\n ): { definition: AzureFunctionToolDefinition; resources: ToolResources } {\n const tool = ToolUtility.createAzureFunctionTool(\n name,\n description,\n parameters,\n inputQueue,\n outputQueue,\n definitionDetails,\n );\n this.toolDefinitions.push(tool.definition);\n this.toolResources = { ...this.toolResources, ...tool.resources };\n return tool;\n }\n /**\n * Adds a Microsoft Fabric tool to the tool set.\n *\n * @param connectionId - The ID of the Fabric connection to use.\n * @returns An object containing the definition for the Microsoft Fabric tool\n */\n addFabricTool(connectionId: string): { definition: ToolDefinition } {\n const tool = ToolUtility.createFabricTool(connectionId);\n this.toolDefinitions.push(tool.definition);\n return tool;\n }\n}\n"]}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { Client } from "@azure-rest/core-client";
|
|
2
2
|
import type { OpenAIPageableListOfVectorStoreOutput, VectorStoreDeletionStatusOutput, VectorStoreOutput } from "../customization/outputModels.js";
|
|
3
|
-
import type { CreateVectorStoreWithPollingOptionalParams } from "./customModels.js";
|
|
4
3
|
import { type CreateVectorStoreOptionalParams, type DeleteVectorStoreOptionalParams, type GetVectorStoreOptionalParams, type ListVectorStoresOptionalParams, type UpdateVectorStoreOptionalParams } from "./customModels.js";
|
|
5
|
-
import type {
|
|
4
|
+
import type { OperationState, PollerLike } from "@azure/core-lro";
|
|
6
5
|
/** Returns a list of vector stores. */
|
|
7
6
|
export declare function listVectorStores(context: Client, options?: ListVectorStoresOptionalParams): Promise<OpenAIPageableListOfVectorStoreOutput>;
|
|
8
7
|
/** Creates a vector store. */
|
|
9
|
-
export declare function createVectorStore(context: Client, options?: CreateVectorStoreOptionalParams):
|
|
8
|
+
export declare function createVectorStore(context: Client, options?: CreateVectorStoreOptionalParams): PollerLike<OperationState<VectorStoreOutput>, VectorStoreOutput>;
|
|
10
9
|
/** Returns the vector store object matching the specified ID. */
|
|
11
10
|
export declare function getVectorStore(context: Client, vectorStoreId: string, options?: GetVectorStoreOptionalParams): Promise<VectorStoreOutput>;
|
|
12
11
|
/** The ID of the vector store to modify. */
|
|
@@ -16,5 +15,5 @@ export declare function deleteVectorStore(context: Client, vectorStoreId: string
|
|
|
16
15
|
/**
|
|
17
16
|
* Creates a vector store and poll.
|
|
18
17
|
*/
|
|
19
|
-
export declare function createVectorStoreAndPoll(context: Client, options?:
|
|
18
|
+
export declare function createVectorStoreAndPoll(context: Client, options?: CreateVectorStoreOptionalParams): PollerLike<OperationState<VectorStoreOutput>, VectorStoreOutput>;
|
|
20
19
|
//# sourceMappingURL=vectorStores.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vectorStores.d.ts","sourceRoot":"","sources":["../../../src/agents/vectorStores.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAOtD,OAAO,KAAK,EACV,qCAAqC,EACrC,+BAA+B,EAC/B,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,
|
|
1
|
+
{"version":3,"file":"vectorStores.d.ts","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5C,UAAU,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,CAWlE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { operationOptionsToRequestParameters } from "@azure-rest/core-client";
|
|
4
|
-
import {
|
|
4
|
+
import { createPoller } from "./poller.js";
|
|
5
5
|
import { validateLimit, validateMetadata, validateOrder, validateVectorStoreId, } from "./inputValidations.js";
|
|
6
6
|
import * as ConvertFromWire from "../customization/convertOutputModelsFromWire.js";
|
|
7
7
|
import * as ConvertToWire from "../customization/convertModelsToWrite.js";
|
|
@@ -19,14 +19,18 @@ export async function listVectorStores(context, options = {}) {
|
|
|
19
19
|
return ConvertFromWire.convertOpenAIPageableListOfVectorStoreOutput(result.body);
|
|
20
20
|
}
|
|
21
21
|
/** Creates a vector store. */
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
export function createVectorStore(context, options = {}) {
|
|
23
|
+
var _a;
|
|
24
|
+
return createPoller({
|
|
25
|
+
initOperation: async () => {
|
|
26
|
+
return createVectorStoreInternal(context, options);
|
|
27
|
+
},
|
|
28
|
+
pollOperation: async (currentResult) => {
|
|
29
|
+
return getVectorStore(context, currentResult.id, options);
|
|
30
|
+
},
|
|
31
|
+
getOperationStatus: getLroOperationStatus,
|
|
32
|
+
intervalInMs: (_a = options.pollingOptions) === null || _a === void 0 ? void 0 : _a.sleepIntervalInMs,
|
|
33
|
+
});
|
|
30
34
|
}
|
|
31
35
|
/** Returns the vector store object matching the specified ID. */
|
|
32
36
|
export async function getVectorStore(context, vectorStoreId, options = {}) {
|
|
@@ -69,25 +73,39 @@ export async function deleteVectorStore(context, vectorStoreId, options = {}) {
|
|
|
69
73
|
* Creates a vector store and poll.
|
|
70
74
|
*/
|
|
71
75
|
export function createVectorStoreAndPoll(context, options = {}) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
result: vectorStore,
|
|
83
|
-
completed: vectorStore.status !== "in_progress",
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return new AgentsPoller({
|
|
87
|
-
update: updateCreateVectorStorePoll,
|
|
88
|
-
pollingOptions: options.pollingOptions,
|
|
76
|
+
var _a;
|
|
77
|
+
return createPoller({
|
|
78
|
+
initOperation: async () => {
|
|
79
|
+
return createVectorStoreInternal(context, options);
|
|
80
|
+
},
|
|
81
|
+
pollOperation: async (currentResult) => {
|
|
82
|
+
return getVectorStore(context, currentResult.id, options);
|
|
83
|
+
},
|
|
84
|
+
getOperationStatus: getLroOperationStatus,
|
|
85
|
+
intervalInMs: (_a = options.pollingOptions) === null || _a === void 0 ? void 0 : _a.sleepIntervalInMs,
|
|
89
86
|
});
|
|
90
87
|
}
|
|
88
|
+
async function createVectorStoreInternal(context, options = {}) {
|
|
89
|
+
const createOptions = Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { body: ConvertToWire.convertVectorStoreOptions(options) });
|
|
90
|
+
validateCreateVectorStoreParameters(createOptions);
|
|
91
|
+
const result = await context.path("/vector_stores").post(createOptions);
|
|
92
|
+
if (!expectedStatuses.includes(result.status)) {
|
|
93
|
+
throw createOpenAIError(result);
|
|
94
|
+
}
|
|
95
|
+
return ConvertFromWire.convertVectorStoreOutput(result.body);
|
|
96
|
+
}
|
|
97
|
+
function getLroOperationStatus(result) {
|
|
98
|
+
switch (result.status) {
|
|
99
|
+
case "in_progress":
|
|
100
|
+
return "running";
|
|
101
|
+
case "completed":
|
|
102
|
+
return "succeeded";
|
|
103
|
+
case "expired":
|
|
104
|
+
return "failed";
|
|
105
|
+
default:
|
|
106
|
+
return "failed";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
91
109
|
function validateListVectorStoresParameters(options) {
|
|
92
110
|
var _a, _b;
|
|
93
111
|
if ((_a = options === null || options === void 0 ? void 0 : options.queryParameters) === null || _a === void 0 ? void 0 : _a.limit) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vectorStores.js","sourceRoot":"","sources":["../../../src/agents/vectorStores.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAW9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAS3C,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,eAAe,MAAM,iDAAiD,CAAC;AACnF,OAAO,KAAK,aAAa,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,CAAC;AAEjC,uCAAuC;AACvC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAe,EACf,UAA0C,EAAE;IAE5C,MAAM,WAAW,mCACZ,mCAAmC,CAAC,OAAO,CAAC,KAC/C,eAAe,EAAE,4BAA4B,CAAC,OAAO,CAAC,GACvD,CAAC;IAEF,kCAAkC,CAAC,WAAW,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAErE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9C,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,eAAe,CAAC,4CAA4C,CAAC,MAAM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AAE,QAAQ,EAAE,CAAC;QAC5B,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,SAAS,mCAAmC,CAAC,OAAqC;;IAChF,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,QAAQ,EAAE,CAAC;QAC5B,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client } from \"@azure-rest/core-client\";\nimport { operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type {\n ListVectorStoresParameters,\n CreateVectorStoreParameters,\n ModifyVectorStoreParameters,\n} from \"../generated/src/parameters.js\";\nimport type {\n OpenAIPageableListOfVectorStoreOutput,\n VectorStoreDeletionStatusOutput,\n VectorStoreOutput,\n} from \"../customization/outputModels.js\";\nimport { AgentsPoller } from \"./poller.js\";\nimport type { CreateVectorStoreWithPollingOptionalParams } from \"./customModels.js\";\nimport {\n type CreateVectorStoreOptionalParams,\n type DeleteVectorStoreOptionalParams,\n type GetVectorStoreOptionalParams,\n type ListVectorStoresOptionalParams,\n type UpdateVectorStoreOptionalParams,\n} from \"./customModels.js\";\nimport {\n validateLimit,\n validateMetadata,\n validateOrder,\n validateVectorStoreId,\n} from \"./inputValidations.js\";\nimport type * as GeneratedParameters from \"../generated/src/parameters.js\";\nimport * as ConvertFromWire from \"../customization/convertOutputModelsFromWire.js\";\nimport * as ConvertToWire from \"../customization/convertModelsToWrite.js\";\nimport { convertToListQueryParameters } from \"../customization/convertParametersToWire.js\";\nimport { createOpenAIError } from \"./openAIError.js\";\nimport type { PollerLike, PollOperationState } from \"@azure/core-lro\";\n\nconst expectedStatuses = [\"200\"];\n\n/** Returns a list of vector stores. */\nexport async function listVectorStores(\n context: Client,\n options: ListVectorStoresOptionalParams = {},\n): Promise<OpenAIPageableListOfVectorStoreOutput> {\n const listOptions: GeneratedParameters.ListVectorStoresParameters = {\n ...operationOptionsToRequestParameters(options),\n queryParameters: convertToListQueryParameters(options),\n };\n\n validateListVectorStoresParameters(listOptions);\n const result = await context.path(\"/vector_stores\").get(listOptions);\n\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertOpenAIPageableListOfVectorStoreOutput(result.body);\n}\n\n/** Creates a vector store. */\nexport async function createVectorStore(\n context: Client,\n options: CreateVectorStoreOptionalParams = {},\n): Promise<VectorStoreOutput> {\n const createOptions: GeneratedParameters.CreateVectorStoreParameters = {\n ...operationOptionsToRequestParameters(options),\n body: ConvertToWire.convertVectorStoreOptions(options),\n };\n\n validateCreateVectorStoreParameters(createOptions);\n const result = await context.path(\"/vector_stores\").post(createOptions);\n\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreOutput(result.body);\n}\n\n/** Returns the vector store object matching the specified ID. */\nexport async function getVectorStore(\n context: Client,\n vectorStoreId: string,\n options: GetVectorStoreOptionalParams = {},\n): Promise<VectorStoreOutput> {\n const getOptions: GeneratedParameters.GetVectorStoreParameters = {\n ...operationOptionsToRequestParameters(options),\n };\n\n validateVectorStoreId(vectorStoreId);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}\", vectorStoreId)\n .get(getOptions);\n\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreOutput(result.body);\n}\n\n/** The ID of the vector store to modify. */\nexport async function modifyVectorStore(\n context: Client,\n vectorStoreId: string,\n options: UpdateVectorStoreOptionalParams = {},\n): Promise<VectorStoreOutput> {\n const modifyOptions: GeneratedParameters.ModifyVectorStoreParameters = {\n ...operationOptionsToRequestParameters(options),\n body: ConvertToWire.convertVectorStoreUpdateOptions(options),\n };\n\n validateVectorStoreId(vectorStoreId);\n validateModifyVectorStoreParameters(modifyOptions);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}\", vectorStoreId)\n .post(modifyOptions);\n\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreOutput(result.body);\n}\n\n/** Deletes the vector store object matching the specified ID. */\nexport async function deleteVectorStore(\n context: Client,\n vectorStoreId: string,\n options: DeleteVectorStoreOptionalParams = {},\n): Promise<VectorStoreDeletionStatusOutput> {\n const deleteOptions: GeneratedParameters.DeleteVectorStoreParameters = {\n ...operationOptionsToRequestParameters(options),\n };\n\n validateVectorStoreId(vectorStoreId);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}\", vectorStoreId)\n .delete(deleteOptions);\n\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreDeletionStatusOutput(result.body);\n}\n\n/**\n * Creates a vector store and poll.\n */\nexport function createVectorStoreAndPoll(\n context: Client,\n options: CreateVectorStoreWithPollingOptionalParams = {},\n): PollerLike<PollOperationState<VectorStoreOutput>, VectorStoreOutput> {\n async function updateCreateVectorStorePoll(\n currentResult?: VectorStoreOutput,\n ): Promise<{ result: VectorStoreOutput; completed: boolean }> {\n let vectorStore: VectorStoreOutput;\n if (!currentResult) {\n vectorStore = await createVectorStore(context, options);\n } else {\n const getOptions: GetVectorStoreOptionalParams = {\n ...operationOptionsToRequestParameters(options),\n };\n vectorStore = await getVectorStore(context, currentResult.id, getOptions);\n }\n return {\n result: vectorStore,\n completed: vectorStore.status !== \"in_progress\",\n };\n }\n\n return new AgentsPoller<VectorStoreOutput>({\n update: updateCreateVectorStorePoll,\n pollingOptions: options.pollingOptions,\n });\n}\n\nfunction validateListVectorStoresParameters(options?: ListVectorStoresParameters): void {\n if (options?.queryParameters?.limit) {\n validateLimit(options.queryParameters.limit);\n }\n if (options?.queryParameters?.order) {\n validateOrder(options.queryParameters.order);\n }\n}\n\nfunction validateCreateVectorStoreParameters(options?: CreateVectorStoreParameters): void {\n if (\n options?.body?.chunking_strategy &&\n (!options.body.file_ids || options.body.file_ids.length === 0)\n ) {\n throw new Error(\"Chunking strategy is only applicable if fileIds is non-empty\");\n }\n if (options?.body?.metadata) {\n validateMetadata(options.body.metadata);\n }\n}\n\nfunction validateModifyVectorStoreParameters(options?: ModifyVectorStoreParameters): void {\n if (options?.body?.metadata) {\n validateMetadata(options.body.metadata);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"vectorStores.js","sourceRoot":"","sources":["../../../src/agents/vectorStores.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAW9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,eAAe,MAAM,iDAAiD,CAAC;AACnF,OAAO,KAAK,aAAa,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,CAAC;AAEjC,uCAAuC;AACvC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAe,EACf,UAA0C,EAAE;IAE5C,MAAM,WAAW,mCACZ,mCAAmC,CAAC,OAAO,CAAC,KAC/C,eAAe,EAAE,4BAA4B,CAAC,OAAO,CAAC,GACvD,CAAC;IAEF,kCAAkC,CAAC,WAAW,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAErE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE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AO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,0CAAE,KAAK,EAAE,CAAC;QACpC,aAAa,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,SAAS,mCAAmC,CAAC,OAAqC;;IAChF,IACE,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,iBAAiB;QAChC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,EAC9D,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,QAAQ,EAAE,CAAC;QAC5B,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,SAAS,mCAAmC,CAAC,OAAqC;;IAChF,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,QAAQ,EAAE,CAAC;QAC5B,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client } from \"@azure-rest/core-client\";\nimport { operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type {\n ListVectorStoresParameters,\n CreateVectorStoreParameters,\n ModifyVectorStoreParameters,\n} from \"../generated/src/parameters.js\";\nimport type {\n OpenAIPageableListOfVectorStoreOutput,\n VectorStoreDeletionStatusOutput,\n VectorStoreOutput,\n} from \"../customization/outputModels.js\";\nimport { createPoller } from \"./poller.js\";\nimport {\n type CreateVectorStoreOptionalParams,\n type DeleteVectorStoreOptionalParams,\n type GetVectorStoreOptionalParams,\n type ListVectorStoresOptionalParams,\n type UpdateVectorStoreOptionalParams,\n} from \"./customModels.js\";\nimport {\n validateLimit,\n validateMetadata,\n validateOrder,\n validateVectorStoreId,\n} from \"./inputValidations.js\";\nimport type * as GeneratedParameters from \"../generated/src/parameters.js\";\nimport * as ConvertFromWire from \"../customization/convertOutputModelsFromWire.js\";\nimport * as ConvertToWire from \"../customization/convertModelsToWrite.js\";\nimport { convertToListQueryParameters } from \"../customization/convertParametersToWire.js\";\nimport { createOpenAIError } from \"./openAIError.js\";\nimport type { OperationState, OperationStatus, PollerLike } from \"@azure/core-lro\";\n\nconst expectedStatuses = [\"200\"];\n\n/** Returns a list of vector stores. */\nexport async function listVectorStores(\n context: Client,\n options: ListVectorStoresOptionalParams = {},\n): Promise<OpenAIPageableListOfVectorStoreOutput> {\n const listOptions: GeneratedParameters.ListVectorStoresParameters = {\n ...operationOptionsToRequestParameters(options),\n queryParameters: convertToListQueryParameters(options),\n };\n\n validateListVectorStoresParameters(listOptions);\n const result = await context.path(\"/vector_stores\").get(listOptions);\n\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertOpenAIPageableListOfVectorStoreOutput(result.body);\n}\n\n/** Creates a vector store. */\nexport function createVectorStore(\n context: Client,\n options: CreateVectorStoreOptionalParams = {},\n): PollerLike<OperationState<VectorStoreOutput>, VectorStoreOutput> {\n return createPoller<VectorStoreOutput>({\n initOperation: async () => {\n return createVectorStoreInternal(context, options);\n },\n pollOperation: async (currentResult: VectorStoreOutput) => {\n return getVectorStore(context, currentResult.id, options);\n },\n getOperationStatus: getLroOperationStatus,\n intervalInMs: options.pollingOptions?.sleepIntervalInMs,\n });\n}\n\n/** Returns the vector store object matching the specified ID. */\nexport async function getVectorStore(\n context: Client,\n vectorStoreId: string,\n options: GetVectorStoreOptionalParams = {},\n): Promise<VectorStoreOutput> {\n const getOptions: GeneratedParameters.GetVectorStoreParameters = {\n ...operationOptionsToRequestParameters(options),\n };\n\n validateVectorStoreId(vectorStoreId);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}\", vectorStoreId)\n .get(getOptions);\n\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreOutput(result.body);\n}\n\n/** The ID of the vector store to modify. */\nexport async function modifyVectorStore(\n context: Client,\n vectorStoreId: string,\n options: UpdateVectorStoreOptionalParams = {},\n): Promise<VectorStoreOutput> {\n const modifyOptions: GeneratedParameters.ModifyVectorStoreParameters = {\n ...operationOptionsToRequestParameters(options),\n body: ConvertToWire.convertVectorStoreUpdateOptions(options),\n };\n\n validateVectorStoreId(vectorStoreId);\n validateModifyVectorStoreParameters(modifyOptions);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}\", vectorStoreId)\n .post(modifyOptions);\n\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreOutput(result.body);\n}\n\n/** Deletes the vector store object matching the specified ID. */\nexport async function deleteVectorStore(\n context: Client,\n vectorStoreId: string,\n options: DeleteVectorStoreOptionalParams = {},\n): Promise<VectorStoreDeletionStatusOutput> {\n const deleteOptions: GeneratedParameters.DeleteVectorStoreParameters = {\n ...operationOptionsToRequestParameters(options),\n };\n\n validateVectorStoreId(vectorStoreId);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}\", vectorStoreId)\n .delete(deleteOptions);\n\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreDeletionStatusOutput(result.body);\n}\n\n/**\n * Creates a vector store and poll.\n */\nexport function createVectorStoreAndPoll(\n context: Client,\n options: CreateVectorStoreOptionalParams = {},\n): PollerLike<OperationState<VectorStoreOutput>, VectorStoreOutput> {\n return createPoller<VectorStoreOutput>({\n initOperation: async () => {\n return createVectorStoreInternal(context, options);\n },\n pollOperation: async (currentResult: VectorStoreOutput) => {\n return getVectorStore(context, currentResult.id, options);\n },\n getOperationStatus: getLroOperationStatus,\n intervalInMs: options.pollingOptions?.sleepIntervalInMs,\n });\n}\n\nasync function createVectorStoreInternal(\n context: Client,\n options: CreateVectorStoreOptionalParams = {},\n): Promise<VectorStoreOutput> {\n const createOptions: GeneratedParameters.CreateVectorStoreParameters = {\n ...operationOptionsToRequestParameters(options),\n body: ConvertToWire.convertVectorStoreOptions(options),\n };\n\n validateCreateVectorStoreParameters(createOptions);\n const result = await context.path(\"/vector_stores\").post(createOptions);\n\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreOutput(result.body);\n}\n\nfunction getLroOperationStatus(result: VectorStoreOutput): OperationStatus {\n switch (result.status) {\n case \"in_progress\":\n return \"running\";\n case \"completed\":\n return \"succeeded\";\n case \"expired\":\n return \"failed\";\n default:\n return \"failed\";\n }\n}\n\nfunction validateListVectorStoresParameters(options?: ListVectorStoresParameters): void {\n if (options?.queryParameters?.limit) {\n validateLimit(options.queryParameters.limit);\n }\n if (options?.queryParameters?.order) {\n validateOrder(options.queryParameters.order);\n }\n}\n\nfunction validateCreateVectorStoreParameters(options?: CreateVectorStoreParameters): void {\n if (\n options?.body?.chunking_strategy &&\n (!options.body.file_ids || options.body.file_ids.length === 0)\n ) {\n throw new Error(\"Chunking strategy is only applicable if fileIds is non-empty\");\n }\n if (options?.body?.metadata) {\n validateMetadata(options.body.metadata);\n }\n}\n\nfunction validateModifyVectorStoreParameters(options?: ModifyVectorStoreParameters): void {\n if (options?.body?.metadata) {\n validateMetadata(options.body.metadata);\n }\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Client } from "@azure-rest/core-client";
|
|
2
2
|
import type { OpenAIPageableListOfVectorStoreFileOutput, VectorStoreFileBatchOutput } from "../customization/outputModels.js";
|
|
3
|
-
import type { CancelVectorStoreFileBatchOptionalParams, CreateVectorStoreFileBatchOptionalParams,
|
|
4
|
-
import type { PollerLike,
|
|
3
|
+
import type { CancelVectorStoreFileBatchOptionalParams, CreateVectorStoreFileBatchOptionalParams, GetVectorStoreFileBatchOptionalParams, ListVectorStoreFileBatchFilesOptionalParams } from "./customModels.js";
|
|
4
|
+
import type { PollerLike, OperationState } from "@azure/core-lro";
|
|
5
5
|
/** Create a vector store file batch. */
|
|
6
|
-
export declare function createVectorStoreFileBatch(context: Client, vectorStoreId: string, options?: CreateVectorStoreFileBatchOptionalParams):
|
|
6
|
+
export declare function createVectorStoreFileBatch(context: Client, vectorStoreId: string, options?: CreateVectorStoreFileBatchOptionalParams): PollerLike<OperationState<VectorStoreFileBatchOutput>, VectorStoreFileBatchOutput>;
|
|
7
7
|
/** Retrieve a vector store file batch. */
|
|
8
8
|
export declare function getVectorStoreFileBatch(context: Client, vectorStoreId: string, batchId: string, options?: GetVectorStoreFileBatchOptionalParams): Promise<VectorStoreFileBatchOutput>;
|
|
9
9
|
/** Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. */
|
|
@@ -11,5 +11,6 @@ export declare function cancelVectorStoreFileBatch(context: Client, vectorStoreI
|
|
|
11
11
|
/** Returns a list of vector store files in a batch. */
|
|
12
12
|
export declare function listVectorStoreFileBatchFiles(context: Client, vectorStoreId: string, batchId: string, options?: ListVectorStoreFileBatchFilesOptionalParams): Promise<OpenAIPageableListOfVectorStoreFileOutput>;
|
|
13
13
|
/** Create a vector store file batch and poll. */
|
|
14
|
-
export declare function createVectorStoreFileBatchAndPoll(context: Client, vectorStoreId: string, options?:
|
|
14
|
+
export declare function createVectorStoreFileBatchAndPoll(context: Client, vectorStoreId: string, options?: CreateVectorStoreFileBatchOptionalParams): PollerLike<OperationState<VectorStoreFileBatchOutput>, VectorStoreFileBatchOutput>;
|
|
15
|
+
export declare function createVectorStoreFileBatchInternal(context: Client, vectorStoreId: string, options?: CreateVectorStoreFileBatchOptionalParams): Promise<VectorStoreFileBatchOutput>;
|
|
15
16
|
//# sourceMappingURL=vectorStoresFileBatches.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vectorStoresFileBatches.d.ts","sourceRoot":"","sources":["../../../src/agents/vectorStoresFileBatches.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EACV,yCAAyC,EACzC,0BAA0B,EAC3B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EACV,wCAAwC,EACxC,wCAAwC,EACxC,
|
|
1
|
+
{"version":3,"file":"vectorStoresFileBatches.d.ts","sourceRoot":"","sources":["../../../src/agents/vectorStoresFileBatches.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EACV,yCAAyC,EACzC,0BAA0B,EAC3B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EACV,wCAAwC,EACxC,wCAAwC,EACxC,qCAAqC,EACrC,2CAA2C,EAC5C,MAAM,mBAAmB,CAAC;AAc3B,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAmB,MAAM,iBAAiB,CAAC;AAInF,wCAAwC;AACxC,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,wCAA6C,GACrD,UAAU,CAAC,cAAc,CAAC,0BAA0B,CAAC,EAAE,0BAA0B,CAAC,CAWpF;AAED,0CAA0C;AAC1C,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,0BAA0B,CAAC,CASrC;AAED,2HAA2H;AAC3H,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,wCAA6C,GACrD,OAAO,CAAC,0BAA0B,CAAC,CASrC;AAED,uDAAuD;AACvD,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,2CAAgD,GACxD,OAAO,CAAC,yCAAyC,CAAC,CAkBpD;AAED,iDAAiD;AACjD,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,wCAA6C,GACrD,UAAU,CAAC,cAAc,CAAC,0BAA0B,CAAC,EAAE,0BAA0B,CAAC,CAWpF;AAED,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,wCAA6C,GACrD,OAAO,CAAC,0BAA0B,CAAC,CAerC"}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { operationOptionsToRequestParameters } from "@azure-rest/core-client";
|
|
4
|
-
import {
|
|
4
|
+
import { createPoller } from "./poller.js";
|
|
5
5
|
import { validateFileStatusFilter, validateLimit, validateOrder, validateVectorStoreId, } from "./inputValidations.js";
|
|
6
6
|
import * as ConvertFromWire from "../customization/convertOutputModelsFromWire.js";
|
|
7
7
|
import * as ConvertParamsToWire from "../customization/convertParametersToWire.js";
|
|
8
8
|
import { createOpenAIError } from "./openAIError.js";
|
|
9
9
|
const expectedStatuses = ["200"];
|
|
10
10
|
/** Create a vector store file batch. */
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
export function createVectorStoreFileBatch(context, vectorStoreId, options = {}) {
|
|
12
|
+
var _a;
|
|
13
|
+
return createPoller({
|
|
14
|
+
initOperation: async () => {
|
|
15
|
+
return createVectorStoreFileBatchInternal(context, vectorStoreId, options);
|
|
16
|
+
},
|
|
17
|
+
pollOperation: async (currentResult) => {
|
|
18
|
+
return getVectorStoreFileBatch(context, vectorStoreId, currentResult.id, options);
|
|
19
|
+
},
|
|
20
|
+
getOperationStatus: getLroOperationStatus,
|
|
21
|
+
intervalInMs: (_a = options.pollingOptions) === null || _a === void 0 ? void 0 : _a.sleepIntervalInMs,
|
|
22
|
+
});
|
|
22
23
|
}
|
|
23
24
|
/** Retrieve a vector store file batch. */
|
|
24
25
|
export async function getVectorStoreFileBatch(context, vectorStoreId, batchId, options = {}) {
|
|
@@ -58,28 +59,41 @@ export async function listVectorStoreFileBatchFiles(context, vectorStoreId, batc
|
|
|
58
59
|
}
|
|
59
60
|
/** Create a vector store file batch and poll. */
|
|
60
61
|
export function createVectorStoreFileBatchAndPoll(context, vectorStoreId, options = {}) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
var _a;
|
|
63
|
+
return createPoller({
|
|
64
|
+
initOperation: async () => {
|
|
65
|
+
return createVectorStoreFileBatchInternal(context, vectorStoreId, options);
|
|
66
|
+
},
|
|
67
|
+
pollOperation: async (currentResult) => {
|
|
68
|
+
return getVectorStoreFileBatch(context, vectorStoreId, currentResult.id, options);
|
|
69
|
+
},
|
|
70
|
+
getOperationStatus: getLroOperationStatus,
|
|
71
|
+
intervalInMs: (_a = options.pollingOptions) === null || _a === void 0 ? void 0 : _a.sleepIntervalInMs,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export async function createVectorStoreFileBatchInternal(context, vectorStoreId, options = {}) {
|
|
75
|
+
const createOptions = Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), ConvertParamsToWire.convertCreateVectorStoreFileBatchParam({ body: options }));
|
|
76
|
+
validateVectorStoreId(vectorStoreId);
|
|
77
|
+
validateCreateVectorStoreFileBatchParameters(createOptions);
|
|
78
|
+
const result = await context
|
|
79
|
+
.path("/vector_stores/{vectorStoreId}/file_batches", vectorStoreId)
|
|
80
|
+
.post(createOptions);
|
|
81
|
+
if (!expectedStatuses.includes(result.status)) {
|
|
82
|
+
throw createOpenAIError(result);
|
|
73
83
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
84
|
+
return ConvertFromWire.convertVectorStoreFileBatchOutput(result.body);
|
|
85
|
+
}
|
|
86
|
+
function getLroOperationStatus(result) {
|
|
87
|
+
switch (result.status) {
|
|
88
|
+
case "in_progress":
|
|
89
|
+
return "running";
|
|
90
|
+
case "completed":
|
|
91
|
+
return "succeeded";
|
|
92
|
+
case "cancelled":
|
|
93
|
+
return "canceled";
|
|
94
|
+
default:
|
|
95
|
+
return "failed";
|
|
77
96
|
}
|
|
78
|
-
return new AgentsPoller({
|
|
79
|
-
update: updateCreateVectorStoreFileBatchPoll,
|
|
80
|
-
cancel: cancelCreateVectorStoreFileBatchPoll,
|
|
81
|
-
pollingOptions: options.pollingOptions,
|
|
82
|
-
});
|
|
83
97
|
}
|
|
84
98
|
function validateBatchId(batchId) {
|
|
85
99
|
if (!batchId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vectorStoresFileBatches.js","sourceRoot":"","sources":["../../../src/agents/vectorStoresFileBatches.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAK9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,eAAe,MAAM,iDAAiD,CAAC;AACnF,OAAO,KAAK,mB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CAAC,EAC9D,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;AACH,CAAC;AAED,SAAS,+CAA+C,CACtD,OAAiD;;IAEjD,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,0CAAE,MAAM,EAAE,CAAC;QACrC,wBAAwB,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,0CAAE,KAAK,EAAE,CAAC;QACpC,aAAa,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,0CAAE,KAAK,EAAE,CAAC;QACpC,aAAa,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client } from \"@azure-rest/core-client\";\nimport { operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type {\n OpenAIPageableListOfVectorStoreFileOutput,\n VectorStoreFileBatchOutput,\n} from \"../customization/outputModels.js\";\nimport { AgentsPoller } from \"./poller.js\";\nimport type {\n CancelVectorStoreFileBatchOptionalParams,\n CreateVectorStoreFileBatchOptionalParams,\n CreateVectorStoreFileBatchWithPollingOptionalParams,\n GetVectorStoreFileBatchOptionalParams,\n ListVectorStoreFileBatchFilesOptionalParams,\n} from \"./customModels.js\";\nimport {\n validateFileStatusFilter,\n validateLimit,\n validateOrder,\n validateVectorStoreId,\n} from \"./inputValidations.js\";\nimport type {\n CreateVectorStoreFileBatchParameters,\n ListVectorStoreFileBatchFilesParameters,\n} from \"../generated/src/parameters.js\";\nimport * as ConvertFromWire from \"../customization/convertOutputModelsFromWire.js\";\nimport * as ConvertParamsToWire from \"../customization/convertParametersToWire.js\";\nimport { createOpenAIError } from \"./openAIError.js\";\nimport type { PollerLike, PollOperationState } from \"@azure/core-lro\";\n\nconst expectedStatuses = [\"200\"];\n\n/** Create a vector store file batch. */\nexport async function createVectorStoreFileBatch(\n context: Client,\n vectorStoreId: string,\n options: CreateVectorStoreFileBatchOptionalParams = {},\n): Promise<VectorStoreFileBatchOutput> {\n const createOptions: CreateVectorStoreFileBatchParameters = {\n ...operationOptionsToRequestParameters(options),\n ...ConvertParamsToWire.convertCreateVectorStoreFileBatchParam({ body: options }),\n };\n\n validateVectorStoreId(vectorStoreId);\n validateCreateVectorStoreFileBatchParameters(createOptions);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}/file_batches\", vectorStoreId)\n .post(createOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreFileBatchOutput(result.body);\n}\n\n/** Retrieve a vector store file batch. */\nexport async function getVectorStoreFileBatch(\n context: Client,\n vectorStoreId: string,\n batchId: string,\n options: GetVectorStoreFileBatchOptionalParams = {},\n): Promise<VectorStoreFileBatchOutput> {\n validateVectorStoreId(vectorStoreId);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}/file_batches/{batchId}\", vectorStoreId, batchId)\n .get(options);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreFileBatchOutput(result.body);\n}\n\n/** Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. */\nexport async function cancelVectorStoreFileBatch(\n context: Client,\n vectorStoreId: string,\n batchId: string,\n options: CancelVectorStoreFileBatchOptionalParams = {},\n): Promise<VectorStoreFileBatchOutput> {\n validateVectorStoreId(vectorStoreId);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}/file_batches/{batchId}/cancel\", vectorStoreId, batchId)\n .post(options);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreFileBatchOutput(result.body);\n}\n\n/** Returns a list of vector store files in a batch. */\nexport async function listVectorStoreFileBatchFiles(\n context: Client,\n vectorStoreId: string,\n batchId: string,\n options: ListVectorStoreFileBatchFilesOptionalParams = {},\n): Promise<OpenAIPageableListOfVectorStoreFileOutput> {\n const listOptions: ListVectorStoreFileBatchFilesParameters = {\n ...operationOptionsToRequestParameters(options),\n queryParameters: ConvertParamsToWire.convertListVectorStoreFileBatchFilesQueryParamProperties(\n options,\n ) as Record<string, string>,\n };\n\n validateVectorStoreId(vectorStoreId);\n validateBatchId(batchId);\n validateListVectorStoreFileBatchFilesParameters(listOptions);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}/file_batches/{batchId}/files\", vectorStoreId, batchId)\n .get(listOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertOpenAIPageableListOfVectorStoreFileOutput(result.body);\n}\n\n/** Create a vector store file batch and poll. */\nexport function createVectorStoreFileBatchAndPoll(\n context: Client,\n vectorStoreId: string,\n options: CreateVectorStoreFileBatchWithPollingOptionalParams = {},\n): PollerLike<PollOperationState<VectorStoreFileBatchOutput>, VectorStoreFileBatchOutput> {\n async function updateCreateVectorStoreFileBatchPoll(\n currentResult?: VectorStoreFileBatchOutput,\n ): Promise<{ result: VectorStoreFileBatchOutput; completed: boolean }> {\n let vectorStore: VectorStoreFileBatchOutput;\n if (!currentResult) {\n vectorStore = await createVectorStoreFileBatch(context, vectorStoreId, options);\n } else {\n vectorStore = await getVectorStoreFileBatch(\n context,\n vectorStoreId,\n currentResult.id,\n options,\n );\n }\n return {\n result: vectorStore,\n completed: vectorStore.status !== \"in_progress\",\n };\n }\n\n async function cancelCreateVectorStoreFileBatchPoll(\n currentResult: VectorStoreFileBatchOutput,\n ): Promise<boolean> {\n const result = await cancelVectorStoreFileBatch(context, vectorStoreId, currentResult.id);\n return result.status === \"cancelled\";\n }\n\n return new AgentsPoller<VectorStoreFileBatchOutput>({\n update: updateCreateVectorStoreFileBatchPoll,\n cancel: cancelCreateVectorStoreFileBatchPoll,\n pollingOptions: options.pollingOptions,\n });\n}\n\nfunction validateBatchId(batchId: string): void {\n if (!batchId) {\n throw new Error(\"Batch ID is required\");\n }\n}\n\nfunction validateCreateVectorStoreFileBatchParameters(\n options?: CreateVectorStoreFileBatchParameters,\n): void {\n if (\n options?.body?.chunking_strategy &&\n (!options.body.file_ids || options.body.file_ids.length === 0)\n ) {\n throw new Error(\"Chunking strategy is only applicable if fileIds are included\");\n }\n}\n\nfunction validateListVectorStoreFileBatchFilesParameters(\n options?: ListVectorStoreFileBatchFilesParameters,\n): void {\n if (options?.queryParameters?.filter) {\n validateFileStatusFilter(options.queryParameters.filter);\n }\n if (options?.queryParameters?.limit) {\n validateLimit(options.queryParameters.limit);\n }\n if (options?.queryParameters?.order) {\n validateOrder(options.queryParameters.order);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"vectorStoresFileBatches.js","sourceRoot":"","sources":["../../../src/agents/vectorStoresFileBatches.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAK9E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,eAAe,MAAM,iDAAiD,CAAC;AACnF,OAAO,KAAK,mBAAmB,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,CAAC;AAEjC,wCAAwC;AACxC,MAAM,UAAU,0BAA0B,CACxC,OAAe,EACf,aAAqB,EACrB,UAAoD,EAAE;;IAEtD,OAAO,YAAY,CAA6B;QAC9C,aAAa,EAAE,KAAK,IAAI,EAAE;YAC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,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,EAC9D,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;AACH,CAAC;AAED,SAAS,+CAA+C,CACtD,OAAiD;;IAEjD,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,0CAAE,MAAM,EAAE,CAAC;QACrC,wBAAwB,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,0CAAE,KAAK,EAAE,CAAC;QACpC,aAAa,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,0CAAE,KAAK,EAAE,CAAC;QACpC,aAAa,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client } from \"@azure-rest/core-client\";\nimport { operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\nimport type {\n OpenAIPageableListOfVectorStoreFileOutput,\n VectorStoreFileBatchOutput,\n} from \"../customization/outputModels.js\";\nimport { createPoller } from \"./poller.js\";\nimport type {\n CancelVectorStoreFileBatchOptionalParams,\n CreateVectorStoreFileBatchOptionalParams,\n GetVectorStoreFileBatchOptionalParams,\n ListVectorStoreFileBatchFilesOptionalParams,\n} from \"./customModels.js\";\nimport {\n validateFileStatusFilter,\n validateLimit,\n validateOrder,\n validateVectorStoreId,\n} from \"./inputValidations.js\";\nimport type {\n CreateVectorStoreFileBatchParameters,\n ListVectorStoreFileBatchFilesParameters,\n} from \"../generated/src/parameters.js\";\nimport * as ConvertFromWire from \"../customization/convertOutputModelsFromWire.js\";\nimport * as ConvertParamsToWire from \"../customization/convertParametersToWire.js\";\nimport { createOpenAIError } from \"./openAIError.js\";\nimport type { PollerLike, OperationState, OperationStatus } from \"@azure/core-lro\";\n\nconst expectedStatuses = [\"200\"];\n\n/** Create a vector store file batch. */\nexport function createVectorStoreFileBatch(\n context: Client,\n vectorStoreId: string,\n options: CreateVectorStoreFileBatchOptionalParams = {},\n): PollerLike<OperationState<VectorStoreFileBatchOutput>, VectorStoreFileBatchOutput> {\n return createPoller<VectorStoreFileBatchOutput>({\n initOperation: async () => {\n return createVectorStoreFileBatchInternal(context, vectorStoreId, options);\n },\n pollOperation: async (currentResult: VectorStoreFileBatchOutput) => {\n return getVectorStoreFileBatch(context, vectorStoreId, currentResult.id, options);\n },\n getOperationStatus: getLroOperationStatus,\n intervalInMs: options.pollingOptions?.sleepIntervalInMs,\n });\n}\n\n/** Retrieve a vector store file batch. */\nexport async function getVectorStoreFileBatch(\n context: Client,\n vectorStoreId: string,\n batchId: string,\n options: GetVectorStoreFileBatchOptionalParams = {},\n): Promise<VectorStoreFileBatchOutput> {\n validateVectorStoreId(vectorStoreId);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}/file_batches/{batchId}\", vectorStoreId, batchId)\n .get(options);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreFileBatchOutput(result.body);\n}\n\n/** Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. */\nexport async function cancelVectorStoreFileBatch(\n context: Client,\n vectorStoreId: string,\n batchId: string,\n options: CancelVectorStoreFileBatchOptionalParams = {},\n): Promise<VectorStoreFileBatchOutput> {\n validateVectorStoreId(vectorStoreId);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}/file_batches/{batchId}/cancel\", vectorStoreId, batchId)\n .post(options);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreFileBatchOutput(result.body);\n}\n\n/** Returns a list of vector store files in a batch. */\nexport async function listVectorStoreFileBatchFiles(\n context: Client,\n vectorStoreId: string,\n batchId: string,\n options: ListVectorStoreFileBatchFilesOptionalParams = {},\n): Promise<OpenAIPageableListOfVectorStoreFileOutput> {\n const listOptions: ListVectorStoreFileBatchFilesParameters = {\n ...operationOptionsToRequestParameters(options),\n queryParameters: ConvertParamsToWire.convertListVectorStoreFileBatchFilesQueryParamProperties(\n options,\n ) as Record<string, string>,\n };\n\n validateVectorStoreId(vectorStoreId);\n validateBatchId(batchId);\n validateListVectorStoreFileBatchFilesParameters(listOptions);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}/file_batches/{batchId}/files\", vectorStoreId, batchId)\n .get(listOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertOpenAIPageableListOfVectorStoreFileOutput(result.body);\n}\n\n/** Create a vector store file batch and poll. */\nexport function createVectorStoreFileBatchAndPoll(\n context: Client,\n vectorStoreId: string,\n options: CreateVectorStoreFileBatchOptionalParams = {},\n): PollerLike<OperationState<VectorStoreFileBatchOutput>, VectorStoreFileBatchOutput> {\n return createPoller<VectorStoreFileBatchOutput>({\n initOperation: async () => {\n return createVectorStoreFileBatchInternal(context, vectorStoreId, options);\n },\n pollOperation: async (currentResult: VectorStoreFileBatchOutput) => {\n return getVectorStoreFileBatch(context, vectorStoreId, currentResult.id, options);\n },\n getOperationStatus: getLroOperationStatus,\n intervalInMs: options.pollingOptions?.sleepIntervalInMs,\n });\n}\n\nexport async function createVectorStoreFileBatchInternal(\n context: Client,\n vectorStoreId: string,\n options: CreateVectorStoreFileBatchOptionalParams = {},\n): Promise<VectorStoreFileBatchOutput> {\n const createOptions: CreateVectorStoreFileBatchParameters = {\n ...operationOptionsToRequestParameters(options),\n ...ConvertParamsToWire.convertCreateVectorStoreFileBatchParam({ body: options }),\n };\n\n validateVectorStoreId(vectorStoreId);\n validateCreateVectorStoreFileBatchParameters(createOptions);\n const result = await context\n .path(\"/vector_stores/{vectorStoreId}/file_batches\", vectorStoreId)\n .post(createOptions);\n if (!expectedStatuses.includes(result.status)) {\n throw createOpenAIError(result);\n }\n return ConvertFromWire.convertVectorStoreFileBatchOutput(result.body);\n}\n\nfunction getLroOperationStatus(result: VectorStoreFileBatchOutput): OperationStatus {\n switch (result.status) {\n case \"in_progress\":\n return \"running\";\n case \"completed\":\n return \"succeeded\";\n case \"cancelled\":\n return \"canceled\";\n default:\n return \"failed\";\n }\n}\n\nfunction validateBatchId(batchId: string): void {\n if (!batchId) {\n throw new Error(\"Batch ID is required\");\n }\n}\n\nfunction validateCreateVectorStoreFileBatchParameters(\n options?: CreateVectorStoreFileBatchParameters,\n): void {\n if (\n options?.body?.chunking_strategy &&\n (!options.body.file_ids || options.body.file_ids.length === 0)\n ) {\n throw new Error(\"Chunking strategy is only applicable if fileIds are included\");\n }\n}\n\nfunction validateListVectorStoreFileBatchFilesParameters(\n options?: ListVectorStoreFileBatchFilesParameters,\n): void {\n if (options?.queryParameters?.filter) {\n validateFileStatusFilter(options.queryParameters.filter);\n }\n if (options?.queryParameters?.limit) {\n validateLimit(options.queryParameters.limit);\n }\n if (options?.queryParameters?.order) {\n validateOrder(options.queryParameters.order);\n }\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Client } from "@azure-rest/core-client";
|
|
2
2
|
import type { OpenAIPageableListOfVectorStoreFileOutput, VectorStoreFileDeletionStatusOutput, VectorStoreFileOutput } from "../customization/outputModels.js";
|
|
3
|
-
import type { CreateVectorStoreFileOptionalParams,
|
|
4
|
-
import type {
|
|
3
|
+
import type { CreateVectorStoreFileOptionalParams, DeleteVectorStoreFileOptionalParams, GetVectorStoreFileOptionalParams, ListVectorStoreFilesOptionalParams } from "./customModels.js";
|
|
4
|
+
import type { OperationState, PollerLike } from "@azure/core-lro";
|
|
5
5
|
/** Returns a list of vector store files. */
|
|
6
6
|
export declare function listVectorStoreFiles(context: Client, vectorStoreId: string, options?: ListVectorStoreFilesOptionalParams): Promise<OpenAIPageableListOfVectorStoreFileOutput>;
|
|
7
7
|
/** Create a vector store file by attaching a file to a vector store. */
|
|
8
|
-
export declare function createVectorStoreFile(context: Client, vectorStoreId: string, options?: CreateVectorStoreFileOptionalParams):
|
|
8
|
+
export declare function createVectorStoreFile(context: Client, vectorStoreId: string, options?: CreateVectorStoreFileOptionalParams): PollerLike<OperationState<VectorStoreFileOutput>, VectorStoreFileOutput>;
|
|
9
9
|
/** Retrieves a vector store file. */
|
|
10
10
|
export declare function getVectorStoreFile(context: Client, vectorStoreId: string, fileId: string, options?: GetVectorStoreFileOptionalParams): Promise<VectorStoreFileOutput>;
|
|
11
11
|
/**
|
|
@@ -14,5 +14,5 @@ export declare function getVectorStoreFile(context: Client, vectorStoreId: strin
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function deleteVectorStoreFile(context: Client, vectorStoreId: string, fileId: string, options?: DeleteVectorStoreFileOptionalParams): Promise<VectorStoreFileDeletionStatusOutput>;
|
|
16
16
|
/** Create a vector store file by attaching a file to a vector store and poll. */
|
|
17
|
-
export declare function createVectorStoreFileAndPoll(context: Client, vectorStoreId: string, options?:
|
|
17
|
+
export declare function createVectorStoreFileAndPoll(context: Client, vectorStoreId: string, options?: CreateVectorStoreFileOptionalParams): PollerLike<OperationState<VectorStoreFileOutput>, VectorStoreFileOutput>;
|
|
18
18
|
//# sourceMappingURL=vectorStoresFiles.d.ts.map
|