ryanrwatkins commited on
Commit
6f08e8f
β€’
1 Parent(s): bde5aab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -103,7 +103,7 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
103
  # completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=system_prompt + history[-context_length*2:] + [prompt_msg], temperature=temperature, max_tokens=max_tokens)
104
 
105
  completion = RetrievalQA.from_chain_type(llm=ChatOpenAI(temperature=temperature, max_tokens=max_tokens, model_name="gpt-3.5-turbo"), chain_type="stuff", retriever=vectordb.as_retriever() , return_source_documents=True)
106
- result = completion({"query": system_prompt + history[-context_length*2:] + [prompt_msg] })
107
  # from https://blog.devgenius.io/chat-with-document-s-using-openai-chatgpt-api-and-text-embedding-6a0ce3dc8bc8
108
 
109
  history.append(prompt_msg)
@@ -158,7 +158,7 @@ with gr.Blocks(css=css) as demo:
158
  input_message = gr.Textbox(show_label=False, placeholder="Enter your needs assessment question and press enter", visible=True).style(container=False)
159
  btn_submit = gr.Button("Submit")
160
  total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
161
- btn_clear_conversation = gr.Button("πŸ”ƒ Start New Conversation")
162
  with gr.Column():
163
  prompt_template = gr.Dropdown(label="Choose a expert:", choices=list(prompt_templates.keys()))
164
  prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
 
103
  # completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=system_prompt + history[-context_length*2:] + [prompt_msg], temperature=temperature, max_tokens=max_tokens)
104
 
105
  completion = RetrievalQA.from_chain_type(llm=ChatOpenAI(temperature=temperature, max_tokens=max_tokens, model_name="gpt-3.5-turbo"), chain_type="stuff", retriever=vectordb.as_retriever() , return_source_documents=True)
106
+ completion = completion({"query": system_prompt + history[-context_length*2:] + [prompt_msg] })
107
  # from https://blog.devgenius.io/chat-with-document-s-using-openai-chatgpt-api-and-text-embedding-6a0ce3dc8bc8
108
 
109
  history.append(prompt_msg)
 
158
  input_message = gr.Textbox(show_label=False, placeholder="Enter your needs assessment question and press enter", visible=True).style(container=False)
159
  btn_submit = gr.Button("Submit")
160
  total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
161
+ btn_clear_conversation = gr.Button("Start New Conversation")
162
  with gr.Column():
163
  prompt_template = gr.Dropdown(label="Choose a expert:", choices=list(prompt_templates.keys()))
164
  prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")