Mohammed-Altaf commited on
Commit
841cdde
·
1 Parent(s): 5ef9065

fix dot env load issue in inference.py

Browse files
Files changed (1) hide show
  1. inference.py +7 -3
inference.py CHANGED
@@ -1,6 +1,12 @@
1
  from typing import Any, List
2
 
3
- from dotenv import load_dotenv
 
 
 
 
 
 
4
  from openai import OpenAI
5
 
6
  from client import DataAnalysisClient
@@ -10,8 +16,6 @@ from helpers.prompts import SYSTEM_PROMPT
10
  from helpers.response_parser import FALLBACK_ACTION, parse_model_action
11
  from models import DataAction
12
 
13
- load_dotenv()
14
-
15
 
16
  def run_task(openai_client: OpenAI, env_client: Any, task_id: int) -> float:
17
  """Run a single task episode using the language model as the agent.
 
1
  from typing import Any, List
2
 
3
+ try:
4
+ from dotenv import load_dotenv
5
+
6
+ load_dotenv()
7
+ except ImportError:
8
+ pass
9
+
10
  from openai import OpenAI
11
 
12
  from client import DataAnalysisClient
 
16
  from helpers.response_parser import FALLBACK_ACTION, parse_model_action
17
  from models import DataAction
18
 
 
 
19
 
20
  def run_task(openai_client: OpenAI, env_client: Any, task_id: int) -> float:
21
  """Run a single task episode using the language model as the agent.