Spaces:
Running
Running
# 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 | |