Skip to content

Commit 60a674a

Browse files
authored
fix: instantiate llm inside node in langgraph scaffold template (#897)
1 parent 455b547 commit 60a674a

6 files changed

Lines changed: 22 additions & 11 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-langchain"
3-
version = "0.11.15"
3+
version = "0.11.16"
44
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath_langchain/_cli/_templates/main.py.template

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
from langchain_core.messages import HumanMessage, SystemMessage
22
from langgraph.graph import START, StateGraph, END
3-
from uipath_langchain.chat import UiPathChat
3+
from uipath_langchain.chat import (
4+
UiPathAzureChatOpenAI,
5+
UiPathChatAnthropicBedrock,
6+
UiPathChatGoogleGenerativeAI,
7+
)
48
from pydantic import BaseModel
59

6-
llm = UiPathChat(model="gpt-4o-mini-2024-07-18")
7-
810

911
class GraphState(BaseModel):
1012
topic: str
@@ -15,6 +17,10 @@ class GraphOutput(BaseModel):
1517

1618

1719
async def generate_report(state: GraphState) -> GraphOutput:
20+
# Choose your LLM provider by uncommenting one of the following:
21+
llm = UiPathChatAnthropicBedrock(model="anthropic.claude-haiku-4-5-20251001-v1:0")
22+
# llm = UiPathAzureChatOpenAI(model="gpt-4.1-mini-2025-04-14")
23+
# llm = UiPathChatGoogleGenerativeAI(model="gemini-2.5-flash")
1824
system_prompt = "You are a report generator. Please provide a brief report based on the given topic."
1925
output = await llm.ainvoke(
2026
[SystemMessage(system_prompt), HumanMessage(state.topic)]

src/uipath_langchain/_cli/cli_new.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def generate_pyproject(target_directory, project_name):
3131
description = "{project_name}"
3232
authors = [{{ name = "John Doe", email = "john.doe@myemail.com" }}]
3333
dependencies = [
34-
"uipath-langchain>=0.10.0, <0.11.0",
34+
"uipath-langchain[bedrock,vertex]>=0.10.0, <0.11.0",
3535
]
3636
requires-python = ">=3.11"
3737
"""

testcases/init-flow/expected_traces.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@
1414
}
1515
},
1616
{
17-
"name": "UiPathChat",
17+
"name": [
18+
"UiPathChatAnthropicBedrock",
19+
"UiPathChatBedrockConverse",
20+
"UiPathChatBedrock",
21+
"UiPathAzureChatOpenAI",
22+
"UiPathChatGoogleGenerativeAI",
23+
"UiPathChat"
24+
],
1825
"attributes": {
19-
"openinference.span.kind": "LLM",
20-
"llm.provider": "uipath",
21-
"llm.model_name": "*"
26+
"openinference.span.kind": "LLM"
2227
}
2328
}
2429
]

testcases/init-flow/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "agent"
55
authors = [{ name = "John Doe", email = "john.doe@myemail.com" }]
66
dependencies = [
77
"langchain-anthropic>=0.3.8",
8-
"uipath-langchain",
8+
"uipath-langchain[bedrock,vertex]",
99
]
1010
requires-python = ">=3.11"
1111

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)