uipath-langchain 0.1.28__py3-none-any.whl → 0.3.1__py3-none-any.whl

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.
Files changed (60) hide show
  1. uipath_langchain/_cli/_templates/langgraph.json.template +2 -4
  2. uipath_langchain/_cli/cli_new.py +1 -2
  3. uipath_langchain/_utils/_request_mixin.py +8 -0
  4. uipath_langchain/_utils/_settings.py +3 -2
  5. uipath_langchain/agent/guardrails/__init__.py +0 -16
  6. uipath_langchain/agent/guardrails/actions/__init__.py +2 -0
  7. uipath_langchain/agent/guardrails/actions/block_action.py +1 -1
  8. uipath_langchain/agent/guardrails/actions/escalate_action.py +265 -138
  9. uipath_langchain/agent/guardrails/actions/filter_action.py +290 -0
  10. uipath_langchain/agent/guardrails/actions/log_action.py +1 -1
  11. uipath_langchain/agent/guardrails/guardrail_nodes.py +193 -42
  12. uipath_langchain/agent/guardrails/guardrails_factory.py +235 -14
  13. uipath_langchain/agent/guardrails/types.py +0 -12
  14. uipath_langchain/agent/guardrails/utils.py +177 -0
  15. uipath_langchain/agent/react/agent.py +24 -9
  16. uipath_langchain/agent/react/constants.py +1 -2
  17. uipath_langchain/agent/react/file_type_handler.py +123 -0
  18. uipath_langchain/agent/{guardrails → react/guardrails}/guardrails_subgraph.py +119 -25
  19. uipath_langchain/agent/react/init_node.py +16 -1
  20. uipath_langchain/agent/react/job_attachments.py +125 -0
  21. uipath_langchain/agent/react/json_utils.py +183 -0
  22. uipath_langchain/agent/react/jsonschema_pydantic_converter.py +76 -0
  23. uipath_langchain/agent/react/llm_node.py +41 -10
  24. uipath_langchain/agent/react/llm_with_files.py +76 -0
  25. uipath_langchain/agent/react/router.py +48 -37
  26. uipath_langchain/agent/react/types.py +19 -1
  27. uipath_langchain/agent/react/utils.py +30 -4
  28. uipath_langchain/agent/tools/__init__.py +7 -1
  29. uipath_langchain/agent/tools/context_tool.py +151 -1
  30. uipath_langchain/agent/tools/escalation_tool.py +46 -15
  31. uipath_langchain/agent/tools/integration_tool.py +20 -16
  32. uipath_langchain/agent/tools/internal_tools/__init__.py +5 -0
  33. uipath_langchain/agent/tools/internal_tools/analyze_files_tool.py +113 -0
  34. uipath_langchain/agent/tools/internal_tools/internal_tool_factory.py +54 -0
  35. uipath_langchain/agent/tools/mcp_tool.py +86 -0
  36. uipath_langchain/agent/tools/process_tool.py +8 -1
  37. uipath_langchain/agent/tools/static_args.py +18 -40
  38. uipath_langchain/agent/tools/tool_factory.py +13 -5
  39. uipath_langchain/agent/tools/tool_node.py +133 -4
  40. uipath_langchain/agent/tools/utils.py +31 -0
  41. uipath_langchain/agent/wrappers/__init__.py +6 -0
  42. uipath_langchain/agent/wrappers/job_attachment_wrapper.py +62 -0
  43. uipath_langchain/agent/wrappers/static_args_wrapper.py +34 -0
  44. uipath_langchain/chat/__init__.py +4 -0
  45. uipath_langchain/chat/bedrock.py +16 -0
  46. uipath_langchain/chat/mapper.py +60 -42
  47. uipath_langchain/chat/openai.py +56 -26
  48. uipath_langchain/chat/supported_models.py +9 -0
  49. uipath_langchain/chat/vertex.py +62 -46
  50. uipath_langchain/embeddings/embeddings.py +18 -12
  51. uipath_langchain/runtime/factory.py +10 -5
  52. uipath_langchain/runtime/runtime.py +38 -35
  53. uipath_langchain/runtime/schema.py +72 -16
  54. uipath_langchain/runtime/storage.py +178 -71
  55. {uipath_langchain-0.1.28.dist-info → uipath_langchain-0.3.1.dist-info}/METADATA +7 -4
  56. uipath_langchain-0.3.1.dist-info/RECORD +90 -0
  57. uipath_langchain-0.1.28.dist-info/RECORD +0 -76
  58. {uipath_langchain-0.1.28.dist-info → uipath_langchain-0.3.1.dist-info}/WHEEL +0 -0
  59. {uipath_langchain-0.1.28.dist-info → uipath_langchain-0.3.1.dist-info}/entry_points.txt +0 -0
  60. {uipath_langchain-0.1.28.dist-info → uipath_langchain-0.3.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,7 +1,5 @@
1
1
  {
2
- "dependencies": ["."],
3
2
  "graphs": {
4
3
  "agent": "./main.py:graph"
5
- },
6
- "env": ".env"
7
- }
4
+ }
5
+ }
@@ -31,7 +31,7 @@ version = "0.0.1"
31
31
  description = "{project_name}"
