-
Notifications
You must be signed in to change notification settings - Fork 854
chore: Remove deprecated Bing Search APIs and refactor dependent tests #2451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Hey @BrendanWalsh 👋! We use semantic commit messages to streamline the release process. Examples of commit messages with semantic prefixes:
To test your commit locally, please follow our guild on building from source. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR removes the deprecated BingImageSearch and related components following the retirement of Bing Search API v7. The removal includes Scala and Python implementations, test files, and associated schemas. Tests that previously relied on BingImageSearch for downloading images have been refactored to use a new downloadBytes utility function with static datasets.
Key Changes:
- Removed deprecated Bing Search components (BingImageSearch, ImageSearchSchemas, ImageSearchSuite)
- Introduced
VisionUtilsand enhancedFormRecognizerUtilstraits withdownloadBytesfunctionality to replace BingImageSearch download capabilities - Refactored test suites to use direct HTTP downloads instead of the deprecated BingImageSearch API
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/test/scala/com/microsoft/azure/synapse/ml/Secrets.scala | Removed BingSearchKey secret reference |
| core/src/main/scala/com/microsoft/azure/synapse/ml/logging/FeatureNames.scala | Removed BingImage feature name from AI Services |
| cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/vision/ComputerVisionSuite.scala | Added VisionUtils trait with downloadBytes functionality; refactored all vision test suites to use new download approach |
| cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/form/FormRecognizerSuite.scala | Added downloadBytes utility to FormRecognizerUtils; simplified createTestDataframe with default parameter |
| cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/bing/ImageSearchSuite.scala | Deleted entire test suite for deprecated BingImageSearch |
| cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/bing/ImageSearchSchemas.scala | Deleted schema definitions for BingImageSearch API |
| cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/bing/BingImageSearch.scala | Deleted main BingImageSearch implementation |
| cognitive/src/main/python/synapse/ml/services/bing/BingImageSearch.py | Deleted Python wrapper for BingImageSearch |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
|
|
||
|
|
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Excessive whitespace: Multiple blank lines (2) before override def testObjects(). Consider reducing to a single blank line to maintain consistency.
cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/form/FormRecognizerSuite.scala
Outdated
Show resolved
Hide resolved
cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/form/FormRecognizerSuite.scala
Outdated
Show resolved
Hide resolved
cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/form/FormRecognizerSuite.scala
Outdated
Show resolved
Hide resolved
...tive/src/test/scala/com/microsoft/azure/synapse/ml/services/vision/ComputerVisionSuite.scala
Outdated
Show resolved
Hide resolved
...tive/src/test/scala/com/microsoft/azure/synapse/ml/services/vision/ComputerVisionSuite.scala
Outdated
Show resolved
Hide resolved
| def downloadBytes(url: String): Array[Byte] = { | ||
| val request = new HttpGet(url) | ||
| using(RESTHelpers.Client.execute(request)) { response => | ||
| IOUtils.toByteArray(response.getEntity.getContent) | ||
| }.get | ||
| } | ||
|
|
||
| val downloadBytesUdf = udf(downloadBytes _) |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code duplication: The downloadBytes function and downloadBytesUdf are defined identically in both VisionUtils trait (ComputerVisionSuite.scala) and FormRecognizerUtils trait (FormRecognizerSuite.scala). Consider extracting this into a shared test utility trait to avoid duplication and ensure consistency.
|
|
||
| import com.microsoft.azure.synapse.ml.services.CognitiveKey | ||
|
|
||
| trait VisionUtils extends TestBase { | ||
| import spark.implicits._ | ||
|
|
||
| def downloadBytes(url: String): Array[Byte] = { | ||
| val request = new HttpGet(url) | ||
| using(RESTHelpers.Client.execute(request)) { response => | ||
| IOUtils.toByteArray(response.getEntity.getContent) | ||
| }.get |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Error handling: The .get call on the Try returned by using will throw an exception if the HTTP request or byte array conversion fails. Consider adding explicit error handling or documenting that test failures due to network issues are expected, especially since this replaces the previous BingImageSearch.downloadFromUrls which may have had retry logic.
| import com.microsoft.azure.synapse.ml.services.CognitiveKey | |
| trait VisionUtils extends TestBase { | |
| import spark.implicits._ | |
| def downloadBytes(url: String): Array[Byte] = { | |
| val request = new HttpGet(url) | |
| using(RESTHelpers.Client.execute(request)) { response => | |
| IOUtils.toByteArray(response.getEntity.getContent) | |
| }.get | |
| import org.apache.log4j.Logger | |
| import com.microsoft.azure.synapse.ml.services.CognitiveKey | |
| trait VisionUtils extends TestBase { | |
| import spark.implicits._ | |
| // Downloads bytes from a URL. If the download fails (e.g., due to network issues), | |
| // logs a warning and returns an empty array. Test failures due to network issues are possible. | |
| private val logger = Logger.getLogger(getClass) | |
| def downloadBytes(url: String): Array[Byte] = { | |
| val request = new HttpGet(url) | |
| val result = util.Try { | |
| using(RESTHelpers.Client.execute(request)) { response => | |
| IOUtils.toByteArray(response.getEntity.getContent) | |
| } | |
| } | |
| result match { | |
| case util.Success(bytes) => bytes | |
| case util.Failure(e) => | |
| logger.warn(s"Failed to download bytes from $url: ${e.getMessage}") | |
| Array.emptyByteArray | |
| } |
|
|
||
|
|
||
|
|
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Excessive whitespace: Multiple blank lines (4) before override def testObjects(). Consider reducing to a single blank line to maintain consistency with other test suites in the codebase (e.g., FaceSuite.scala, AnomalyDetectionSuite.scala).
| } | ||
|
|
||
|
|
||
|
|
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Excessive whitespace: Multiple blank lines (2) before override def testObjects(). Consider reducing to a single blank line to maintain consistency.
…es/form/FormRecognizerSuite.scala Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…es/form/FormRecognizerSuite.scala Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…es/form/FormRecognizerSuite.scala Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…es/vision/ComputerVisionSuite.scala Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…es/vision/ComputerVisionSuite.scala Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Related Issues/PRs
Fixes broken build and tests caused by the retirement of Bing Search API v7.
What changes are proposed in this pull request?
Briefly describe the changes included in this Pull Request.
This PR removes all dependencies on the deprecated
BingImageSearchandBingSearchAPIWrappercomponents, which are no longer functional following the retirement of the Bing Search API v7.Key Changes:
BingImageSearch(Scala & Python),ImageSearchSuite, andBingSearchAPIWrapperreferences.Quickstart - Snow Leopard Detection.ipynb: Replaced dynamic Bing Search with a static dataset of snow leopard images. Implemented a customdownload_bytesUDF to replace theBingImageSearchdownloader.Quickstart - Analyze Celebrity Quotes.ipynb: Replaced Bing Search query with a static list of celebrity image URLs.FormRecognizerSuite,ComputerVisionSuite,OCRSuite, and others to removeBingImageSearchdependency.VisionUtilstrait with adownloadBytesUDF to handle image downloading for tests, ensuring they remain deterministic and fast.How is this patch tested?
Verification Steps:
FormRecognizerSuite,ComputerVisionSuite, etc.) compile successfully.sbt "testOnly *FormRecognizerSuite *ComputerVisionSuite"to confirm the new static data approach works as expected.bing-search-keyreferences.BingImageSearchorbing-search-keyremain in the active codebase.Does this PR change any dependencies?
Removed internal dependencies on
BingImageSearchand external calls to Bing Search API.Does this PR add a new feature? If so, have you added samples on website?