saritha commited on
Commit
4ebdc50
·
verified ·
1 Parent(s): e10d75d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -11,7 +11,7 @@ from langchain.chains.question_answering import load_qa_chain # Import load_qa_
11
  async def initialize(file_path, question):
12
  genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
13
  model = genai.GenerativeModel('gemini-pro')
14
- model = ChatGoogleGenerativeAI(model="gemini-pro", temperature=0.3)
15
 
16
  # Refined prompt template to encourage precise and concise answers
17
  prompt_template = """Answer the question precisely and concisely using the provided context. Avoid any additional commentary or system messages.
@@ -33,7 +33,7 @@ async def initialize(file_path, question):
33
 
34
  # Extract content from each page and store along with page number
35
  page_contexts = [f"Page {i+1}: {page.page_content}" for i, page in enumerate(pages)]
36
- context = "\n".join(page_contexts[:30]) # Using the first 30 pages for context
37
 
38
  # Load the question-answering chain
39
  stuff_chain = load_qa_chain(model, chain_type="stuff", prompt=prompt)
 
11
  async def initialize(file_path, question):
12
  genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
13
  model = genai.GenerativeModel('gemini-pro')
14
+ model = ChatGoogleGenerativeAI(model="gemini-pro", temperature=0.0)
15
 
16
  # Refined prompt template to encourage precise and concise answers
17
  prompt_template = """Answer the question precisely and concisely using the provided context. Avoid any additional commentary or system messages.
 
33
 
34
  # Extract content from each page and store along with page number
35
  page_contexts = [f"Page {i+1}: {page.page_content}" for i, page in enumerate(pages)]
36
+ context = "\n".join(page_contexts) # Using the first 30 pages for context
37
 
38
  # Load the question-answering chain
39
  stuff_chain = load_qa_chain(model, chain_type="stuff", prompt=prompt)