Skip to content

Commit 8d85ce5

Browse files
committed
fix(load_dotenv): remove load_dotenv()
1 parent 255be9f commit 8d85ce5

5 files changed

Lines changed: 0 additions & 26 deletions

File tree

samples/action-center-hitl-agent/main.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import json
22

3-
from dotenv import load_dotenv
43
from llama_index.core.agent.workflow import AgentWorkflow
54
from llama_index.core.workflow import (
65
Context,
@@ -10,8 +9,6 @@
109

1110
from uipath_llamaindex.models import CreateActionEvent
1211

13-
load_dotenv()
14-
1512
llm = OpenAI(model="gpt-4o-mini")
1613

1714

samples/multi-agent/main.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import json
22

3-
from dotenv import load_dotenv
43
from llama_index.core.agent.workflow import AgentWorkflow
54
from llama_index.core.workflow import (
65
Context,
@@ -10,8 +9,6 @@
109

1110
from uipath_llamaindex.models import InvokeProcessEvent
1211

13-
load_dotenv()
14-
1512
llm = OpenAI(model="gpt-4o-mini")
1613

1714

samples/quickstart-llamacloud/main.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import os
22

3-
from dotenv import load_dotenv
43
from llama_cloud_services import LlamaCloudIndex
54
from llama_index.core.agent.workflow import FunctionAgent
65
from llama_index.llms.openai import OpenAI
76
from pydantic import BaseModel, Field
87

9-
load_dotenv()
10-
118
# Initialize LlamaCloud Index connections
129
company_policy_index = LlamaCloudIndex(
1310
name=os.getenv("LLAMACLOUD_INDEX_1_NAME"),

src/uipath_llamaindex/_cli/_utils/_config.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from pathlib import Path
99
from typing import Any, Dict, List, Optional
1010

11-
from dotenv import load_dotenv
1211
from llama_index.core.workflow import Workflow
1312

1413
logger = logging.getLogger(__name__)
@@ -134,19 +133,6 @@ def load_config(self) -> Dict[str, Any]:
134133
raise ValueError(
135134
f"Missing required fields in llama_index.json: {missing_fields}"
136135
)
137-
138-
if env_file := config.get("env"):
139-
env_path = os.path.abspath(os.path.normpath(env_file))
140-
if os.path.exists(env_path):
141-
if not load_dotenv(env_path):
142-
# log warning only if dotenv is not empty
143-
if os.path.getsize(env_path) > 0:
144-
logger.warning(
145-
f"Could not load environment variables from {env_path}"
146-
)
147-
else:
148-
logger.debug(f"Loaded environment variables from {env_path}")
149-
150136
self._config = config
151137
self._load_workflows()
152138
return config

src/uipath_llamaindex/_cli/cli_run.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from os import environ as env
44
from typing import Optional
55

6-
from dotenv import load_dotenv
76
from openinference.instrumentation.llama_index import (
87
LlamaIndexInstrumentor,
98
get_current_span,
@@ -18,8 +17,6 @@
1817
from ._utils._config import LlamaIndexConfig
1918

2019
logger = logging.getLogger(__name__)
21-
load_dotenv()
22-
2320

2421
def llamaindex_run_middleware(
2522
entrypoint: Optional[str], input: Optional[str], resume: bool, **kwargs

0 commit comments

Comments
 (0)