HealthyAiExpert / chain /refusal_chain.py
Phoenix21's picture
corrected the import in the chain folder
9f3fb14
raw
history blame contribute delete
474 Bytes
# refusal_chain.py
import os
from langchain.chains import LLMChain
from langchain_groq import ChatGroq
from chain.prompts import refusal_prompt
def get_refusal_chain() -> LLMChain:
"""
Builds the refusal chain for out-of-scope queries.
"""
chat_groq_model = ChatGroq(
model="Gemma2-9b-It",
groq_api_key=os.environ["GROQ_API_KEY"]
)
chain = LLMChain(
llm=chat_groq_model,
prompt=refusal_prompt
)
return chain