Skip to content

feat(aiclient): read the Bing search endpoint from BING_ENDPOINT - #3280

Open
SpecStream (Specstreamai) wants to merge 1 commit into
microsoft:mainfrom
Specstreamai:bing-endpoint-env
Open

SpecStream (Specstreamai) wants to merge 1 commit into
microsoft:mainfrom
Specstreamai:bing-endpoint-env

Conversation

@Specstreamai

Copy link
Copy Markdown

createBingSearch always builds its URLs from https://api.bing.microsoft.com/v7.0, and only the key comes from settings. Microsoft's retirement notice says "Bing Search APIs will be retired on August 11, 2025. Any existing instances of Bing Search APIs will be decommissioned completely, and the product will no longer be available to be used or new customer signup." (https://learn.microsoft.com/en-us/lifecycle/announcements/bing-search-api-retirement), so searchWeb and the textProcessing caller get no results and there's nothing to point them at instead.

This adds an optional endpoint to ApiSettings and reads it from BING_ENDPOINT in apiSettingsFromEnv, next to BING_API_KEY, the same way the other clients take *_ENDPOINT. It's the base that /search and /images/search are appended to, and a trailing slash is dropped. Unset or blank keeps https://api.bing.microsoft.com/v7.0. The config flattener already turns bing.endpoint into BING_ENDPOINT, so I added that row to the table in packages/config/README.md.

test/bing.spec.ts stubs fetch and checks that apiSettingsFromEnv leaves the endpoint unset by default and reads BING_ENDPOINT, and that web and image searches go to Bing without it and to the configured base with it. In packages/aiclient, pnpm run tsc, pnpm run test:local (33 suites, 643 tests) and pnpm run prettier pass.

I run a search API that answers in the Bing v7 format, which is how I ran into this.

ApiSettings gets an optional endpoint, filled from BING_ENDPOINT (bing.endpoint in config). Unset keeps https://api.bing.microsoft.com/v7.0.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@Specstreamai

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="SpecStream SAS"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The configurable Bing-compatible search endpoint change has no active review issues.

No open issues 🎉

What changed in this PR

Adds configurable Bing-compatible search endpoints to the AI client, allowing web and image searches to use an alternative service while preserving the existing default URL.

Changes:

  • Reads optional BING_ENDPOINT configuration and removes trailing slashes before constructing search URLs.
  • Adds tests for endpoint loading and default/custom web and image search URLs.
  • Documents the bing.endpoint configuration mapping.
File Description
ts/​packages/​config/​README.md Documents the mapping from bing.endpoint to BING_ENDPOINT.
ts/​packages/​aiclient/​test/​bing.spec.ts Tests endpoint configuration and search request URLs.
ts/​packages/​aiclient/​src/​bing.ts Adds optional endpoint settings and configurable search URL construction.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants