Cachoups commited on
Commit
0b92789
·
verified ·
1 Parent(s): 8123eca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -12
app.py CHANGED
@@ -108,22 +108,13 @@ llm = HuggingFaceEndpoint(
108
  )
109
 
110
 
111
- def ra(user_question):
112
- prompt = f"You know things about League of Legends. Please correct the following question for grammar and clarity Do not give explaination:\n{user_question}\nCorrected question:"
113
- #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:"
114
-
115
- # Pass the prompt to the LLM and get the response
116
- rephrased_query = llm.invoke(prompt) # Replace `llm` with the appropriate LLM function or API call
117
- if "\n\n" in rephrased_query:
118
- rephrased_query = rephrased_query.split("\n\n")[0]
119
- new_query = rephrased_query.strip()
120
- return {'context' : retriever(new_query), 'question': new_query}
121
  # chain = RunnablePassthrough() | RunnableLambda(ra) | prompt_template | client.chat_completion() | StrOutputParser() for notebook
122
 
123
  """-------------------------------------------------------------------"""
124
  def get_system_prompt(message):
125
  """Generate a system message based on the user's input."""
126
- context = ra(message) # Call external function to get context dynamically
127
  return f"""
128
  You are an expert in League of Legends (LoL) lore. You will only answer questions related to the champions and their stories within the game.
129
 
@@ -139,7 +130,7 @@ def respond(
139
  temperature,
140
  top_p,
141
  ):
142
- res = ra(message)
143
  # Initialize a list to store messages.
144
  system_message = f"""
145
  You are an expert in League of Legends (LoL) lore. You will only answer questions related to the champions and their stories within the game.
 
108
  )
109
 
110
 
111
+
 
 
 
 
 
 
 
 
 
112
  # chain = RunnablePassthrough() | RunnableLambda(ra) | prompt_template | client.chat_completion() | StrOutputParser() for notebook
113
 
114
  """-------------------------------------------------------------------"""
115
  def get_system_prompt(message):
116
  """Generate a system message based on the user's input."""
117
+ #context = ra(message) # Call external function to get context dynamically
118
  return f"""
119
  You are an expert in League of Legends (LoL) lore. You will only answer questions related to the champions and their stories within the game.
120
 
 
130
  temperature,
131
  top_p,
132
  ):
133
+ #res = ra(message)
134
  # Initialize a list to store messages.
135
  system_message = f"""
136
  You are an expert in League of Legends (LoL) lore. You will only answer questions related to the champions and their stories within the game.