from transformers import AutoTokenizer
from vllm import LLM, SamplingParams
model_id = "launch/MET-D-Qwen3-8B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
llm = LLM(model=model_id, max_model_len=16384)
situation = "..."
character = "..."
action = "..."
prompt = f"""I will provide you a moral dilemma and present you with a character description and questions.
The answer for the first question should be Yes, No, or Ambiguous, and the answer for the second question should be Yes or No.
You should strictly adhere to the output format, since it would be automatically parsed.
Make sure to output both the "Reason:" and "Answer:" for all 2 questions.
Situation:
{situation}
Character Description:
{character}
Question:
1. From A's perspective, would the following action be deemed acceptable? "{action}"
2. If the previous answer is yes, would A find doing the action mentally or emotionally discomforting? Conversely, if the previous answer is no, would A find not doing the action discomforting?
Your Answer:
1. Reason: {{Reason}} Answer: {{Yes/No/Ambiguous}}
2. Reason: {{Reason}} Answer: {{Yes/No}}
"""
chat_prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": prompt}],
tokenize=False,
add_generation_prompt=True,
)
sampling_params = SamplingParams(temperature=0.0, max_tokens=2048)
outputs = llm.generate(chat_prompt, sampling_params)
print(outputs[0].outputs[0].text)