uipath 2.0.74__tar.gz → 2.0.75__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of uipath might be problematic. Click here for more details.

Files changed (198) hide show
  1. {uipath-2.0.74 → uipath-2.0.75}/PKG-INFO +1 -1
  2. {uipath-2.0.74 → uipath-2.0.75}/pyproject.toml +1 -1
  3. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/llm_gateway_service.py +18 -85
  4. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/llm_gateway.py +0 -5
  5. uipath-2.0.75/src/uipath/utils/__init__.py +5 -0
  6. uipath-2.0.75/src/uipath/utils/_endpoints_manager.py +88 -0
  7. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_llm_integration.py +0 -39
  8. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_llm_service.py +1 -59
  9. {uipath-2.0.74 → uipath-2.0.75}/uv.lock +1 -1
  10. {uipath-2.0.74 → uipath-2.0.75}/.cursorrules +0 -0
  11. {uipath-2.0.74 → uipath-2.0.75}/.editorconfig +0 -0
  12. {uipath-2.0.74 → uipath-2.0.75}/.gitattributes +0 -0
  13. {uipath-2.0.74 → uipath-2.0.75}/.github/workflows/cd.yml +0 -0
  14. {uipath-2.0.74 → uipath-2.0.75}/.github/workflows/ci.yml +0 -0
  15. {uipath-2.0.74 → uipath-2.0.75}/.github/workflows/commitlint.yml +0 -0
  16. {uipath-2.0.74 → uipath-2.0.75}/.github/workflows/lint.yml +0 -0
  17. {uipath-2.0.74 → uipath-2.0.75}/.github/workflows/publish-dev.yml +0 -0
  18. {uipath-2.0.74 → uipath-2.0.75}/.github/workflows/publish-docs.yml +0 -0
  19. {uipath-2.0.74 → uipath-2.0.75}/.github/workflows/slack.yml +0 -0
  20. {uipath-2.0.74 → uipath-2.0.75}/.github/workflows/test.yml +0 -0
  21. {uipath-2.0.74 → uipath-2.0.75}/.gitignore +0 -0
  22. {uipath-2.0.74 → uipath-2.0.75}/.pre-commit-config.yaml +0 -0
  23. {uipath-2.0.74 → uipath-2.0.75}/.python-version +0 -0
  24. {uipath-2.0.74 → uipath-2.0.75}/.vscode/extensions.json +0 -0
  25. {uipath-2.0.74 → uipath-2.0.75}/.vscode/launch.json +0 -0
  26. {uipath-2.0.74 → uipath-2.0.75}/.vscode/settings.json +0 -0
  27. {uipath-2.0.74 → uipath-2.0.75}/CONTRIBUTING.md +0 -0
  28. {uipath-2.0.74 → uipath-2.0.75}/LICENSE +0 -0
  29. {uipath-2.0.74 → uipath-2.0.75}/README.md +0 -0
  30. {uipath-2.0.74 → uipath-2.0.75}/docs/CONTRIBUTING.md +0 -0
  31. {uipath-2.0.74 → uipath-2.0.75}/docs/FAQ.md +0 -0
  32. {uipath-2.0.74 → uipath-2.0.75}/docs/assets/env-preparation-failed-dark.png +0 -0
  33. {uipath-2.0.74 → uipath-2.0.75}/docs/assets/env-preparation-failed-light.png +0 -0
  34. {uipath-2.0.74 → uipath-2.0.75}/docs/assets/favicon.png +0 -0
  35. {uipath-2.0.74 → uipath-2.0.75}/docs/assets/logo-dark.svg +0 -0
  36. {uipath-2.0.74 → uipath-2.0.75}/docs/assets/logo-light.svg +0 -0
  37. {uipath-2.0.74 → uipath-2.0.75}/docs/cli/index.md +0 -0
  38. {uipath-2.0.74 → uipath-2.0.75}/docs/core/actions.md +0 -0
  39. {uipath-2.0.74 → uipath-2.0.75}/docs/core/assets/cloud_env_var_dark.gif +0 -0
  40. {uipath-2.0.74 → uipath-2.0.75}/docs/core/assets/cloud_env_var_light.gif +0 -0
  41. {uipath-2.0.74 → uipath-2.0.75}/docs/core/assets/cloud_env_var_secret_dark.png +0 -0
  42. {uipath-2.0.74 → uipath-2.0.75}/docs/core/assets/cloud_env_var_secret_light.png +0 -0
  43. {uipath-2.0.74 → uipath-2.0.75}/docs/core/assets/copy_path_dark.png +0 -0
  44. {uipath-2.0.74 → uipath-2.0.75}/docs/core/assets/copy_path_light.png +0 -0
  45. {uipath-2.0.74 → uipath-2.0.75}/docs/core/assets.md +0 -0
  46. {uipath-2.0.74 → uipath-2.0.75}/docs/core/attachments.md +0 -0
  47. {uipath-2.0.74 → uipath-2.0.75}/docs/core/buckets.md +0 -0
  48. {uipath-2.0.74 → uipath-2.0.75}/docs/core/connections.md +0 -0
  49. {uipath-2.0.74 → uipath-2.0.75}/docs/core/context_grounding.md +0 -0
  50. {uipath-2.0.74 → uipath-2.0.75}/docs/core/environment_variables.md +0 -0
  51. {uipath-2.0.74 → uipath-2.0.75}/docs/core/getting_started.md +0 -0
  52. {uipath-2.0.74 → uipath-2.0.75}/docs/core/jobs.md +0 -0
  53. {uipath-2.0.74 → uipath-2.0.75}/docs/core/processes.md +0 -0
  54. {uipath-2.0.74 → uipath-2.0.75}/docs/core/queues.md +0 -0
  55. {uipath-2.0.74 → uipath-2.0.75}/docs/core/traced.md +0 -0
  56. {uipath-2.0.74 → uipath-2.0.75}/docs/hooks.py +0 -0
  57. {uipath-2.0.74 → uipath-2.0.75}/docs/index.md +0 -0
  58. {uipath-2.0.74 → uipath-2.0.75}/docs/javascripts/extra.js +0 -0
  59. {uipath-2.0.74 → uipath-2.0.75}/docs/overrides/main.html +0 -0
  60. {uipath-2.0.74 → uipath-2.0.75}/docs/overrides/partials/actions.html +0 -0
  61. {uipath-2.0.74 → uipath-2.0.75}/docs/overrides/partials/logo.html +0 -0
  62. {uipath-2.0.74 → uipath-2.0.75}/docs/release_policy.md +0 -0
  63. {uipath-2.0.74 → uipath-2.0.75}/docs/stylesheets/extra.css +0 -0
  64. {uipath-2.0.74 → uipath-2.0.75}/justfile +0 -0
  65. {uipath-2.0.74 → uipath-2.0.75}/mkdocs.yml +0 -0
  66. {uipath-2.0.74 → uipath-2.0.75}/py.typed +0 -0
  67. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/__init__.py +0 -0
  68. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/README.md +0 -0
  69. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/__init__.py +0 -0
  70. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_auth/_auth_server.py +0 -0
  71. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_auth/_client_credentials.py +0 -0
  72. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_auth/_models.py +0 -0
  73. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_auth/_oidc_utils.py +0 -0
  74. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_auth/_portal_service.py +0 -0
  75. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_auth/_utils.py +0 -0
  76. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_auth/auth_config.json +0 -0
  77. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_auth/index.html +0 -0
  78. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_auth/localhost.crt +0 -0
  79. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_auth/localhost.key +0 -0
  80. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_runtime/_contracts.py +0 -0
  81. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_runtime/_escalation.py +0 -0
  82. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_runtime/_hitl.py +0 -0
  83. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_runtime/_logging.py +0 -0
  84. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_runtime/_runtime.py +0 -0
  85. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_templates/.psmdcp.template +0 -0
  86. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_templates/.rels.template +0 -0
  87. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_templates/[Content_Types].xml.template +0 -0
  88. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_templates/main.py.template +0 -0
  89. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_templates/package.nuspec.template +0 -0
  90. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_utils/_common.py +0 -0
  91. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_utils/_console.py +0 -0
  92. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_utils/_constants.py +0 -0
  93. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_utils/_debug.py +0 -0
  94. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_utils/_folders.py +0 -0
  95. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_utils/_input_args.py +0 -0
  96. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_utils/_parse_ast.py +0 -0
  97. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_utils/_processes.py +0 -0
  98. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/_utils/_tracing.py +0 -0
  99. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/cli_auth.py +0 -0
  100. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/cli_deploy.py +0 -0
  101. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/cli_init.py +0 -0
  102. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/cli_invoke.py +0 -0
  103. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/cli_new.py +0 -0
  104. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/cli_pack.py +0 -0
  105. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/cli_publish.py +0 -0
  106. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/cli_run.py +0 -0
  107. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/middlewares.py +0 -0
  108. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_cli/spinner.py +0 -0
  109. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_config.py +0 -0
  110. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_execution_context.py +0 -0
  111. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_folder_context.py +0 -0
  112. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/__init__.py +0 -0
  113. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/_base_service.py +0 -0
  114. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/actions_service.py +0 -0
  115. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/api_client.py +0 -0
  116. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/assets_service.py +0 -0
  117. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/attachments_service.py +0 -0
  118. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/buckets_service.py +0 -0
  119. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/connections_service.py +0 -0
  120. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/context_grounding_service.py +0 -0
  121. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/folder_service.py +0 -0
  122. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/jobs_service.py +0 -0
  123. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/processes_service.py +0 -0
  124. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_services/queues_service.py +0 -0
  125. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_uipath.py +0 -0
  126. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_utils/__init__.py +0 -0
  127. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_utils/_endpoint.py +0 -0
  128. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_utils/_infer_bindings.py +0 -0
  129. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_utils/_logs.py +0 -0
  130. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_utils/_read_overwrites.py +0 -0
  131. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_utils/_request_override.py +0 -0
  132. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_utils/_request_spec.py +0 -0
  133. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_utils/_ssl_context.py +0 -0
  134. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_utils/_url.py +0 -0
  135. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_utils/_user_agent.py +0 -0
  136. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/_utils/constants.py +0 -0
  137. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/__init__.py +0 -0
  138. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/action_schema.py +0 -0
  139. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/actions.py +0 -0
  140. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/assets.py +0 -0
  141. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/attachment.py +0 -0
  142. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/buckets.py +0 -0
  143. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/connections.py +0 -0
  144. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/context_grounding.py +0 -0
  145. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/context_grounding_index.py +0 -0
  146. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/errors.py +0 -0
  147. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/exceptions.py +0 -0
  148. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/interrupt_models.py +0 -0
  149. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/job.py +0 -0
  150. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/processes.py +0 -0
  151. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/models/queues.py +0 -0
  152. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/py.typed +0 -0
  153. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/telemetry/__init__.py +0 -0
  154. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/telemetry/_constants.py +0 -0
  155. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/telemetry/_track.py +0 -0
  156. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/tracing/__init__.py +0 -0
  157. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/tracing/_otel_exporters.py +0 -0
  158. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/tracing/_traced.py +0 -0
  159. {uipath-2.0.74 → uipath-2.0.75}/src/uipath/tracing/_utils.py +0 -0
  160. {uipath-2.0.74 → uipath-2.0.75}/tests/__init__.py +0 -0
  161. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/conftest.py +0 -0
  162. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/mocks/bindings_script.py +0 -0
  163. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/mocks/pyproject.toml +0 -0
  164. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/mocks/simple_script.py +0 -0
  165. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/mocks/uipath-mock.json +0 -0
  166. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/mocks/uipath-simple-script-mock.json +0 -0
  167. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/test_hitl.py +0 -0
  168. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/test_init.py +0 -0
  169. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/test_invoke.py +0 -0
  170. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/test_new.py +0 -0
  171. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/test_pack.py +0 -0
  172. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/test_publish.py +0 -0
  173. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/test_run.py +0 -0
  174. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/test_utils.py +0 -0
  175. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/utils/project_details.py +0 -0
  176. {uipath-2.0.74 → uipath-2.0.75}/tests/cli/utils/uipath_json.py +0 -0
  177. {uipath-2.0.74 → uipath-2.0.75}/tests/conftest.py +0 -0
  178. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/conftest.py +0 -0
  179. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_actions_service.py +0 -0
  180. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_api_client.py +0 -0
  181. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_assets_service.py +0 -0
  182. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_attachments_service.py +0 -0
  183. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_base_service.py +0 -0
  184. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_buckets_service.py +0 -0
  185. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_connections_service.py +0 -0
  186. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_context_grounding_service.py +0 -0
  187. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_folder_service.py +0 -0
  188. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_jobs_service.py +0 -0
  189. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_processes_service.py +0 -0
  190. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_queues_service.py +0 -0
  191. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/services/test_uipath_llm_integration.py +0 -0
  192. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/test_bindings_inference.py +0 -0
  193. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/test_config.py +0 -0
  194. {uipath-2.0.74 → uipath-2.0.75}/tests/sdk/test_overwrites.py +0 -0
  195. {uipath-2.0.74 → uipath-2.0.75}/tests/tracing/test_otel_exporters.py +0 -0
  196. {uipath-2.0.74 → uipath-2.0.75}/tests/tracing/test_span_utils.py +0 -0
  197. {uipath-2.0.74 → uipath-2.0.75}/tests/tracing/test_traced.py +0 -0
  198. {uipath-2.0.74 → uipath-2.0.75}/tests/tracing/test_tracing_manager.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath
