Daniel Marques commited on
Commit
8e1e4b4
1 Parent(s): 5068745

feat: add backend

Browse files
Files changed (1) hide show
  1. main.py +5 -3
main.py CHANGED
@@ -77,11 +77,11 @@ handlerToken = MyCustomSyncHandler()
77
 
78
  LLM = load_model(device_type=DEVICE_TYPE, model_id=MODEL_ID, model_basename=MODEL_BASENAME, stream=True, callbacks=[handlerToken])
79
 
80
- template = """you are a helpful, respectful and honest assistant. You should only use the source documents provided to answer the questions.
81
  You should only respond only topics that contains in documents use to training. Use the following pieces of context to answer the question at the end.
82
  Always answer in the most helpful and safe way possible.
83
- If you don't know the answer to a question, just say that you don't know, don't try to make up an answer, don't share false information.
84
- Use 15 sentences maximum. Keep the answer as concise as possible. Always say "thanks for asking!" at the end of the answer.
85
  Context: {context}
86
  Question: {question}
87
  """
@@ -259,6 +259,8 @@ async def websocket_endpoint(websocket: WebSocket):
259
  while finish == False:
260
  finish = handlerToken.end
261
  token = handlerToken.token
 
 
262
  await websocket.send_text(f"result: {token}")
263
 
264
 
 
77
 
78
  LLM = load_model(device_type=DEVICE_TYPE, model_id=MODEL_ID, model_basename=MODEL_BASENAME, stream=True, callbacks=[handlerToken])
79
 
80
+ template = """You are a helpful, respectful and honest assistant. You should only use the documents provided in the context to answer the questions.
81
  You should only respond only topics that contains in documents use to training. Use the following pieces of context to answer the question at the end.
82
  Always answer in the most helpful and safe way possible.
83
+ If you don't know the answer to a question, just say that you "I don't know", never try to make up an answer and don't share false information.
84
+ Use 15 sentences maximum. The answer must be as concise as possible. Always say "thanks for asking!" at the end of the answer.
85
  Context: {context}
86
  Question: {question}
87
  """
 
259
  while finish == False:
260
  finish = handlerToken.end
261
  token = handlerToken.token
262
+ print(token)
263
+ print(finish)
264
  await websocket.send_text(f"result: {token}")
265
 
266