{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "! pip install -q --upgrade google-generativeai langchain-google-genai" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from dotenv import load_dotenv\n", "load_dotenv()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/vasim/.local/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "source": [ "from langchain_google_genai import ChatGoogleGenerativeAI" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "from IPython.display import display\n", "from IPython.display import Markdown\n", "import textwrap\n", "\n", "\n", "def to_markdown(text):\n", " text = text.replace('•', ' *')\n", " return Markdown(textwrap.indent(text, '> ', predicate=lambda _: True))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "> 1. **Exercise Regularly:** Aim for at least 150 minutes of moderate-intensity aerobic activity (e.g., brisk walking, cycling, swimming) or 75 minutes of vigorous-intensity aerobic activity (e.g., running, circuit training) each week.\n", "> 2. **Strength Training:** Incorporate strength training exercises that work all major muscle groups at least twice a week. This helps build and maintain muscle mass, which improves strength, mobility, and bone density.\n", "> 3. **Mindful Eating:** Pay attention to hunger and fullness cues. Eat a balanced diet rich in fruits, vegetables, whole grains, lean protein, and healthy fats. Avoid processed foods, excessive sugar, and large portion sizes.\n", "> 4. **Good Sleep:** Aim for 7-8 hours of quality sleep each night. Sleep helps the body recover from exercise, regulates hormones, and supports overall well-being.\n", "> 5. **Manage Stress:** Engage in stress management practices such as meditation, yoga, deep breathing, or spending time in nature. Chronic stress can negatively impact physical and mental health.\n", "> 6. **Avoid Smoking and Excessive Alcohol:** Smoking is detrimental to overall health. Excessive alcohol consumption can interfere with sleep, lead to weight gain, and increase the risk of liver damage.\n", "> 7. **Stay Hydrated:** Drinking plenty of water is essential for various bodily functions. Dehydration can lead to fatigue and impaired performance.\n", "> 8. **Routine Medical Check-ups:** Schedule regular check-ups with your healthcare provider to monitor your overall health, including blood pressure, cholesterol, and weight.\n", "> 9. **Body Positivity:** Focus on feeling healthy and strong rather than obsessing over appearance. Appreciate your body for its abilities and prioritize health over unattainable beauty standards.\n", "> 10. **Find Enjoyable Activities:** Choose physical activities that you genuinely enjoy. This makes it more likely that you'll stick with your fitness routine over time." ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "llm = ChatGoogleGenerativeAI(model=\"gemini-pro\")\n", "result = llm.invoke(\"What is the best practice to keep fit?\")\n", "to_markdown(result.content)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 2 }