3
- Version: 2.0.74
3
+ Version: 2.0.75
4
4
  Summary: Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools.
5
5
  Project-URL: Homepage, https://uipath.com
6
6
  Project-URL: Repository, https://github.com/UiPath/uipath-python
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "uipath"
3
- version = "2.0.74"
3
+ version = "2.0.75"
4
4
  description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
5
5
  readme = { file = "README.md", content-type = "text/markdown" }
6
6
  requires-python = ">=3.10"
@@ -10,9 +10,9 @@ from ..models.llm_gateway import (
10
10
  TextEmbedding,
11
11
  ToolChoice,
12
12
  ToolDefinition,
13
- UsageInfo,
14
13
  )
15
14
  from ..tracing._traced import traced
15
+ from ..utils import EndpointManager
16
16
  from ._base_service import BaseService
17
17
 
18
18
  # Common constants
@@ -54,36 +54,12 @@ class UiPathOpenAIService(BaseService):
54
54
  def __init__(self, config: Config, execution_context: ExecutionContext) -> None:
55
55
  super().__init__(config=config, execution_context=execution_context)
56
56
 
57
- @traced(name="llm_embeddings_usage", run_type="uipath")
58
- async def embeddings_usage(
59
- self, input: str, embedding_model: str = EmbeddingModels.text_embedding_ada_002
60
- ):
61
- """Embedd the input text using llm gateway service.
62
-
63
- Args:
64
- input (str): The input text to embedd.
65
- embedding_model (str, optional): The embedding model to use. Defaults to text-embedding-ada-002.
66
-
67
- Returns:
68
- EmbeddingUsageInfo: The embedding usage information.
69
- """
70
- endpoint = Endpoint(
71
- f"/llmgateway_/openai/deployments/{embedding_model}/embeddings/usage"
72
- )
73
-
74
- response = await self.request_async(
75
- "POST",
76
- endpoint,
77
- content=json.dumps({"input": input}),
78
- params={"api-version": API_VERSION},
79
- headers=DEFAULT_LLM_HEADERS,
80
- )
81
-
82
- return UsageInfo.model_validate(response.json())
83
-
84
57
  @traced(name="llm_embeddings", run_type="uipath")
