Repository navigation
Pick the Ask AI provider per deployment, not per request - #4807
Merged
Merged
Conversation
The API reads `DOCUMENTATION_ASK_AI_PROVIDER` once and ignores the `X-AI-Provider` header. An unset value means `LlmGateway`, so docs sites need no config change. Codex keeps `AgentBuilder` by setting the variable in its task definition. The frontend no longer tracks or sends a provider. Old clients that still send the header get `LlmGateway` like everyone else. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er review by @infra-vault-gh-plugin-prod) Co-Authored-By: Claude Opus 5.5 <[email protected]>
akira28
approved these changes
Nov 10, 2026
…-gh-plugin-prod) Co-Authored-By: Claude Opus 5.5 <[email protected]>
reakaleek
enabled auto-merge (squash)
November 10, 2026 17:51
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4807/ Sample changed pages: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Ask AI provider is now a deployment setting. The API ignores the
X-AI-Providerrequest header and readsDOCUMENTATION_ASK_AI_PROVIDERinstead. Docs sites stay onLlmGatewaywith no config change.Affects: Docs API, Site UI
Prompt summary: Remove the
X-AI-Providerheader so docs users can only useLlmGateway. Keep it backwards compatible, so a client that still sends the header gets no change in behaviour. Codex stays onAgentBuilder.Why
The client picks the provider today. Each request routes to whichever provider its
X-AI-Providerheader names, so the provider a site uses is not under the deployment's control. Codex needsAgentBuilderand the docs sites needLlmGateway. That choice belongs in each deployment's configuration.What
Provider comes from configuration
AskAiProviderOptionsreadsDOCUMENTATION_ASK_AI_PROVIDERonce. When the value is unset or empty it meansLlmGateway, andAgentBuilder(case-insensitive) selects Agent Builder. Any other value throws when the service is resolved, the same way the Kibana and LLM Gateway options fail on bad config. The "Ask AI provider" section indocs/data/api.mddocuments the setting.Header resolver and factories removed
AskAiProviderResolver,AskAiGatewayFactoryandStreamTransformerFactoryare gone, along with theIHttpContextAccessorregistration they needed.ServicesExtensionmapsIAskAiServiceandIStreamTransformerto the configured provider directly.Frontend sends no provider
The chat store no longer keeps, persists or sends
aiProvider. Both stream clients drop the header. The unusedAiProviderSelectorcomponent is deleted. A storedaiProviderfield in old browser data does no harm and is ignored.Risk: Codex must set
DOCUMENTATION_ASK_AI_PROVIDER=AgentBuilderbefore this image reaches it. Otherwise Codex falls back toLlmGateway, which it has no config for. The companion change is https://github.com/elastic/codex-environments/pull/64, and it is safe to merge first.Verify
🤖 Generated with Claude Code