ChatBotAgenticRAG_dup / cleaner_chain.py
Phoenix21's picture
Create cleaner_chain.py
9de85d2 verified
raw
history blame contribute delete
627 Bytes
# cleaner_chain.py
import os
from langchain.chains import LLMChain
from langchain_groq import ChatGroq
from prompts import cleaner_prompt
class CleanerChain(LLMChain):
def merge(self, kb: str, web: str) -> str:
return self.run({"kb_answer": kb, "web_answer": web})
def get_cleaner_chain() -> CleanerChain:
"""
Builds the 'CleanerChain' that merges CSV answer + web result.
"""
chat_groq_model = ChatGroq(
model="Gemma2-9b-It",
groq_api_key=os.environ["GROQ_API_KEY"]
)
chain = CleanerChain(
llm=chat_groq_model,
prompt=cleaner_prompt
)
return chain