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 packages/uipath-platform/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-platform"
version = "0.2.36"
version = "0.2.37"
description = "HTTP client library for programmatic access to UiPath Platform"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,19 @@ def __init__(
super().__init__(config=config, execution_context=execution_context)

def get_available_llm_models(
self, headers: dict[str, Any] | None = None
self,
headers: dict[str, Any] | None = None,
*,
include_deprecated_models: bool = False,
Comment thread
tudormatei1 marked this conversation as resolved.
) -> list[LlmModel]:
"""Fetch available models from LLM Gateway discovery endpoint.

Returns:
List of available models and their configurations.
"""
spec = self._available_models_spec(headers=headers)
spec = self._available_models_spec(
headers=headers, include_deprecated_models=include_deprecated_models
)

response = self.request(
spec.method,
Expand All @@ -43,14 +48,19 @@ def get_available_llm_models(
]

async def get_available_llm_models_async(
self, headers: dict[str, Any] | None = None
self,
headers: dict[str, Any] | None = None,
*,
include_deprecated_models: bool = False,
) -> list[LlmModel]:
"""Asynchronously fetch available models from LLM Gateway discovery endpoint.

Returns:
List of available models and their configurations.
"""
spec = self._available_models_spec(headers=headers)
spec = self._available_models_spec(
headers=headers, include_deprecated_models=include_deprecated_models
)

response = await self.request_async(
spec.method,
Expand Down Expand Up @@ -197,9 +207,14 @@ def _resolve_folder_key(

return folder_key

def _available_models_spec(self, headers: dict[str, Any] | None) -> RequestSpec:
def _available_models_spec(
self, headers: dict[str, Any] | None, include_deprecated_models: bool
) -> RequestSpec:
return RequestSpec(
method="GET",
endpoint=Endpoint("/agenthub_/llm/api/discovery"),
params={"includeDeprecatedModels": "true"}
if include_deprecated_models
else {},
headers=headers or {},
)
74 changes: 74 additions & 0 deletions packages/uipath-platform/tests/services/test_agenthub_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import pytest
from pytest_httpx import HTTPXMock

from uipath.platform import UiPathApiConfig, UiPathExecutionContext
from uipath.platform.agenthub._agenthub_service import AgentHubService
from uipath.platform.orchestrator._folder_service import FolderService

RETIRED_MODEL = {
"modelName": "gpt-4o-2024-05-13",
"vendor": "OpenAi",
"effectiveModel": "gpt-5.1-2025-11-13",
"isDeprecated": True,
"deprecationDetails": {
"usageEndDate": "2026-09-30",
"replacedBy": "gpt-5.1-2025-11-13",
},
}


@pytest.fixture
def service(
config: UiPathApiConfig, execution_context: UiPathExecutionContext
) -> AgentHubService:
return AgentHubService(
config=config,
execution_context=execution_context,
folder_service=FolderService(
config=config, execution_context=execution_context
),
)


@pytest.fixture
def discovery_url(base_url: str, org: str, tenant: str) -> str:
return f"{base_url}{org}{tenant}/agenthub_/llm/api/discovery"


class TestGetAvailableLlmModels:
def test_does_not_request_deprecated_models_by_default(
self, httpx_mock: HTTPXMock, service: AgentHubService, discovery_url: str
) -> None:
httpx_mock.add_response(url=discovery_url, json=[])

service.get_available_llm_models()

request = httpx_mock.get_request()
assert request is not None
assert "includeDeprecatedModels" not in request.url.params

def test_requests_deprecated_models_when_asked(
self, httpx_mock: HTTPXMock, service: AgentHubService, discovery_url: str
) -> None:
httpx_mock.add_response(
url=f"{discovery_url}?includeDeprecatedModels=true",
json=[RETIRED_MODEL],
)

models = service.get_available_llm_models(include_deprecated_models=True)

assert [m.model_dump(by_alias=True) for m in models] == [RETIRED_MODEL]

async def test_async_requests_deprecated_models_when_asked(
self, httpx_mock: HTTPXMock, service: AgentHubService, discovery_url: str
) -> None:
httpx_mock.add_response(
url=f"{discovery_url}?includeDeprecatedModels=true",
json=[RETIRED_MODEL],
)

models = await service.get_available_llm_models_async(
include_deprecated_models=True
)

assert [m.model_dump(by_alias=True) for m in models] == [RETIRED_MODEL]
2 changes: 1 addition & 1 deletion packages/uipath-platform/uv.lock

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

4 changes: 2 additions & 2 deletions packages/uipath/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[project]
name = "uipath"
version = "2.14.37"
version = "2.14.38"
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
dependencies = [
"uipath-core>=0.5.33, <0.6.0",
"uipath-runtime>=0.13.5, <0.14.0",
"uipath-platform>=0.2.34, <0.3.0",
"uipath-platform>=0.2.37, <0.3.0",
"uipath-ipc>=2.5.1, <2.6.0",
"click>=8.3.3, <9.0.0",
"httpx>=0.28.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/uipath/src/uipath/_resources/SDK_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ Agenthub service

```python
# Fetch available models from LLM Gateway discovery endpoint.
sdk.agenthub.get_available_llm_models(headers: dict[str, Any] | None=None) -> list[uipath.platform.agenthub.agenthub.LlmModel]
sdk.agenthub.get_available_llm_models(headers: dict[str, Any] | None=None, include_deprecated_models: bool=False) -> list[uipath.platform.agenthub.agenthub.LlmModel]

# Asynchronously fetch available models from LLM Gateway discovery endpoint.
sdk.agenthub.get_available_llm_models_async(headers: dict[str, Any] | None=None) -> list[uipath.platform.agenthub.agenthub.LlmModel]
sdk.agenthub.get_available_llm_models_async(headers: dict[str, Any] | None=None, include_deprecated_models: bool=False) -> list[uipath.platform.agenthub.agenthub.LlmModel]

# Start a system agent job.
sdk.agenthub.invoke_system_agent(agent_name: str, entrypoint: str, input_arguments: dict[str, Any] | None=None, folder_key: str | None=None, folder_path: str | None=None, headers: dict[str, Any] | None=None) -> str
Expand Down
4 changes: 2 additions & 2 deletions packages/uipath/uv.lock

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

Loading