alaselababatunde commited on
Commit
4c98960
·
1 Parent(s): 271148d
Files changed (1) hide show
  1. main.py +13 -7
main.py CHANGED
@@ -45,12 +45,15 @@ try:
45
  "text2text-generation",
46
  model=MODEL_NAME,
47
  device=DEVICE,
48
- max_new_tokens=512,
49
- temperature=0.0, # deterministic
50
- do_sample=False # reduce hedging
 
 
51
  )
52
 
53
 
 
54
  llm = HuggingFacePipeline(pipeline=hf_pipeline)
55
  logger.info("✅ Model loaded successfully.")
56
 
@@ -67,11 +70,13 @@ memory = ConversationBufferMemory(memory_key="conversation_history")
67
  # PROMPT TEMPLATE
68
  # ===============================================
69
  prompt_template = """
70
- You are Tech Disciples AI — a spiritually aware, intelligent, and kind conversational assistant.
71
- You give direct, thoughtful, and biblical answers with grace and empathy.
72
 
73
- Always answer the user question directly, if it relates to Christianity or the Bible.
74
- If the question is not related to Christianity or the Bible, politely inform the user that you only respond to questions on Christianity and the Bible.
 
 
75
 
76
  Conversation so far:
77
  {conversation_history}
@@ -81,6 +86,7 @@ Tech Disciples AI:
81
  """
82
 
83
 
 
84
  prompt = PromptTemplate(
85
  template=prompt_template,
86
  input_variables=["conversation_history", "query"]
 
45
  "text2text-generation",
46
  model=MODEL_NAME,
47
  device=DEVICE,
48
+ max_new_tokens=1024, # give enough room for thoughtful answers
49
+ temperature=0.7, # higher temp = more natural and creative
50
+ do_sample=True, # sample to allow variety
51
+ top_p=0.9, # nucleus sampling to filter unlikely tokens
52
+ repetition_penalty=1.2 # avoid repeating the same phrases
53
  )
54
 
55
 
56
+
57
  llm = HuggingFacePipeline(pipeline=hf_pipeline)
58
  logger.info("✅ Model loaded successfully.")
59
 
 
70
  # PROMPT TEMPLATE
71
  # ===============================================
72
  prompt_template = """
73
+ You are Tech Disciples AI — a spiritually aware, kind, and friendly pastor-like conversational assistant.
74
+ You provide thoughtful, biblical, and insightful answers with warmth, grace, and empathy.
75
 
76
+ Rules:
77
+ - Only answer questions related to Christianity, the Bible, or spiritual life.
78
+ - If the question is not related to Christianity or the Bible, politely inform the user that you do not respond to such questions.
79
+ - Respond naturally, like a caring member of a church community would.
80
 
81
  Conversation so far:
82
  {conversation_history}
 
86
  """
87
 
88
 
89
+
90
  prompt = PromptTemplate(
91
  template=prompt_template,
92
  input_variables=["conversation_history", "query"]