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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-langchain"
version = "0.10.17"
version = "0.10.18"
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
21 changes: 11 additions & 10 deletions src/uipath_langchain/chat/_settings.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import os

from pydantic import model_validator
from pydantic import field_validator


class _AgentHubConfigDefaultMixin:
@model_validator(mode="after")
def _clear_agenthub_config_default(self):
if os.getenv("UIPATH_AGENTHUB_CONFIG") is None:
client_settings = getattr(self, "client_settings", None)
if client_settings is not None and hasattr(
client_settings, "agenthub_config"
):
client_settings.agenthub_config = None
return self
@field_validator("client_settings", mode="after")
@classmethod
def _clear_agenthub_config_default(cls, client_settings):
if (
client_settings is not None
and os.getenv("UIPATH_AGENTHUB_CONFIG") is None
and hasattr(client_settings, "agenthub_config")
):
client_settings.agenthub_config = None
return client_settings
16 changes: 16 additions & 0 deletions tests/chat/test_agenthub_config_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ def test_env_var_is_honored(self, cls, monkeypatch):
llm = cls()
assert llm.client_settings.agenthub_config == "agentsplayground"

def test_no_agenthub_header_on_inner_http_client(self, cls):
llm = cls()
client = getattr(llm, "uipath_sync_client", None)
if client is None:
pytest.skip(f"{cls.__name__} has no uipath_sync_client to inspect")
assert "x-uipath-agenthub-config" not in {key.lower() for key in client.headers}

def test_env_var_is_honored_on_inner_http_client(self, cls, monkeypatch):
monkeypatch.setenv("UIPATH_AGENTHUB_CONFIG", "agentsplayground")
llm = cls()
client = getattr(llm, "uipath_sync_client", None)
if client is None:
pytest.skip(f"{cls.__name__} has no uipath_sync_client to inspect")
normalized = {key.lower(): value for key, value in client.headers.items()}
assert normalized.get("x-uipath-agenthub-config") == "agentsplayground"


_UPSTREAM_CASES = [
"uipath_langchain_client.clients.normalized.chat_models:UiPathChat",
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading