Cachoups commited on
Commit
947860c
·
verified ·
1 Parent(s): 20f36b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -102,14 +102,14 @@ from langchain_community.llms.huggingface_hub import HuggingFaceHub
102
  # Set the correct endpoint and task for the model
103
 
104
  def ra(user_question):
105
- prompt = f"You know things about League of Legends. Please correct the following question for grammar and clarity. Do not give explaination."
106
  #prompt = f"You know things about League of Legends. Please ONLY correct the following question for grammar and clarity. Do NOT give explaination:\n{user_question}\nCorrected question:"
107
 
108
- messages=[
109
  {"role": "system", "content": "You know things about League of Legends. You are a helpful AI that improves grammar and clarity. Do not give an explanation."},
110
  {"role": "user", "content": "Please correct the following question with same structure: "+ user_question}
111
  ]
112
- response = client.chat_completion(messages,
113
  max_tokens=20,
114
  stream=False,
115
  temperature=0.1)
@@ -125,7 +125,6 @@ def respond(
125
  temperature,
126
  top_p,
127
  ):
128
- print(message)
129
  new_query = ra(message)
130
  print(new_query)
131
  system_message = f"""
@@ -158,7 +157,7 @@ def respond(
158
  messages.append({"role": "assistant", "content": val[1]})
159
  #print("Question: "+message +"\n\nAnswer: ")
160
  messages.append({"role": "user", "content": "Context: "+str(retriever(new_query))+"\n\nQuestion: "+message +"\n\nAnswer: "})
161
-
162
  response = ""
163
 
164
  for message in client.chat_completion(
 
102
  # Set the correct endpoint and task for the model
103
 
104
  def ra(user_question):
105
+ #prompt = f"You know things about League of Legends. Please correct the following question for grammar and clarity. Do not give explaination."
106
  #prompt = f"You know things about League of Legends. Please ONLY correct the following question for grammar and clarity. Do NOT give explaination:\n{user_question}\nCorrected question:"
107
 
108
+ messages_q=[
109
  {"role": "system", "content": "You know things about League of Legends. You are a helpful AI that improves grammar and clarity. Do not give an explanation."},
110
  {"role": "user", "content": "Please correct the following question with same structure: "+ user_question}
111
  ]
112
+ response = client.chat_completion(messages_q,
113
  max_tokens=20,
114
  stream=False,
115
  temperature=0.1)
 
125
  temperature,
126
  top_p,
127
  ):
 
128
  new_query = ra(message)
129
  print(new_query)
130
  system_message = f"""
 
157
  messages.append({"role": "assistant", "content": val[1]})
158
  #print("Question: "+message +"\n\nAnswer: ")
159
  messages.append({"role": "user", "content": "Context: "+str(retriever(new_query))+"\n\nQuestion: "+message +"\n\nAnswer: "})
160
+ print(str(retriever(new_query)))
161
  response = ""
162
 
163
  for message in client.chat_completion(