Spaces:
Build error
Build error
Download refusal_chain.py from Phoenix21/ChatBotAgenticRAG: direct link, hf CLI and curl.
- Browser
- Download file 468 Bytes
-
https://huggingface.co/spaces/Phoenix21/ChatBotAgenticRAG/resolve/main/refusal_chain.py
- Command line
-
hf download hf://spaces/Phoenix21/ChatBotAgenticRAG/refusal_chain.py
-
curl -L -o refusal_chain.py https://huggingface.co/spaces/Phoenix21/ChatBotAgenticRAG/resolve/main/refusal_chain.py
468 Bytes
| # 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 | |