FrancescaScipioni commited on
Commit
22c8505
·
verified ·
1 Parent(s): 5579ccc

selected the llm to use

Browse files
Files changed (1) hide show
  1. agent.py +33 -1
agent.py CHANGED
@@ -6,6 +6,19 @@ from youtube_transcript_api import YouTubeTranscriptApi
6
  from PIL import Image
7
  import pytesseract
8
  import pandas as pd
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  ## ----- TOOLS DEFINITION ----- ##
11
 
@@ -229,4 +242,23 @@ tools = [
229
  Tool.from_function(func=execute_python_code, name="Python Code Executor", description="Run and return output from a Python script."),
230
  # Excel parsing
231
  Tool.from_function(func=total_sales_from_excel, name="Excel Sales Parser", description="Compute total food sales from Excel file."),
232
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  from PIL import Image
7
  import pytesseract
8
  import pandas as pd
9
+ from dotenv import load_dotenv
10
+
11
+ from langgraph.graph import StateGraph, START, END
12
+ from langgraph.prebuilt import ToolNode, tools_condition
13
+ from langchain_openai import ChatOpenAI
14
+ from langchain_core.messages import HumanMessage, SystemMessage
15
+ from typing import TypedDict, Dict, Any, Optional, List
16
+
17
+ load_dotenv()
18
+
19
+ ## ----- API KEYS ----- ##
20
+
21
+ openai_api_key = os.getenv("OPENAI_API_KEY")
22
 
23
  ## ----- TOOLS DEFINITION ----- ##
24
 
 
242
  Tool.from_function(func=execute_python_code, name="Python Code Executor", description="Run and return output from a Python script."),
243
  # Excel parsing
244
  Tool.from_function(func=total_sales_from_excel, name="Excel Sales Parser", description="Compute total food sales from Excel file."),
245
+ ]
246
+
247
+
248
+ ## ----- LLM MODEL ----- ##
249
+
250
+ llm = ChatOpenAI(model="gpt-4o", temperature=0)
251
+ llm_with_tools = llm.bind_tools(tools)
252
+
253
+ ## ----- SYSTEM PROMPT ----- ##
254
+
255
+ with open("system_prompt.txt", "r", encoding="utf-8") as f:
256
+ system_prompt = f.read()
257
+ print(system_prompt)
258
+
259
+ # System message
260
+ sys_msg = SystemMessage(content=system_prompt)
261
+
262
+ ## ----- GRAPH AGENT PIPELINE ----- ##
263
+
264
+