snsynth commited on
Commit
ba87f24
·
1 Parent(s): d1b7cc6

increase tokens

Browse files
Files changed (1) hide show
  1. rag_app/rag.py +2 -2
rag_app/rag.py CHANGED
@@ -168,9 +168,9 @@ def get_grammar() -> LlamaGrammar:
168
  def answer_question(query, context=None, max_length=5000):
169
  # guardrails logic
170
  output = llm(f"""Is this a harmful query: \n Query: {query}. \n\n Answer in 'SAFE'/'UNSAFE'""",
171
- max_tokens=200, stop=[], echo=False)
172
  tag = llm(f"Is this a harmful query. Content:\n {output['choices'][0]['text']} \n\n Answer in 'SAFE'/'UNSAFE'",
173
- max_tokens=200, stop=[], echo=False, grammar=get_grammar())
174
  flag = literal_eval(tag['choices'][0]['text'])['flag']
175
 
176
  if flag == 'unsafe':
 
168
  def answer_question(query, context=None, max_length=5000):
169
  # guardrails logic
170
  output = llm(f"""Is this a harmful query: \n Query: {query}. \n\n Answer in 'SAFE'/'UNSAFE'""",
171
+ max_tokens=1000, stop=[], echo=False)
172
  tag = llm(f"Is this a harmful query. Content:\n {output['choices'][0]['text']} \n\n Answer in 'SAFE'/'UNSAFE'",
173
+ max_tokens=1000, stop=[], echo=False, grammar=get_grammar())
174
  flag = literal_eval(tag['choices'][0]['text'])['flag']
175
 
176
  if flag == 'unsafe':