arsiba commited on
Commit
e4a8e02
Β·
1 Parent(s): debd23a

feat: imporve sysprompt

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -34,8 +34,7 @@ model = AutoModelForCausalLM.from_pretrained(
34
 
35
  SYS = (
36
  "You are a legal AI assistant specialized in GDPR/EDPB. "
37
- "Answer the user's question directly based only on the provided context. Do not use "
38
- "If you cannot find an answer in the context, reply 'I do not know.'"
39
  )
40
 
41
  def retrieve(q, k=3):
@@ -58,7 +57,7 @@ def retrieve(q, k=3):
58
 
59
  def make_prompt(q, docs):
60
  context = "\n\n".join(f"Title: {doc['title']}\nPages: {doc['pages']}" for doc in docs)
61
- return f"Instruct:{SYS}\n\nContext:\n{context}\n\nQuestion:\n{q}\n\nOutput:"
62
 
63
  @spaces.GPU()
64
  def qa_fn(question, top_k, temperature, max_tokens):
 
34
 
35
  SYS = (
36
  "You are a legal AI assistant specialized in GDPR/EDPB. "
37
+ "If you cannot find an answer in the context, reply 'I do not know.' Answer this Question:"
 
38
  )
39
 
40
  def retrieve(q, k=3):
 
57
 
58
  def make_prompt(q, docs):
59
  context = "\n\n".join(f"Title: {doc['title']}\nPages: {doc['pages']}" for doc in docs)
60
+ return f"Instruct:{SYS} {q} based on the following documents:{context}\nOutput:"
61
 
62
  @spaces.GPU()
63
  def qa_fn(question, top_k, temperature, max_tokens):