ryanrwatkins commited on
Commit
9af13d3
1 Parent(s): 87641c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -684,7 +684,7 @@ def answer_template(language="english"):
684
 
685
  chain = ConversationalRetrievalChain.from_llm(
686
  condense_question_prompt=standalone_question_prompt,
687
- combine_docs_chain_kwargs={'prompt': answer_prompt},
688
  condense_question_llm=instantiate_LLM(
689
  LLM_provider="Google",api_key=google_api_key,temperature=0.1,
690
  model_name="gemini-pro"),
@@ -781,8 +781,8 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
781
 
782
  global prompt_template_name
783
  prompt_template_name = prompt_template
784
- print(prompt_template) # prints who is responding if I move to multiple experts
785
- print(prompt_templates[prompt_template])
786
 
787
 
788
 
@@ -799,15 +799,21 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
799
  #state.append(completion.copy())
800
 
801
  completion = { "content": completion }
802
- print("completion text")
803
 
804
  for document in completion['content']['source_documents']:
 
 
 
 
805
  page_content = document.page_content # Use dot notation to access an attribute
806
  print("Page_content:", page_content)
807
  metadata = document.metadata # Use dot notation to access an attribute
808
  print("Metadata:", metadata)
809
  similarity_score = document.state['query_similarity_score']
810
  print("Similarity_score:", similarity_score)
 
 
811
  print("")
812
 
813
 
 
684
 
685
  chain = ConversationalRetrievalChain.from_llm(
686
  condense_question_prompt=standalone_question_prompt,
687
+ combine_docs_chain_kwargs={'prompt': ChatPromptTemplate.from_template(answer_template())},
688
  condense_question_llm=instantiate_LLM(
689
  LLM_provider="Google",api_key=google_api_key,temperature=0.1,
690
  model_name="gemini-pro"),
 
781
 
782
  global prompt_template_name
783
  prompt_template_name = prompt_template
784
+ #print(prompt_template) # prints who is responding if I move to multiple experts
785
+ #print(prompt_templates[prompt_template])
786
 
787
 
788
 
 
799
  #state.append(completion.copy())
800
 
801
  completion = { "content": completion }
802
+
803
 
804
  for document in completion['content']['source_documents']:
805
+
806
+
807
+
808
+ print("Prompt/question:", prompt)
809
  page_content = document.page_content # Use dot notation to access an attribute
810
  print("Page_content:", page_content)
811
  metadata = document.metadata # Use dot notation to access an attribute
812
  print("Metadata:", metadata)
813
  similarity_score = document.state['query_similarity_score']
814
  print("Similarity_score:", similarity_score)
815
+ answer = completion['content']['answer']
816
+ print("Answer:", answer)
817
  print("")
818
 
819