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
32 changes: 2 additions & 30 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,8 @@ See `just --list` for linting, formatting and build commands.
### Use SDK Locally
1. Create a folder on your own device `mkdir project; cd project`
2. Initialize the python project `uv` `uv init . --python 3.9`
3. Obtain the project path `PATH_TO_SDK=/Users/YOU_USER/platform-sdk/sdk/core`
3. Obtain the project path `PATH_TO_SDK=/Users/YOU_USER/uipath-langchain/`
4. Install the sdk in editable mode `uv add --editable ${PATH_TO_SDK}`

:information_source: Instead of cloning the project into `.venv/lib/python3.9/site-packages/uipath_sdk`, this mode creates a file named `_uipath_sdk.pth` inside `.venv/lib/python3.9/site-packages`. This file contains the value of `PATH_TO_SDK`, which is added to `sys.path`—the list of directories where python searches for packages. (Run `python -c 'import sys; print(sys.path)'` to see the entries.)
:information_source: Instead of cloning the project into `.venv/lib/python3.9/site-packages/uipath_langchain`, this mode creates a file named `_uipath_langchain.pth` inside `.venv/lib/python3.9/site-packages`. This file contains the value of `PATH_TO_SDK`, which is added to `sys.path`—the list of directories where python searches for packages. (Run `python -c 'import sys; print(sys.path)'` to see the entries.)

## API Style Guide

### General Rule:
- use key instead of ID

### Standard Methods & Naming Conventions

#### Retrieve a Single Resource
- **Method Name:** `retrieve` instead of get
- **Usage:** To obtain a specific resource instance using its unique identifier (using *key* instead of ID).
- **Extended:**
- `retrieve_by_[field_name]` (for fields other than key)

#### List Multiple Resources
- **Method Name:** `list`
- **Usage:** To fetch a collection of resources, optionally filtered by query parameters.
- **Example:**
```python
resources = Resource.list(filters={})
```

#### Create a Resource
- **Method Name:** `create`
- **Usage:** To add a new resource to the system.

