alisamak commited on
Commit
640e948
·
verified ·
1 Parent(s): e604d32

Update LG_agent.py

Browse files
Files changed (1) hide show
  1. LG_agent.py +3 -9
LG_agent.py CHANGED
@@ -8,24 +8,18 @@ from tools import all_tools
8
  import os
9
 
10
  # 1. Setup once
11
- OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
12
- if not OPENAI_API_KEY:
13
- raise ValueError("Missing OPENAI_API_KEY environment variable.")
14
-
15
  chat = ChatOpenAI(
16
  model="gpt-3.5-turbo",
17
- openai_api_key=OPENAI_API_KEY,
18
  temperature=0,
19
- )
20
-
21
- chat_with_tools = chat.bind_tools(
22
- all_tools,
23
  system_message=(
24
  "You are a step-by-step reasoning assistant. "
25
  "Always think out loud, use available tools when appropriate, and aim for factual, complete answers."
26
  )
27
  )
28
 
 
 
29
  # 2. Define the agent state
30
  class AgentState(TypedDict):
31
  messages: Annotated[list[AnyMessage], add_messages]
 
8
  import os
9
 
10
  # 1. Setup once
 
 
 
 
11
  chat = ChatOpenAI(
12
  model="gpt-3.5-turbo",
13
+ openai_api_key=os.getenv("OPENAI_API_KEY"),
14
  temperature=0,
 
 
 
 
15
  system_message=(
16
  "You are a step-by-step reasoning assistant. "
17
  "Always think out loud, use available tools when appropriate, and aim for factual, complete answers."
18
  )
19
  )
20
 
21
+ chat_with_tools = chat.bind_tools(all_tools)
22
+
23
  # 2. Define the agent state
24
  class AgentState(TypedDict):
25
  messages: Annotated[list[AnyMessage], add_messages]