""" project @ LearnableAI created @ 2025-01-16 author @ github.com/ishworrsubedii """ import os from typing import List, Dict from groq import Groq class UseCaseOne: def __init__(self, client): self.client = client def generate_educational_content(self, interest: str, difficulties: str, words: List[str]) -> Dict: prompt = f""" # 🎯 Learning Content Generator ## 📝 Input Parameters - **Interest Area:** {interest} - **Target Words:** {', '.join(words)} - **Difficulty Level:** {difficulties} ## ✨ Content Requirements ### 1. 📖 Creative Sentences - Must use target words naturally - Must relate to {interest} - Must match {difficulties} difficulty level - Should be engaging and educational ### 2. 🤔 Quiz Questions - Must test word understanding - Must be multiple choice - Must have clear correct answers - Must relate to {interest} ### 3. 🎨 Image Generation Prompt - Must incorporate target words - Must be detailed for AI generation - Must be creative and engaging - Must relate to {interest} ### 4. 🎮 Activities - Must be simple and engaging - Must reinforce target words - Must match {difficulties} level - Must relate to {interest} ## 🎁 Output Format ### 📚 Sentences 1. [First creative sentence] 2. [Second creative sentence] 3. [Third creative sentence] ### ❓ Quiz **Question 1** [Question text] - A) [Option] - B) [Option] - C) [Option] - D) [Option] *Correct Answer: [A/B/C/D]* **Question 2** [Question text] - A) [Option] - B) [Option] - C) [Option] - D) [Option] *Correct Answer: [A/B/C/D]* ### 🎯 Activities 1. [Detailed description of first activity] 2. [Detailed description of second activity] ### 🖼️ Image Generation Prompt [Detailed scene description incorporating target words] --- *Note: All content should be accessible and engaging for children with learning difficulties.* ✨ """ try: completion = self.client.chat.completions.create( messages=[{ "role": "system", "content": "You are an expert in creating educational content for children with ADHD. and you need to generate some educational content for children to understand the concept of the given words." }, { "role": "user", "content": prompt }], model="deepseek-r1-distill-llama-70b", temperature=1.0, # if increase temperature, it will generate more creative content max_tokens=2000, top_p=1, stream=False ) return completion.choices[0].message.content except Exception as e: return { "error": f"Error generating content: {str(e)}", "status": "failed" } if __name__ == '__main__': client = Groq(api_key=os.getenv ('GROQ_API_KEY')) use_case_one = UseCaseOne(client=client) result = use_case_one.generate_educational_content( interest="spiderman", difficulties="simple", words=["apple", "banana", "orange"] ) print(result)