#### Update a Resource
- **Method Name:** `update`
- **Usage:** To modify an existing resource.
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[project]
name = "uipath-langchain"
version = "0.0.86"
version = "0.0.87"
description = "UiPath Langchain"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.10"
dependencies = [
"uipath-sdk==0.0.112",
"uipath==2.0.1",
"langgraph>=0.2.70",
"langchain-core>=0.3.34",
"langgraph-checkpoint-sqlite>=2.0.3",
"langchain-community>=0.3.18",
"langchain-community>=0.3.21",
"langchain-openai>=0.3.3",
"langchain>=0.3.4",
"requests>=2.23.3",
Expand All @@ -33,7 +33,7 @@ maintainers = [
{ name = "Cristian Pufu", email = "cristian.pufu@uipath.com" }
]

[project.entry-points."uipath_sdk.middlewares"]
[project.entry-points."uipath.middlewares"]
register = "uipath_langchain.middlewares:register_middleware"

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from langgraph.types import Command, interrupt
from pydantic import BaseModel, Field
from typing_extensions import TypedDict
from uipath_sdk._models import InvokeProcess
from uipath._models import InvokeProcess

worker_agents = {"researcher": "researcher-agent", "coder": "coder-agent"}
agent_names = list(worker_agents.values())
Expand Down
2 changes: 1 addition & 1 deletion src/uipath_langchain/_cli/_runtime/_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
from langgraph.graph import StateGraph
from uipath_sdk._cli._runtime._contracts import UiPathRuntimeContext
from uipath._cli._runtime._contracts import UiPathRuntimeContext

from .._utils._graph import LangGraphConfig

Expand Down
6 changes: 3 additions & 3 deletions src/uipath_langchain/_cli/_runtime/_escalation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from pathlib import Path
from typing import Any, Dict, Optional, Union

from uipath_sdk import UiPathSDK
from uipath_sdk._models.actions import Action
from uipath import UiPath
from uipath._models.actions import Action

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -230,7 +230,7 @@ async def create(self, value: Any) -> Optional[Action]:
return None

try:
uipath = UiPathSDK()
uipath = UiPath()
action = uipath.actions.create(
title=self._config.get("title", "Default escalation"),
app_name=self._config.get("appName"),
Expand Down
2 changes: 1 addition & 1 deletion src/uipath_langchain/_cli/_runtime/_exception.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional

from uipath_sdk._cli._runtime._contracts import UiPathErrorCategory, UiPathRuntimeError
from uipath._cli._runtime._contracts import UiPathErrorCategory, UiPathRuntimeError


class LangGraphRuntimeError(UiPathRuntimeError):
Expand Down
6 changes: 3 additions & 3 deletions src/uipath_langchain/_cli/_runtime/_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import Any, Optional, cast

from langgraph.types import Command
from uipath_sdk import UiPathSDK
from uipath_sdk._cli._runtime._contracts import (
from uipath import UiPath
from uipath._cli._runtime._contracts import (
UiPathErrorCategory,
UiPathResumeTriggerType,
UiPathRuntimeStatus,
Expand Down Expand Up @@ -39,7 +39,7 @@ def __init__(self, context: LangGraphRuntimeContext):
"""
self.context = context
self.escalation = Escalation(self.context.config_path)
self.uipath = UiPathSDK()
self.uipath = UiPath()

async def process(self) -> Any:
"""
Expand Down
10 changes: 5 additions & 5 deletions src/uipath_langchain/_cli/_runtime/_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
from typing import Any, Dict, Optional, Union, cast

from langgraph.types import Interrupt, StateSnapshot
from uipath_sdk import UiPathSDK
from uipath_sdk._cli._runtime._contracts import (
from uipath import UiPath
from uipath._cli._runtime._contracts import (
UiPathApiTrigger,
UiPathErrorCategory,
UiPathResumeTrigger,
UiPathResumeTriggerType,
UiPathRuntimeResult,
UiPathRuntimeStatus,
)
from uipath_sdk._models import CreateAction, InvokeProcess, WaitAction, WaitJob
from uipath_sdk._models.actions import Action
from uipath._models import CreateAction, InvokeProcess, WaitAction, WaitJob
from uipath._models.actions import Action

from ._context import LangGraphRuntimeContext
from ._escalation import Escalation
Expand Down Expand Up @@ -256,7 +256,7 @@ async def _save_resume_trigger(self) -> None:
)
return
if isinstance(self.interrupt_info, InterruptInfo):
uipath_sdk = UiPathSDK()
uipath_sdk = UiPath()
if self.interrupt_info.type is UiPathResumeTriggerType.JOB:
if isinstance(self.interrupt_value, InvokeProcess):
job = await uipath_sdk.processes.invoke_async(
Expand Down
2 changes: 1 addition & 1 deletion src/uipath_langchain/_cli/_runtime/_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
from langgraph.errors import EmptyInputError, GraphRecursionError, InvalidUpdateError
from langgraph.graph.state import CompiledStateGraph
from uipath_sdk._cli._runtime._contracts import (
from uipath._cli._runtime._contracts import (
UiPathBaseRuntime,
UiPathErrorCategory,
UiPathRuntimeResult,
Expand Down
4 changes: 2 additions & 2 deletions src/uipath_langchain/_cli/cli_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from typing import Any, Dict

from langgraph.graph.state import CompiledStateGraph
from uipath_sdk._cli._utils._parse_ast import generate_bindings_json # type: ignore
from uipath_sdk._cli.middlewares import MiddlewareResult
from uipath._cli._utils._parse_ast import generate_bindings_json # type: ignore
from uipath._cli.middlewares import MiddlewareResult

from ._utils._graph import LangGraphConfig

Expand Down
4 changes: 2 additions & 2 deletions src/uipath_langchain/_cli/cli_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from typing import Optional

from dotenv import load_dotenv
from uipath_sdk._cli._runtime._contracts import UiPathTraceContext
from uipath_sdk._cli.middlewares import MiddlewareResult
from uipath._cli._runtime._contracts import UiPathTraceContext
from uipath._cli.middlewares import MiddlewareResult

from ._runtime._context import LangGraphRuntimeContext
from ._runtime._exception import LangGraphRuntimeError
Expand Down
2 changes: 1 addition & 1 deletion src/uipath_langchain/middlewares.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from uipath_sdk._cli.middlewares import Middlewares
from uipath._cli.middlewares import Middlewares

from ._cli.cli_init import langgraph_init_middleware
from ._cli.cli_run import langgraph_run_middleware
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
)
from langchain_core.documents import Document
from langchain_core.retrievers import BaseRetriever
from uipath_sdk import UiPathSDK
from uipath import UiPath


class ContextGroundingRetriever(BaseRetriever):
index_name: str
uipath_sdk: Optional[UiPathSDK] = None
uipath_sdk: Optional[UiPath] = None
number_of_results: Optional[int] = 10

def _get_relevant_documents(
self, query: str, *, run_manager: CallbackManagerForRetrieverRun
) -> List[Document]:
"""Sync implementations for retriever calls context_grounding API to search the requested index."""

sdk = self.uipath_sdk if self.uipath_sdk is not None else UiPathSDK()
sdk = self.uipath_sdk if self.uipath_sdk is not None else UiPath()
results = sdk.context_grounding.search(
self.index_name,
query,
Expand All @@ -42,7 +42,7 @@ async def _aget_relevant_documents(
) -> List[Document]:
"""Async implementations for retriever calls context_grounding API to search the requested index."""

sdk = self.uipath_sdk if self.uipath_sdk is not None else UiPathSDK()
sdk = self.uipath_sdk if self.uipath_sdk is not None else UiPath()
results = await sdk.context_grounding.search_async(
self.index_name,
query,
Expand Down
2 changes: 1 addition & 1 deletion src/uipath_langchain/tracers/AsyncUiPathTracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from langchain_core.tracers.base import AsyncBaseTracer
from langchain_core.tracers.schemas import Run
from pydantic import PydanticDeprecationWarning
from uipath_sdk._cli._runtime._contracts import UiPathTraceContext
from uipath._cli._runtime._contracts import UiPathTraceContext

from ._events import CustomTraceEvents, FunctionCallEventData
from ._utils import _setup_tracer_httpx_logging, _simple_serialize_defaults
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.vectorstores import VectorStore
from uipath_sdk import UiPathSDK
from uipath import UiPath

VST = TypeVar("VST", bound="ContextGroundingVectorStore")

Expand Down Expand Up @@ -44,7 +44,7 @@ class ContextGroundingVectorStore(VectorStore):
def __init__(
self,
index_name: str,
uipath_sdk: Optional[UiPathSDK] = None,
uipath_sdk: Optional[UiPath] = None,
):
"""Initialize the ContextGroundingVectorStore.

Expand All @@ -53,7 +53,7 @@ def __init__(
uipath_sdk: Optional SDK instance to use. If not provided, a new instance will be created.
"""
self.index_name = index_name
self.sdk = uipath_sdk or UiPathSDK()
self.sdk = uipath_sdk or UiPath()

def similarity_search_with_score(
self, query: str, k: int = 4, **kwargs: Any
Expand Down
Loading
Loading