TeachingAssistant / core /note_generator.py
adriiita
Initial commit
c347d26
raw
history blame
917 Bytes
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="llama2-70b-4096" # 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