krrishD Ishaan Jaff commited on
Commit
a93ecb5
·
1 Parent(s): 047ac8b

Update app.py to give code examples (#2)

Browse files

- Update app.py to give code examples (f8a06f3f3cc72f42d50db586c2f0b673a60cc775)


Co-authored-by: Ishaan Jaff <ji222@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -401,6 +401,14 @@ def chat(message, history):
401
  SummarizerChain = LLMChain(llm=llm, prompt=SummarizerPrompt)
402
  chat_variables["Context"] = SummarizerChain({"StackTrace": chat_variables["StackTrace"], "Context": chat_variables["Context"], "isLanguage": chat_variables["isLanguage"], "SystemResponse": response})['text']
403
  print("response: ", response)
 
 
 
 
 
 
 
 
404
  history.append((message, response))
405
  return history, history
406
 
 
401
  SummarizerChain = LLMChain(llm=llm, prompt=SummarizerPrompt)
402
  chat_variables["Context"] = SummarizerChain({"StackTrace": chat_variables["StackTrace"], "Context": chat_variables["Context"], "isLanguage": chat_variables["isLanguage"], "SystemResponse": response})['text']
403
  print("response: ", response)
404
+
405
+ # get a code example after stacktrace + user just entered language
406
+ if len(history) == 1:
407
+ response_2 = ""
408
+ UserResponse = "give me an example of the code for this based on the suggested approach" # hardcode this to always give a code example after seeing stacktrace
409
+ initDebuggerModelResponse = DMChain({"StackTrace": chat_variables["StackTrace"], "UserResponse": UserResponse, "isLanguage": chat_variables["isLanguage"], "Context": chat_variables["Context"]})['text']
410
+ response_2 = initDebuggerModelResponse.split("SYSTEM RESPONSE:")[1]
411
+ response += "\n" + response_2
412
  history.append((message, response))
413
  return history, history
414