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 packages/uipath_langchain_client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to `uipath_langchain_client` will be documented in this file.

## [1.3.1] - 2026-03-12

### Fix
- Fix normalized client raise error

## [1.3.0] - 2026-03-10

### Version Bump
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__title__ = "UiPath LangChain Client"
__description__ = "A Python client for interacting with UiPath's LLM services via LangChain."
__version__ = "1.3.0"
__version__ = "1.3.1"
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def uipath_request(
url: URL | str = "/",
*,
request_body: dict[str, Any] | None = None,
raise_status_error: bool = False,
**kwargs: Any,
) -> Response:
"""Make a synchronous HTTP request to the UiPath API.
Expand All @@ -205,18 +206,25 @@ def uipath_request(
Raises:
UiPathAPIError: On HTTP 4xx/5xx responses (raised by transport layer).
"""
return self.uipath_sync_client.request(method, url, json=request_body, **kwargs)
response = self.uipath_sync_client.request(method, url, json=request_body, **kwargs)
if raise_status_error:
response.raise_for_status()
return response

async def uipath_arequest(
self,
method: Literal["POST", "GET"] = "POST",
url: URL | str = "/",
*,
request_body: dict[str, Any] | None = None,
raise_status_error: bool = False,
**kwargs: Any,
) -> Response:
"""Make an asynchronous HTTP request to the UiPath API."""
return await self.uipath_async_client.request(method, url, json=request_body, **kwargs)
response = await self.uipath_async_client.request(method, url, json=request_body, **kwargs)
if raise_status_error:
response.raise_for_status()
return response

def uipath_stream(
self,
Expand All @@ -225,6 +233,7 @@ def uipath_stream(
*,
request_body: dict[str, Any] | None = None,
stream_type: Literal["text", "bytes", "lines", "raw"] = "lines",
raise_status_error: bool = False,
**kwargs: Any,
) -> Iterator[str | bytes]:
"""Make a synchronous streaming HTTP request to the UiPath API.
Expand All @@ -244,6 +253,8 @@ def uipath_stream(
str | bytes: Chunks of the streaming response.
"""
with self.uipath_sync_client.stream(method, url, json=request_body, **kwargs) as response:
if raise_status_error:
response.raise_for_status()
match stream_type:
case "text":
for chunk in response.iter_text():
Expand All @@ -265,6 +276,7 @@ async def uipath_astream(
*,
request_body: dict[str, Any] | None = None,
stream_type: Literal["text", "bytes", "lines", "raw"] = "lines",
raise_status_error: bool = False,
**kwargs: Any,
) -> AsyncIterator[str | bytes]:
"""Make an asynchronous streaming HTTP request to the UiPath API.
Expand All @@ -286,6 +298,8 @@ async def uipath_astream(
async with self.uipath_async_client.stream(
method, url, json=request_body, **kwargs
) as response:
if raise_status_error:
response.raise_for_status()
match stream_type:
case "text":
async for chunk in response.aiter_text():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def _generate(
**kwargs: Any,
) -> ChatResult:
request_body = self._preprocess_request(messages, **kwargs)
response = self.uipath_request(request_body=request_body)
response = self.uipath_request(request_body=request_body, raise_status_error=True)
result = self._postprocess_response(response.json())
if self.captured_headers:
captured = extract_matching_headers(response.headers, self.captured_headers)
Expand All @@ -336,7 +336,7 @@ async def _agenerate(
**kwargs: Any,
) -> ChatResult:
request_body = self._preprocess_request(messages, **kwargs)
response = await self.uipath_arequest(request_body=request_body)
response = await self.uipath_arequest(request_body=request_body, raise_status_error=True)
result = self._postprocess_response(response.json())
if self.captured_headers:
captured = extract_matching_headers(response.headers, self.captured_headers)
Expand Down Expand Up @@ -413,7 +413,9 @@ def _stream(
set_captured_response_headers({})
try:
first = True
for chunk in self.uipath_stream(request_body=request_body, stream_type="lines"):
for chunk in self.uipath_stream(
request_body=request_body, stream_type="lines", raise_status_error=True
):
chunk = str(chunk)
if chunk.startswith("data:"):
chunk = chunk.split("data:")[1].strip()
Expand Down Expand Up @@ -442,7 +444,9 @@ async def _astream(
set_captured_response_headers({})
try:
first = True
async for chunk in self.uipath_astream(request_body=request_body, stream_type="lines"):
async for chunk in self.uipath_astream(
request_body=request_body, stream_type="lines", raise_status_error=True
):
chunk = str(chunk)
if chunk.startswith("data:"):
chunk = chunk.split("data:")[1].strip()
Expand Down