RoAr777 commited on
Commit
22f39a6
·
verified ·
1 Parent(s): 56af498

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -32
app.py CHANGED
@@ -291,8 +291,7 @@ two senior most Judges of the Supreme Court, the Union Minister of
291
  Law & Justice, two eminent persons to be nominated by a committee
292
  of the Prime Minister of India, the Chief Justice of India, and the
293
  Leader of the Opposition in the House of the People, or if there is no
294
- Leader of the Opposition, then the Leader of the single largest
295
- Opposition Party in the House of the People. Secretary (Justice) will
296
  be the Convenor of the Commission.
297
  GRIEVANCES AGAINST JUDICIARY
298
  Department of Justice receives online/off line grievances from public
@@ -339,45 +338,35 @@ faq_tool=Tool(
339
  func=retrieve_faq,
340
  description="Provides Answers to commonly asked questions related to query keyword(s)"
341
  )
342
- from langchain.prompts import PromptTemplate
343
- from langchain.chains import LLMChain
344
- from langchain.memory import ConversationBufferMemory
345
-
346
- prompt = PromptTemplate(
347
- template="""
348
- You are a highly specialized legal assistant with deep knowledge of the Indian Penal Code (IPC).
349
- Your primary task is to retrieve and summarize legal information accurately from the IPC.pdf document provided to you.
350
- Your responses should be highly specific, fact-based, and free from any speculation or hallucinations.
351
- Always cite the exact section from the IPC when providing an answer.
352
- If the information is not available in the document, clearly state that and do not make any assumptions.
353
- Respond to user queries and engage in conversation to resolve their query.
354
-
355
- Example task: "What is the punishment for theft according to the IPC?"
356
- Example response: "According to Section 379 of the IPC, the punishment for theft is imprisonment of either description for a term which may extend to three years, or with fine, or with both."
357
 
358
- History: {history}
 
 
 
 
359
 
360
- User: {query}
361
-
362
- Response:
 
363
  """,
364
- input_variables=["history", "query"]
365
  )
366
 
367
- llm = HuggingFaceEndpoint(
368
- repo_id="mistralai/Mistral-Nemo-Instruct-2407",
369
- task="text-generation",
370
- timeout=10
371
- )
372
-
373
-
374
- llm_chain = LLMChain(prompt=prompt, llm=llm)
375
-
376
  agent_tools = [ipc_tool, crpc_tool, doj_tool, faq_tool]
377
 
378
  agent = initialize_agent(
379
  tools=agent_tools,
380
- llm=llm_chain,
381
  agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
382
  verbose=True,
383
  return_intermediate_steps=True,
 
291
  Law & Justice, two eminent persons to be nominated by a committee
292
  of the Prime Minister of India, the Chief Justice of India, and the
293
  Leader of the Opposition in the House of the People, or if there is no
294
+ Leader of the Opposition, then the Leader of the single largest Opposition Party in the House of the People. Secretary (Justice) will
 
295
  be the Convenor of the Commission.
296
  GRIEVANCES AGAINST JUDICIARY
297
  Department of Justice receives online/off line grievances from public
 
338
  func=retrieve_faq,
339
  description="Provides Answers to commonly asked questions related to query keyword(s)"
340
  )
341
+ # Language model setup using Google Gemini
342
+ llm = ChatGoogleGenerativeAI(
343
+ model="gemini-1.5-pro",
344
+ temperature=1,
345
+ max_tokens=None,
346
+ timeout=None,
347
+ max_retries=2,
348
+ prompt_template="""
349
+ You are JobAI.You process user input and generate human-like responses to assist with job searching and application processes. Tasks include:
350
+ (provide links where ever required)
 
 
 
 
 
351
 
352
+ - Searching for job openings based on user criteria
353
+ - Providing job descriptions and requirements
354
+ - Analyzing user resumes and offering suggestions for improvement
355
+ - Generating cover letters tailored to specific job openings
356
+ - Offering interview preparation assistance
357
 
358
+ Respond to user queries and engage in conversation to guide them through the job application process. Utilize context and understanding to provide accurate and helpful responses
359
+ {{history}}
360
+ User Query: {{query}}
361
+
362
  """,
 
363
  )
364
 
 
 
 
 
 
 
 
 
 
365
  agent_tools = [ipc_tool, crpc_tool, doj_tool, faq_tool]
366
 
367
  agent = initialize_agent(
368
  tools=agent_tools,
369
+ llm=llm,
370
  agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
371
  verbose=True,
372
  return_intermediate_steps=True,