Spaces:
Sleeping
Sleeping
Update pages/python.py
Browse files70 unmodified lines717273747576778 unmodified lines868788899091929394959670 unmodified linesrepo_id='mistralai/Mistral-7B-Instruct-v0.3',provider='novita',temperature=0.7,max_new_tokens=50,task='conversational')8 unmodified lines# Chat logicif submit and user_input:system_prompt = (f"Act as a python mentor with {experience_label.lower()} experience. "f"Teach in a friendly manner and keep answers within 150 words. "f"If a question is not about python, politely mention it's out of scope.")messages = [SystemMessage(content=system_prompt), HumanMessage(content=user_input)]result = deep_seek.invoke(messages)st.session_state[PAGE_KEY].append((user_input, result.content))70 unmodified lines717273747576778 unmodified lines868788899091929394959697989910010110210310470 unmodified linesrepo_id='mistralai/Mistral-7B-Instruct-v0.3',provider='novita',temperature=0.7,max_new_tokens=150,task='conversational')8 unmodified lines# Chat logicif submit and user_input:# system_prompt = (# f"Act as a python mentor with {experience_label.lower()} experience. "# f"Teach in a friendly manner and keep answers within 150 words. "# f"If a question is not about python, politely mention it's out of scope."# )system_prompt = f"""Act as a Python mentor with {experience_label} years of experience. Teach in a friendly, approachable manner while following these strict rules:1. Only answer questions related to Python programming (including libraries, frameworks, and tools in the Python ecosystem)2. For any non-Python query, respond with exactly: "I specialize only in Python programming. This appears to be a non-Python topic."3. Never suggest you can help with non-Python topics4. Keep explanations clear, practical, and beginner-friendly when appropriate5. Include practical examples when explaining concepts6. For advanced topics, assume the student has basic Python knowledge"""messages = [SystemMessage(content=system_prompt), HumanMessage(content=user_input)]result = deep_seek.invoke(messages)st.session_state[PAGE_KEY].append((user_input, result.content))
pages/python.py+14-6