feat: add uipath headers llm calls#663
Conversation
be97fa7 to
bdc7d3a
Compare
bdc7d3a to
a858fd8
Compare
| if process_key := os.getenv("UIPATH_PROCESS_KEY"): | ||
| headers["X-UiPath-ProcessKey"] = quote(process_key, safe="") | ||
| if job_key := os.getenv("UIPATH_JOB_KEY"): | ||
| headers["x-uipath-jobkey"] = job_key |
There was a problem hiding this comment.
The old code used X-UiPath-JobKey, not sure if casing matters or not.
There was a problem hiding this comment.
yep, let s be consistent with casing
There was a problem hiding this comment.
fair points; I get:
- consistency in the same file
- consistency for all uipath headers used
For point 2 I lower cased them as per the source of truth for headers in uipath-python: https://github.com/UiPath/uipath-python/blob/1869a9625e9da3957bf0a379325341b904150494/packages/uipath/src/uipath/_utils/constants.py#L24-L30
I will actually export them from the uipath-platform-python package and reuse them here as the source of truth and this would address both points you;ve raised.
There was a problem hiding this comment.
as for the casing, according to the http RFC and mozilla docs the HTTP headers would be case insensitive such that I'll keep them lowercase:
There was a problem hiding this comment.
| self.access_token, | ||
| agenthub_config=self.agenthub_config, | ||
| byo_connection_id=self.byo_connection_id, | ||
| inject_routing=self._is_override, |
There was a problem hiding this comment.
if auth_headers() is called before url(), self._is_override will be False, right now the ordering is correct but might be problematic in the future.
| if tenant_id := os.getenv("UIPATH_TENANT_ID"): | ||
| headers["X-UiPath-Internal-TenantId"] = tenant_id | ||
| if organization_id := os.getenv("UIPATH_ORGANIZATION_ID"): | ||
| headers["X-UiPath-Internal-AccountId"] = organization_id |
There was a problem hiding this comment.
Are X-UiPath-Internal-AccountId and X-UiPath-Internal-TenantId new headers? Who needs them? Is it APIM? Then why not always having them when calling an UiPath URL?
There was a problem hiding this comment.
these would get called only for the local dev flow as per the conditions to inject_routing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move all shared HTTP concerns (headers, header capture, retryers) into a new chat/http_client subpackage. Introduce build_uipath_headers() as the single entry point for building UiPath LLM Gateway headers across OpenAI, Vertex, and Bedrock providers. Context headers (job_key, folder_key, trace_id) now read directly from env vars like process_key. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add resolve_gateway_url() to integrate all chat models with the platform's per-service URL override system (UIPATH_SERVICE_URL_<SERVICE> env vars). When an override is active, routing headers (X-UiPath-Internal-TenantId/AccountId) are injected automatically since the platform routing layer is bypassed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ed500bf to
d0a9530
Compare
d0a9530 to
5fa0bdb
Compare
Uniform UiPath headers and service URL override support for chat models
Summary
Changes