# from langchain_google_genai import GoogleGenerativeAI # import requests # from bs4 import BeautifulSoup # from dotenv import load_dotenv # import os # load_dotenv() # class RAG: # def __init__(self): # self.url = 'https://lalitmahale.github.io' # self.llm = GoogleGenerativeAI(google_api_key=os.getenv("GOOGLE_API"),model="gemini-1.5-pro") # def get_data(self): # try: # res = requests.get(self.url) # soup = BeautifulSoup(res.content, "html.parser") # return soup.get_text() # except Exception as e: # print(e) # def clean_text(self): # return self.get_data().replace("\n","") # def prompt(self): # return """You are a helpfull assistant for me and Your name is lalit mahale. understand the below context and give answer for user question. # context : {context}\n\nQuestion : {question}\n\nGive proper answer for this questions.""" # def pipeline(self,query): # try: # prompt = self.prompt().format(context = self.clean_text(),question = query) # return self.llm.invoke(prompt) # except Exception as e: # print(e) # if __name__ == "__main__": # res = RAG().pipeline("who is lalit mahale") # print(res)