32
32
  authors = [{{ name = "John Doe", email = "john.doe@myemail.com" }}]
33
33
  dependencies = [
34
- "uipath-langchain>=0.1.0",
34
+ "uipath-langchain>=0.2.0",
35
35
  ]
36
36
  requires-python = ">=3.11"
37
37
  """
@@ -47,7 +47,6 @@ def langgraph_new_middleware(name: str) -> MiddlewareResult:
47
47
 
48
48
  try:
49
49
  with console.spinner(f"Creating new agent {name} in current directory ..."):
50
- generate_pyproject(directory, name)
51
50
  generate_script(directory)
52
51
  console.success("Created 'main.py' file.")
53
52
  console.success("Created 'langgraph.json' file.")
@@ -137,6 +137,8 @@ class UiPathRequestMixin(BaseModel):
137
137
  max_tokens: int | None = 1000
138
138
  frequency_penalty: float | None = None
139
139
  presence_penalty: float | None = None
140
+ agenthub_config: str | None = None
141
+ byo_connection_id: str | None = None
140
142
 
141
143
  logger: logging.Logger | None = None
142
144
  max_retries: int | None = 5
@@ -748,6 +750,12 @@ class UiPathRequestMixin(BaseModel):
748
750
  "Authorization": f"Bearer {self.access_token}",
749
751
  "X-UiPath-LlmGateway-TimeoutSeconds": str(self.default_request_timeout),
750
752
  }
753
+ if self.agenthub_config:
754
+ self._auth_headers["X-UiPath-AgentHub-Config"] = self.agenthub_config
755
+ if self.byo_connection_id:
756
+ self._auth_headers["X-UiPath-LlmGateway-ByoIsConnectionId"] = (
757
+ self.byo_connection_id
758
+ )
751
759
  if self.is_normalized and self.model_name:
752
760
  self._auth_headers["X-UiPath-LlmGateway-NormalizedApi-ModelName"] = (
753
761
  self.model_name
@@ -5,6 +5,7 @@ from typing import Any
5
5
  import httpx
6
6
  from pydantic import Field
7
7
  from pydantic_settings import BaseSettings
8
+ from uipath._utils._ssl_context import get_httpx_client_kwargs
8
9
 
9
10
 
10
11
  class UiPathCachedPathsSettings(BaseSettings):
@@ -58,7 +59,7 @@ def get_uipath_token_header(
58
59
  client_secret=settings.client_secret,
59
60
  grant_type="client_credentials",
60
61
  )
61
- with httpx.Client() as client:
62
+ with httpx.Client(**get_httpx_client_kwargs()) as client:
62
63
  res = client.post(url_get_token, data=token_credentials)
63
64
  res_json = res.json()
64
65
  uipath_token_header = res_json.get("access_token")
@@ -79,7 +80,7 @@ async def get_token_header_async(
79
80
  grant_type="client_credentials",
80
81
  )
81
82
 
82
- with httpx.Client() as client:
83
+ with httpx.Client(**get_httpx_client_kwargs()) as client:
83
84
  res_json = client.post(url_get_token, data=token_credentials).json()
84
85
  uipath_token_header = res_json.get("access_token")
85
86
 
@@ -1,21 +1,5 @@
1
- from .guardrail_nodes import (
2
- create_agent_guardrail_node,
3
- create_llm_guardrail_node,
4
- create_tool_guardrail_node,
5
- )
6
1
  from .guardrails_factory import build_guardrails_with_actions
7
- from .guardrails_subgraph import (
8
- create_agent_guardrails_subgraph,
9
- create_llm_guardrails_subgraph,
10
- create_tool_guardrails_subgraph,
11
- )
12
2
 
13
3
  __all__ = [
14
- "create_llm_guardrails_subgraph",
15
- "create_agent_guardrails_subgraph",
16
- "create_tool_guardrails_subgraph",
17
- "create_llm_guardrail_node",
18
- "create_agent_guardrail_node",
19
- "create_tool_guardrail_node",
20
4
  "build_guardrails_with_actions",
21
5
  ]
@@ -1,6 +1,7 @@
1
1
  from .base_action import GuardrailAction
2
2
  from .block_action import BlockAction
3
3
  from .escalate_action import EscalateAction
4
+ from .filter_action import FilterAction
4
5
  from .log_action import LogAction
5
6
 
6
7
  __all__ = [
@@ -8,4 +9,5 @@ __all__ = [
8
9
  "BlockAction",
9
10
  "LogAction",
10
11
  "EscalateAction",
12
+ "FilterAction",
11
13
  ]
@@ -6,7 +6,7 @@ from uipath.runtime.errors import UiPathErrorCategory, UiPathErrorCode
6
6
  from uipath_langchain.agent.guardrails.types import ExecutionStage
7
7
 
8
8
  from ...exceptions import AgentTerminationException
9
- from ..types import AgentGuardrailsGraphState
9
+ from ...react.types import AgentGuardrailsGraphState
10
10
  from .base_action import GuardrailAction, GuardrailActionNode
11
11
 
12
12