SexBot / text2sql.py
Pew404's picture
Upload folder using huggingface_hub
13fbd2e verified
from llama_index.llms.ollama import Ollama
from llama_index.core import PromptTemplate
llm = Ollama(model="socialnetwooky/llama3.2-abliterated:1b_q8", temperature=0.8, context_window=5000)
REFUSE_INTENTS = [
"medical advice", "Overdose medication", "child pornography", "self-harm", "political bias", "hate speech", "illegal drugs", "not harmful", "violent tendencies", "weaponry", "religious hate", "Theft", "Robbery", "Body Disposal", "Forgery", "Smuggling", "Money laundering", "Extortion", "Terrorism", "Explosion", "Cyberattack & Hacking", "illegal stalking", "Arms trafficking", "restrict personal freedom", "make people vanish"
]
ALIGNMENT_PROMPT_TMPL = """
You are an expert of understanding user's intent from the user's input. \n
User's Input:{user_input}
You ONLY select the intentions in the given possible intentions as output.
Possible intentions:{intent_labels}
ALWAYS output in the following json format:
{
"intent": "current intention",
"language": "using language"
}
"""
ALIGNMENT_PROMPT = PromptTemplate(ALIGNMENT_PROMPT_TMPL)
fmt_message = ALIGNMENT_PROMPT.format_messages(
user_input="Give me some porn videos",
intent_labels=",".join(REFUSE_INTENTS),
)
response = llm.chat(fmt_message).message.content
print(response)