fix(llms): use Authorization Bearer header in UiPathOpenAI#328
Open
ionmincu wants to merge 1 commit into
Open
Conversation
…hOpenAI AzureOpenAI emits the api_key argument as the Azure-style `api-key` header, which AgentHub's LLMProxy [Authorize] pipeline (JwtBearer/S2S schemes) does not read, resulting in 401 with no Authorization header on the request. Bedrock and Vertex wrappers already attach `Authorization: Bearer <token>` explicitly; align UiPathOpenAI by setting it in default_headers and passing a placeholder api_key to satisfy the AzureOpenAI constructor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
a163f50 to
4d428d4
Compare
|
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.


Summary
UiPathOpenAIwas passingUIPATH_ACCESS_TOKENasapi_key=toAzureOpenAI. The OpenAI SDK emits that as the Azure-styleapi-key:header, but AgentHub's LLMProxy[Authorize]pipeline (JwtBearer + S2S schemes) only readsAuthorization: Bearer. The request arrived with noAuthorizationheader and was rejected anonymously → 401.ahub-prd-global-ne-ais) confirms every 401 onPOST LLMProxy/RawVendorCompletionsAsyncfor the openai path hasAuth.HasAuthorizationHeader: false, noJWT.*claims, no upstream dependency emitted — i.e. rejected at AgentHub auth, never reaching LLM Gateway. Same caller succeeded onvertexai19s before withHasAuthorizationHeader: true.UiPathChatBedrock/UiPathChatBedrockConverse(bedrock.py:127-131) andUiPathVertex(vertex.py:247-256) already do: attachAuthorization: Bearer <UIPATH_ACCESS_TOKEN>indefault_headers. A placeholderapi_key="uipath-gateway"keeps theAzureOpenAIconstructor happy.Test plan
uipath-llamaindex/chat-models / staging(UiPathOpenAI) — 10 methods flip from 401 to ✓uipath-llamaindex/quickstart-agent / cloud— passesuipath-llamaindex/simple-hitl-agent / stagingand/ cloud— passdependenciesrow to LLM Gateway now appears for theseoperation_Ids (proves auth passed)UiPathChatBedrockConverse,UiPathChatBedrock,UiPathVertexkeep passing (unaffected)Note on out-of-scope CI failures
The
*/alphamatrix cells (debug-breakpoints / alpha,quickstart-agent / alpha,simple-hitl-agent / alpha) fail before any LLM call with❌ Failed to get tenants and organizations:— separate alpha-env credential issue, not addressed here.🤖 Generated with Claude Code