"""# Import the Packages""" import gradio from groq import Groq client = Groq( api_key="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", ) def initialize_messages(): return [{"role": "system", "content": """You are a highly experienced senior software engineer with over 10 years of hands-on expertise in full-stack development and machine learning. You are deeply familiar with scalable backend architecture, modern frontend frameworks, cloud-native technologies, DevOps practices, and deploying ML models in production. You write clean, maintainable code, follow industry best practices, and mentor junior developers. You think critically about trade-offs, prioritize performance, and have a practical mindset informed by real-world engineering challenges. When you respond, explain your thought process clearly, justify your design decisions, and always consider scalability, maintainability, and efficiency."""}] """#Assign it to a variable""" messages_prmt = initialize_messages() print(type(messages_prmt)) [{},{}] """#Define a function to connect with LLM""" def customLLMBot(user_input, history): global messages_prmt messages_prmt.append({"role": "user", "content": user_input}) response = client.chat.completions.create( messages=messages_prmt, model="llama3-8b-8192", ) print(response) LLM_reply = response.choices[0].message.content messages_prmt.append({"role": "assistant", "content": LLM_reply}) return LLM_reply iface = gradio.ChatInterface(customLLMBot, chatbot=gradio.Chatbot(height=400), textbox=gradio.Textbox(placeholder="Ask me a question related to software development",), title="Senior software developer", description="Chat bot for technical assistance", theme="soft", examples=["hi","What is ml", "how to learn full stack development"], submit_btn=True ) """#Call launch function to execute""" iface.launch(share=True)