File size: 468 Bytes
4ac5e81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# refusal_chain.py
import os
from langchain.chains import LLMChain
from langchain_groq import ChatGroq

from 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