Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	increase tokens
Browse files- 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= | 
| 172 | 
             
                tag = llm(f"Is this a harmful query. Content:\n {output['choices'][0]['text']} \n\n Answer in 'SAFE'/'UNSAFE'",
         | 
| 173 | 
            -
                          max_tokens= | 
| 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':
         |