Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to `uipath_llm_client` (core package) will be documented in this file.

## [1.0.3] - 2026-02-02

### Refactor
- moved the logic of get_httpx_client_kwargs from the uipath package to this package;

## [1.0.2] - 2026-02-02

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion src/uipath_llm_client/__version__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__titile__ = "UiPath LLM Client"
__description__ = "A Python client for interacting with UiPath's LLM services."
__version__ = "1.0.2"
__version__ = "1.0.3"
2 changes: 1 addition & 1 deletion src/uipath_llm_client/httpx_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
Response,
)
from httpx._types import HeaderTypes
from uipath._utils._ssl_context import get_httpx_client_kwargs

from uipath_llm_client.settings import (
UiPathAPIConfig,
Expand All @@ -47,6 +46,7 @@
RetryableHTTPTransport,
RetryConfig,
)
from uipath_llm_client.utils.ssl_config import get_httpx_client_kwargs


def build_routing_headers(
Expand Down
54 changes: 54 additions & 0 deletions src/uipath_llm_client/utils/ssl_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import os
import ssl
from typing import Any


def expand_path(path):
"""Expand environment variables and user home directory in path."""
if not path:
return path
# Expand environment variables like $HOME
path = os.path.expandvars(path)
# Expand user home directory ~
path = os.path.expanduser(path)
return path


def create_ssl_context():
# Try truststore first (system certificates)
try:
import truststore

return truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
except ImportError:
# Fallback to manual certificate configuration
import certifi

ssl_cert_file = expand_path(os.environ.get("SSL_CERT_FILE"))
requests_ca_bundle = expand_path(os.environ.get("REQUESTS_CA_BUNDLE"))
ssl_cert_dir = expand_path(os.environ.get("SSL_CERT_DIR"))

return ssl.create_default_context(
cafile=ssl_cert_file or requests_ca_bundle or certifi.where(),
capath=ssl_cert_dir,
)


def get_httpx_client_kwargs() -> dict[str, Any]:
"""Get standardized httpx client configuration."""
client_kwargs: dict[str, Any] = {"follow_redirects": True, "timeout": 30.0}

# Check environment variable to disable SSL verification
disable_ssl_env = os.environ.get("UIPATH_DISABLE_SSL_VERIFY", "").lower()
disable_ssl_from_env = disable_ssl_env in ("1", "true", "yes", "on")

if disable_ssl_from_env:
client_kwargs["verify"] = False
else:
# Use system certificates with truststore fallback
client_kwargs["verify"] = create_ssl_context()

# Auto-detect proxy from environment variables (httpx handles this automatically)
# HTTP_PROXY, HTTPS_PROXY, NO_PROXY are read by httpx by default

return client_kwargs