85
58
  async def embeddings(
86
- self, input: str, embedding_model: str = EmbeddingModels.text_embedding_ada_002
59
+ self,
60
+ input: str,
61
+ embedding_model: str = EmbeddingModels.text_embedding_ada_002,
62
+ openai_api_version: str = API_VERSION,
87
63
  ):
88
64
  """Embed the input text using llm gateway service.
89
65
 
@@ -93,9 +69,10 @@ class UiPathOpenAIService(BaseService):
93
69
  Returns:
94
70
  TextEmbedding: The embedding response.
95
71
  """
96
- endpoint = Endpoint(
97
- f"/llmgateway_/openai/deployments/{embedding_model}/embeddings"
72
+ endpoint = EndpointManager.get_embeddings_endpoint().format(
73
+ model=embedding_model, api_version=openai_api_version
98
74
  )
75
+ endpoint = Endpoint("/" + endpoint)
99
76
 
100
77
  response = await self.request_async(
101
78
  "POST",
@@ -114,6 +91,7 @@ class UiPathOpenAIService(BaseService):
114
91
  model: str = ChatModels.gpt_4o_mini_2024_07_18,
115
92
  max_tokens: int = 50,
116
93
  temperature: float = 0,
94
+ api_version: str = API_VERSION,
117
95
  ):
118
96
  """Get chat completions using llm gateway service.
119
97
 
@@ -139,59 +117,10 @@ class UiPathOpenAIService(BaseService):
139
117
  Returns:
140
118
  ChatCompletion: The chat completion response.
141
119
  """
142
- endpoint = Endpoint(f"/llmgateway_/openai/deployments/{model}/chat/completions")
143
-
144
- request_body = {
145
- "messages": messages,
146
- "max_tokens": max_tokens,
147
- "temperature": temperature,
148
- }
149
-
150
- response = await self.request_async(
151
- "POST",
152
- endpoint,
153
- content=json.dumps(request_body),
154
- params={"api-version": API_VERSION},
155
- headers=DEFAULT_LLM_HEADERS,
156
- )
157
-
158
- return ChatCompletion.model_validate(response.json())
159
-
160
- @traced(name="llm_chat_completions_usage", run_type="uipath")
161
- async def chat_completions_usage(
162
- self,
163
- messages: List[Dict[str, str]],
164
- model: str = ChatModels.gpt_4o_mini_2024_07_18,
165
- max_tokens: int = 50,
166
- temperature: float = 0,
167
- ):
168
- """Get chat completions usage using llm gateway service.
169
-
170
- Args:
171
- messages (List[Dict[str, str]]): List of message dictionaries with 'role' and 'content' keys.
172
- The supported roles are 'system', 'user', and 'assistant'.
173
-
174
- Example:
175
- ```
176
- [
177
- {"role": "system", "content": "You are a helpful Python programming assistant."},
178
- {"role": "user", "content": "How do I read a file in Python?"},
179
- {"role": "assistant", "content": "You can use the built-in open() function."},
180
- {"role": "user", "content": "Can you show an example?"}
181
- ]
182
- ```
183
- The conversation history can be included to provide context to the model.
184
- model (str, optional): The model to use for chat completion. Defaults to ChatModels.gpt_4o_mini_2024_07_18.
185
- max_tokens (int, optional): Maximum number of tokens to generate. Defaults to 50.
186
- temperature (float, optional): Temperature for sampling, between 0 and 1.
187
- Lower values make output more deterministic. Defaults to 0.
188
-
189
- Returns:
190
- ChatCompletion: The chat completion usage response.
191
- """
192
- endpoint = Endpoint(
193
- f"/llmgateway_/openai/deployments/{model}/chat/completions/usage"
120
+ endpoint = EndpointManager.get_passthrough_endpoint().format(
121
+ model=model, api_version=api_version
194
122
  )
123
+ endpoint = Endpoint("/" + endpoint)
195
124
 
196
125
  request_body = {
197
126
  "messages": messages,
@@ -207,7 +136,7 @@ class UiPathOpenAIService(BaseService):
207
136
  headers=DEFAULT_LLM_HEADERS,
208
137
  )
209
138
 
210
- return UsageInfo.model_validate(response.json())
139
+ return ChatCompletion.model_validate(response.json())
211
140
 
212
141
 
213
142
  class UiPathLlmChatService(BaseService):
@@ -229,6 +158,7 @@ class UiPathLlmChatService(BaseService):
229
158
  top_p: float = 1,
230
159
  tools: Optional[List[ToolDefinition]] = None,
231
160
  tool_choice: Optional[ToolChoice] = None,
161
+ api_version: str = NORMALIZED_API_VERSION,
232
162
  ):
233
163
  """Get chat completions using UiPath's normalized LLM Gateway API.
234
164
 
@@ -250,7 +180,10 @@ class UiPathLlmChatService(BaseService):
250
180
  Returns:
251
181
  ChatCompletion: The chat completion response.
252
182
  """
253
- endpoint = Endpoint("/llmgateway_/api/chat/completions")
183
+ endpoint = EndpointManager.get_normalized_endpoint().format(
184
+ model=model, api_version=api_version
185
+ )
186
+ endpoint = Endpoint("/" + endpoint)
254
187
 
255
188
  request_body = {
256
189
  "messages": messages,
@@ -21,11 +21,6 @@ class TextEmbedding(BaseModel):
21
21
  usage: EmbeddingUsage
22
22
 
23
23
 
24
- class UsageInfo(BaseModel):
25
- encoding: str
26
- prompt_tokens: int
27
-
28
-
29
24
  class ToolCall(BaseModel):
30
25
  id: str
31
26
  name: str
@@ -0,0 +1,5 @@
1
+ from ._endpoints_manager import EndpointManager # noqa: D104
2
+
3
+ __all__ = [
4
+ "EndpointManager",
5
+ ]
@@ -0,0 +1,88 @@
1
+ import logging
2
+ import os
3
+ from enum import Enum
4
+ from typing import Optional
5
+
6
+ import httpx
7
+
8
+ loggger = logging.getLogger(__name__)
9
+
10
+
11
+ class UiPathEndpoints(Enum):
12
+ AH_NORMALIZED_COMPLETION_ENDPOINT = "agenthub_/llm/api/chat/completions"
13
+ AH_PASSTHROUGH_COMPLETION_ENDPOINT = "agenthub_/llm/openai/deployments/{model}/chat/completions?api-version={api_version}"
14
+ AH_EMBEDDING_ENDPOINT = (
15
+ "agenthub_/llm/openai/deployments/{model}/embeddings?api-version={api_version}"
16
+ )
17
+ AH_CAPABILITIES_ENDPOINT = "agenthub_/llm/api/capabilities"
18
+
19
+ NORMALIZED_COMPLETION_ENDPOINT = "llmgateway_/api/chat/completions"
20
+ PASSTHROUGH_COMPLETION_ENDPOINT = "llmgateway_/openai/deployments/{model}/chat/completions?api-version={api_version}"
21
+ EMBEDDING_ENDPOINT = (
22
+ "llmgateway_/openai/deployments/{model}/embeddings?api-version={api_version}"
23
+ )
24
+
25
+
26
+ class EndpointManager:
27
+ """Manages and caches the UiPath endpoints.
28
+ This class provides functionality to determine which UiPath endpoints to use based on
29
+ the availability of AgentHub. It checks for AgentHub capabilities and caches the result
30
+ to avoid repeated network calls.
31
+ Class Attributes:
32
+ _base_url (str): The base URL for UiPath services, retrieved from the UIPATH_URL
33
+ environment variable.
34
+ _agenthub_available (Optional[bool]): Cached result of AgentHub availability check.
35
+
36
+ Methods:
37
+ is_agenthub_available(): Checks if AgentHub is available, caching the result.
38
+ get_passthrough_endpoint(): Returns the appropriate passthrough completion endpoint.
39
+ get_normalized_endpoint(): Returns the appropriate normalized completion endpoint.
40
+ get_embeddings_endpoint(): Returns the appropriate embeddings endpoint.
41
+ All endpoint methods automatically select between AgentHub and standard endpoints
42
+ based on availability.
43
+ """ # noqa: D205
44
+
45
+ _base_url = os.getenv("UIPATH_URL", "")
46
+ _agenthub_available: Optional[bool] = None
47
+
48
+ @classmethod
49
+ def is_agenthub_available(cls) -> bool:
50
+ """Check if AgentHub is available and cache the result."""
51
+ if cls._agenthub_available is None:
52
+ cls._agenthub_available = cls._check_agenthub()
53
+ return cls._agenthub_available
54
+
55
+ @classmethod
56
+ def _check_agenthub(cls) -> bool:
57
+ """Perform the actual check for AgentHub capabilities."""
58
+ try:
59
+ with httpx.Client() as http_client:
60
+ base_url = os.getenv("UIPATH_URL", "")
61
+ capabilities_url = f"{base_url.rstrip('/')}/{UiPathEndpoints.AH_CAPABILITIES_ENDPOINT.value}"
62
+ loggger.debug(f"Checking AgentHub capabilities at {capabilities_url}")
63
+ response = http_client.get(capabilities_url)
64
+ return response.status_code == 200
65
+ except Exception as e:
66
+ loggger.error(f"Error checking AgentHub capabilities: {e}", exc_info=True)
67
+ return False
68
+
69
+ @classmethod
70
+ def get_passthrough_endpoint(cls) -> str:
71
+ if cls.is_agenthub_available():
72
+ return UiPathEndpoints.AH_PASSTHROUGH_COMPLETION_ENDPOINT.value
73
+
74
+ return UiPathEndpoints.PASSTHROUGH_COMPLETION_ENDPOINT.value
75
+
76
+ @classmethod
77
+ def get_normalized_endpoint(cls) -> str:
78
+ if cls.is_agenthub_available():
79
+ return UiPathEndpoints.AH_NORMALIZED_COMPLETION_ENDPOINT.value
80
+
81
+ return UiPathEndpoints.NORMALIZED_COMPLETION_ENDPOINT.value
82
+
83
+ @classmethod
84
+ def get_embeddings_endpoint(cls) -> str:
85
+ if cls.is_agenthub_available():
86
+ return UiPathEndpoints.AH_EMBEDDING_ENDPOINT.value
87
+
88
+ return UiPathEndpoints.EMBEDDING_ENDPOINT.value
@@ -74,20 +74,6 @@ class TestLLMIntegration:
74
74
  assert hasattr(result, "usage")
75
75
  assert result.usage.prompt_tokens > 0
76
76
 
77
- @pytest.mark.asyncio
78
- async def test_embeddings_usage_real(self, llm_service):
79
- """Test the embeddings_usage function with a real API call."""
80
- input_text = "Testing the embedding usage endpoint."
81
-
82
- # Make the actual API call
83
- result = await llm_service.embeddings_usage(input=input_text)
84
-
85
- # Validate the response
86
- assert result is not None
87
- assert hasattr(result, "encoding")
88
- assert hasattr(result, "prompt_tokens")
89
- assert result.prompt_tokens > 0
90
-
91
77
  @pytest.mark.asyncio
92
78
  async def test_chat_completions_real(self, llm_service):
93
79
  """Test the chat_completions function with a real API call."""
@@ -115,31 +101,6 @@ class TestLLMIntegration:
115
101
  assert hasattr(result, "usage")
116
102
  assert result.usage.prompt_tokens > 0
117
103
 
118
- @pytest.mark.asyncio
119
- async def test_chat_completions_usage_real(self, llm_service):
120
- """Test the chat_completions_usage function with a real API call."""
121
- messages = [
122
- {"role": "system", "content": "You are a helpful assistant."},
123
- {"role": "user", "content": "What is the capital of France?"},
124
- ]
125
-
126
- # Make the actual API call
127
- result = await llm_service.chat_completions_usage(
128
- messages=messages,
129
- model=ChatModels.gpt_4o_mini_2024_07_18,
130
- max_tokens=50,
131
- temperature=0.7,
132
- )
133
-
134
- # Validate the response
135
- assert result is not None
136
- assert hasattr(result, "encoding")
137
- assert hasattr(result, "prompt_tokens")
138
- assert result.prompt_tokens > 0
139
- assert isinstance(result.prompt_tokens, int)
140
- assert isinstance(result.encoding, str)
141
- assert len(result.encoding) > 0
142
-
143
104
  @pytest.mark.asyncio
144
105
  async def test_embeddings_with_custom_model_real(self, llm_service):
145
106
  """Test the embeddings function with a custom model."""
@@ -1,4 +1,3 @@
1
- import json
2
1
  from unittest.mock import MagicMock, patch
3
2
 
4
3
  import pytest
@@ -9,10 +8,7 @@ from uipath._services.llm_gateway_service import (
9
8
  EmbeddingModels,
10
9
  UiPathOpenAIService,
11
10
  )
12
- from uipath.models.llm_gateway import (
13
- TextEmbedding,
14
- UsageInfo,
15
- )
11
+ from uipath.models.llm_gateway import TextEmbedding
16
12
 
17
13
 
18
14
  class TestOpenAIService:
@@ -35,26 +31,6 @@ class TestOpenAIService:
35
31
  assert service._config == config
36
32
  assert service._execution_context == execution_context
37
33
 
38
- @patch.object(UiPathOpenAIService, "request_async")
39
- @pytest.mark.asyncio
40
- async def test_embeddings_usage(self, mock_request, openai_service):
41
- # Mock response
42
- mock_response = MagicMock()
43
- mock_response.json.return_value = {
44
- "encoding": "cl100k_base",
45
- "prompt_tokens": 4,
46
- }
47
- mock_request.return_value = mock_response
48
-
49
- # Call the method
50
- result = await openai_service.embeddings_usage(input="Test input")
51
-
52
- # Assertions
53
- mock_request.assert_called_once()
54
- assert isinstance(result, UsageInfo)
55
- assert result.encoding == "cl100k_base"
56
- assert result.prompt_tokens == 4
57
-
58
34
  @patch.object(UiPathOpenAIService, "request_async")
59
35
  @pytest.mark.asyncio
60
36
  async def test_embeddings(self, mock_request, openai_service):
@@ -78,40 +54,6 @@ class TestOpenAIService:
78
54
  assert result.model == "text-embedding-ada-002"
79
55
  assert result.usage.prompt_tokens == 4
80
56
 
81
- @patch.object(UiPathOpenAIService, "request_async")
82
- @pytest.mark.asyncio
83
- async def test_chat_completions_usage(self, mock_request, openai_service):
84
- # Mock response
85
- mock_response = MagicMock()
86
- mock_response.json.return_value = {
87
- "encoding": "cl100k_base",
88
- "prompt_tokens": 10,
89
- }
90
- mock_request.return_value = mock_response
91
-
92
- # Test messages
93
- messages = [
94
- {"role": "system", "content": "You are a helpful assistant"},
95
- {"role": "user", "content": "Hello"},
96
- ]
97
-
98
- # Call the method
99
- result = await openai_service.chat_completions_usage(
100
- messages=messages, max_tokens=50, temperature=0.5
101
- )
102
-
103
- # Assertions
104
- mock_request.assert_called_once()
105
- assert isinstance(result, UsageInfo)
106
- assert result.encoding == "cl100k_base"
107
- assert result.prompt_tokens == 10
108
-
109
- # Verify the correct endpoint was called
110
- args, kwargs = mock_request.call_args
111
- assert json.loads(kwargs["content"])["messages"] == messages
112
- assert json.loads(kwargs["content"])["max_tokens"] == 50
113
- assert json.loads(kwargs["content"])["temperature"] == 0.5
114
-
115
57
  @patch.object(UiPathOpenAIService, "request_async")
116
58
  @pytest.mark.asyncio
117
59
  async def test_embeddings_with_custom_model(self, mock_request, openai_service):
@@ -3270,7 +3270,7 @@ wheels = [
3270
3270
 
3271
3271
  [[package]]
3272
3272
  name = "uipath"
3273
- version = "2.0.74"
3273
+ version = "2.0.75"
3274
3274
  source = { editable = "." }
3275
3275
  dependencies = [
3276
3276
  { name = "azure-monitor-opentelemetry" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes