Ishanpardeshi commited on
Commit
a89833f
1 Parent(s): d42f247

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -20
app.py CHANGED
@@ -7,17 +7,17 @@ from crewai_tools import PDFSearchTool, FileReadTool, DOCXSearchTool, CSVSearchT
7
  from langchain_google_genai import ChatGoogleGenerativeAI
8
  from langchain.agents.agent_types import AgentType
9
  from langchain_experimental.agents.agent_toolkits import create_csv_agent
10
- from langchain_groq import ChatGroq
11
 
12
  # API keys-----------------move them to ENV
13
  os.environ["OPENAI_API_KEY"] = "NA"
14
  os.environ["GOOGLE_API_KEY"] = "AIzaSyD7jKc5MdkRLakxcyhvrpie8XgbwY98NMo"
15
- os.environ["GROQ_API_KEY"]='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'
16
 
17
- # Load The Groq model for LLM
18
- llm = ChatGroq(
19
- api_key="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",
20
- model="llama3-70b-8192"
 
 
21
  )
22
 
23
  #<-----------------------------Tools----------------------------------->
@@ -26,9 +26,9 @@ class tools:
26
  PDFtool = PDFSearchTool(
27
  config=dict(
28
  llm=dict(
29
- provider="ollama",
30
  config=dict(
31
- model="llama3-70b-8192",
32
  ),
33
  ),
34
  embedder=dict(
@@ -47,9 +47,9 @@ class tools:
47
  Filetool = FileReadTool(
48
  config=dict(
49
  llm=dict(
50
- provider="ollama",
51
  config=dict(
52
- model="llama3-70b-8192",
53
  ),
54
  ),
55
  embedder=dict(
@@ -68,9 +68,9 @@ class tools:
68
  Docstool = DOCXSearchTool(
69
  config=dict(
70
  llm=dict(
71
- provider="ollama",
72
  config=dict(
73
- model="llama3-70b-8192",
74
  ),
75
  ),
76
  embedder=dict(
@@ -92,7 +92,7 @@ class AgentLoader:
92
 
93
  def csvReaderAgent(path):
94
  agent = create_csv_agent(
95
- ChatGroq(temperature=0.6, model="llama3-70b-8192"),
96
  path,
97
  verbose=True,
98
  agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION
@@ -144,13 +144,11 @@ class AgentLoader:
144
  def writerAgent():
145
  writer=Agent(
146
  role='Content Writer',
147
- goal='To provide QUICK and reliable output',
148
- backstory="""You are content specialist.
149
- You are responsible to generate high quality results in the required format very quickly as soon as data is available.
150
- You are very accurate and fast at the same time.""",
151
  verbose=True,
152
- llm=llm,
153
- max_iter=5
154
  )
155
  return writer
156
 
@@ -213,4 +211,4 @@ interface = gr.Interface(
213
  )
214
 
215
  # Launch the Gradio interface
216
- interface.launch()
 
7
  from langchain_google_genai import ChatGoogleGenerativeAI
8
  from langchain.agents.agent_types import AgentType
9
  from langchain_experimental.agents.agent_toolkits import create_csv_agent
 
10
 
11
  # API keys-----------------move them to ENV
12
  os.environ["OPENAI_API_KEY"] = "NA"
13
  os.environ["GOOGLE_API_KEY"] = "AIzaSyD7jKc5MdkRLakxcyhvrpie8XgbwY98NMo"
 
14
 
15
+ # Load The Gemini model for LLM
16
+ llm = ChatGoogleGenerativeAI(
17
+ model="gemini-1.5-flash-latest",
18
+ verbose=True,
19
+ temperature=0.6, # high temp=high accuracy and low creativity
20
+ google_api_key="AIzaSyD7jKc5MdkRLakxcyhvrpie8XgbwY98NMo"
21
  )
22
 
23
  #<-----------------------------Tools----------------------------------->
 
26
  PDFtool = PDFSearchTool(
27
  config=dict(
28
  llm=dict(
29
+ provider="google",
30
  config=dict(
31
+ model="gemini-1.5-flash-latest",
32
  ),
33
  ),
34
  embedder=dict(
 
47
  Filetool = FileReadTool(
48
  config=dict(
49
  llm=dict(
50
+ provider="google",
51
  config=dict(
52
+ model="gemini-1.5-flash-latest",
53
  ),
54
  ),
55
  embedder=dict(
 
68
  Docstool = DOCXSearchTool(
69
  config=dict(
70
  llm=dict(
71
+ provider="google",
72
  config=dict(
73
+ model="gemini-1.5-flash-latest",
74
  ),
75
  ),
76
  embedder=dict(
 
92
 
93
  def csvReaderAgent(path):
94
  agent = create_csv_agent(
95
+ ChatGoogleGenerativeAI(temperature=0.6, model="gemini-1.5-flash-latest"),
96
  path,
97
  verbose=True,
98
  agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION
 
144
  def writerAgent():
145
  writer=Agent(
146
  role='Content Writer',
147
+ goal='To produce higly accurate and easy to understand information',
148
+ backstory="""You are an content specialist and are respinsible to generate reliable and easy to understand content or information based on the summary of data.
149
+ You should provide indetail results on the summary data.""",
 
150
  verbose=True,
151
+ llm=llm
 
152
  )
153
  return writer
154
 
 
211
  )
212
 
213
  # Launch the Gradio interface
214
+ interface.launch()