Skip to content

Commit 52b00b2

Browse files
authored
Merge pull request #71 from UiPath/chore/getting-started
chore: CLI initialize project in a different step
2 parents c832cf2 + d6c3a7e commit 52b00b2

File tree

5 files changed

+31
-19
lines changed

5 files changed

+31
-19
lines changed

docs/quick_start.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ Activate with: source .venv/bin/activate
6767
# For Windows Bash: source .venv/Scripts/activate
6868
> source .venv/bin/activate
6969

70+
# Install the langchain anthropic package
71+
> uv add langchain-anthropic
72+
7073
# Install the uipath package
7174
> uv add uipath-langchain
7275

@@ -93,6 +96,9 @@ uipath-langchain version 0.0.100
9396
# Upgrade pip to the latest version
9497
> python -m pip install --upgrade pip
9598

99+
# Install the langchain anthropic package
100+
> pip install langchain-anthropic
101+
96102
# Install the uipath package
97103
> pip install uipath-langchain
98104

@@ -115,16 +121,8 @@ Generate your first UiPath LangChain agent:
115121
✓ Created 'main.py' file.
116122
✓ Created 'langgraph.json' file.
117123
✓ Created 'pyproject.toml' file.
118-
Resolved 90 packages in 351ms
119-
Prepared 2 packages in 213ms
120-
Installed 2 packages in 3ms
121-
+ anthropic==0.50.0
122-
+ langchain-anthropic==0.3.12
123-
⠧ Initializing UiPath project ...
124-
✓ Created '.env' file.
125-
✓ Created 'agent.mermaid' file.
126-
✓ Created 'uipath.json' file.
127124
🔧 Please ensure to define either ANTHROPIC_API_KEY or OPENAI_API_KEY in your .env file.
125+
💡 Initialize project: uipath init
128126
💡 Run agent: uipath run agent '{"topic": "UiPath"}'
129127
```
130128

@@ -138,6 +136,18 @@ This command creates the following files:
138136
| `langgraph.json` | [LangGraph](https://langchain-ai.github.io/langgraph/concepts/application_structure/#file-structure) specific configuration file. |
139137
| `agent.mermaid` | Graph visual representation. |
140138

139+
## Initialize project
140+
141+
<!-- termynal -->
142+
143+
```shell
144+
> uipath init
145+
⠋ Initializing UiPath project ...
146+
✓ Created '.env' file.
147+
✓ Created 'agent.mermaid' file.
148+
✓ Created 'uipath.json' file.
149+
```
150+
141151
## Set Up Environment Variables
142152

143153
Before running the agent, configure either `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` in the `.env` file:

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.0.105"
3+
version = "0.0.106"
44
description = "UiPath Langchain"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.10"

src/uipath_langchain/_cli/_utils/_graph.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,11 @@ def load_config(self) -> Dict[str, Any]:
155155
env_path = os.path.abspath(os.path.normpath(env_file))
156156
if os.path.exists(env_path):
157157
if not load_dotenv(env_path):
158-
logger.warning(
159-
f"Could not load environment variables from {env_path}"
160-
)
158+
# log warning only if dotenv is not empty
159+
if os.path.getsize(env_path) > 0:
160+
logger.warning(
161+
f"Could not load environment variables from {env_path}"
162+
)
161163
else:
162164
logger.debug(f"Loaded environment variables from {env_path}")
163165

src/uipath_langchain/_cli/cli_new.py

Lines changed: 5 additions & 5 deletions
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.0.95",
34+
"uipath-langchain>=0.0.106",
3535
"langchain-anthropic>=0.3.8",
3636
]
3737
requires-python = ">=3.10"
@@ -54,14 +54,14 @@ def langgraph_new_middleware(name: str) -> MiddlewareResult:
5454
console.success("Created 'langgraph.json' file.")
5555
generate_pyproject(directory, name)
5656
console.success("Created 'pyproject.toml' file.")
57-
os.system("uv sync")
58-
ctx = click.get_current_context()
59-
init_cmd = ctx.parent.command.get_command(ctx, "init") # type: ignore
60-
ctx.invoke(init_cmd)
6157
console.config(
6258
f""" Please ensure to define either {click.style("ANTHROPIC_API_KEY", fg="bright_yellow")} or {click.style("OPENAI_API_KEY", fg="bright_yellow")} in your .env file. """
6359
)
60+
init_command = """uipath init"""
6461
run_command = """uipath run agent '{"topic": "UiPath"}'"""
62+
console.hint(
63+
f""" Initialize project: {click.style(init_command, fg="cyan")}"""
64+
)
6565
console.hint(f""" Run agent: {click.style(run_command, fg="cyan")}""")
6666
return MiddlewareResult(should_continue=False)
6767
except Exception as e:

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)