Spaces:
Sleeping
Sleeping
| from langchain_groq import ChatGroq | |
| from langchain.prompts import PromptTemplate | |
| class NoteGenerator: | |
| def __init__(self, api_key): | |
| self.llm = ChatGroq( | |
| temperature=0.7, | |
| groq_api_key=api_key, | |
| model_name="llama3-8b-8192" # Groq currently supports Llama2, not Llama3 | |
| ) | |
| self.note_prompt = PromptTemplate( | |
| input_variables=["content"], | |
| template=""" | |
| Create detailed, structured notes from the following content: | |
| {content} | |
| Format the notes with: | |
| 1. Main topics and subtopics | |
| 2. Key points and definitions | |
| 3. Important examples | |
| 4. Summary | |
| """ | |
| ) | |
| self.chain = self.note_prompt | self.llm | |
| def generate_notes(self, content): | |
| return self.chain.invoke({"content": content}).content |