Skip to content

Commit

Permalink
minor style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanda Foster committed Aug 15, 2023
1 parent 4457a68 commit 8dd46e8
Showing 1 changed file with 56 additions and 54 deletions.
110 changes: 56 additions & 54 deletions Basic_Samples/LangChain/working_with_langchain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 36,
"id": "35289cea",
"metadata": {},
"outputs": [],
Expand All @@ -46,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 42,
"id": "a9752fda",
"metadata": {
"scrolled": true
Expand All @@ -71,7 +71,7 @@
"# API version e.g. \"2023-07-01-preview\"\n",
"openai_api_version=config_details['OPENAI_API_VERSION']\n",
"\n",
"# The name of your Azure OpenAI deployment chat model. e.g. \"gpt-3-turbo-0613\"\n",
"# The name of your Azure OpenAI deployment chat model. e.g. \"gpt-35-turbo-0613\"\n",
"deployment_name=config_details['DEPLOYMENT_NAME']\n",
"\n",
"# The API key for your Azure OpenAI resource.\n",
Expand All @@ -91,17 +91,17 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 43,
"id": "041f0a56",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"AIMessage(content=\"In a world of dreams, where words take flight,\\nI'll weave a poem, to bring you delight.\\nWith ink and rhythm, I'll paint a scene,\\nWhere emotions dance in colors unseen.\\n\\nIn twilight's embrace, the stars ignite,\\nAs moonbeams whisper, a poet's plight.\\nEach syllable, a gentle caress,\\nUnveiling secrets, in poetic finesse.\\n\\nThrough nature's canvas, I'll take you there,\\nWhere sunsets melt, in hues so rare.\\nA symphony of birds, their melodies blend,\\nAs whispers of wind, through tall trees ascend.\\n\\nIn the depths of silence, where echoes reside,\\nI'll find the stories that time can't hide.\\nUnearth forgotten tales, from ancient lore,\\nAnd breathe life into them, like never before.\\n\\nWith passion's fire, my verses will ignite,\\nEmbracing love's joy, and sorrow's might.\\nI'll capture the essence, of a tender touch,\\nAnd the ache of longing, that hurts so much.\\n\\nThrough valleys of hope, and mountains of despair,\\nI'll guide you gently, with tender care.\\nWith each word penned, a journey will start,\\nTo touch your soul, and mend a broken heart.\\n\\nSo let these lines, like whispered breeze,\\nWrap around your heart, with gentle ease.\\nFor in this poem, I'll pour my soul,\\nAnd hope its essence makes you whole.\", additional_kwargs={}, example=False)"
"AIMessage(content=\"In the realm of dreams, where thoughts take flight,\\nA tapestry of words, I shall now write.\\nWith ink and quill, I'll weave a tale,\\nOf love and hope, where hearts prevail.\\n\\nIn meadows adorned with flowers so fair,\\nA gentle breeze whispers secrets in the air.\\nThe sun shines bright, painting the sky,\\nA canvas of colors, where dreams never die.\\n\\nBeneath a canopy of stars, we shall dance,\\nLost in a moment, in a lover's trance.\\nOur hearts entwined, beats synchronized,\\nA symphony of love, never compromised.\\n\\nThrough valleys of sorrow, we shall tread,\\nWith courage and strength, our fears we'll shed.\\nFor love, a beacon, shall guide our way,\\nThrough darkest nights, to a brighter day.\\n\\nIn the depths of silence, a whispered prayer,\\nFor peace and harmony, beyond compare.\\nMay kindness bloom, like flowers in spring,\\nAnd compassion's song, forever sing.\\n\\nOh, let this poem be a gentle reminder,\\nThat within us all, love is a powerful binder.\\nFor in these words, a message so true,\\nThat love's embrace can heal and renew.\\n\\nSo let us cherish, this gift we possess,\\nThe power of words, to heal and impress.\\nThrough poetry's grace, may hearts be moved,\\nAnd in its beauty, we shall be proved.\", additional_kwargs={}, example=False)"
]
},
"execution_count": 22,
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -131,7 +131,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 44,
"id": "927d4bac",
"metadata": {},
"outputs": [
Expand All @@ -140,23 +140,23 @@
"output_type": "stream",
"text": [
"Example #1:\n",
"content=\"A good face wash for acne-prone skin is one that contains ingredients like salicylic acid or benzoyl peroxide. These ingredients are effective in combating acne by unclogging pores, reducing inflammation, and killing acne-causing bacteria. Here are a few recommendations:\\n\\n1. Neutrogena Oil-Free Acne Wash: This face wash contains salicylic acid, which helps to clear breakouts and prevent new ones. It is gentle on the skin and doesn't leave it feeling dry or tight.\\n\\n2. La Roche-Posay Effaclar Medicated Gel Cleanser: This cleanser is formulated with 2% salicylic acid and helps to remove excess oil and impurities from the skin. It is suitable for sensitive skin and helps to reduce acne breakouts.\\n\\n3. CeraVe Acne Foaming Cream Cleanser: This face wash is formulated with benzoyl peroxide to combat acne and promote a clear complexion. It also contains ceramides and hyaluronic acid to moisturize and protect the skin barrier.\\n\\nRemember, it's important to choose a face wash that suits your specific skin type and concerns. If you have severe acne or any underlying skin conditions, it's best to consult a dermatologist for personalized recommendations.\" additional_kwargs={} example=False\n",
"content='A highly recommended face wash for acne-prone skin is the \"Neutrogena Oil-Free Acne Wash.\" This product contains salicylic acid, which helps to treat and prevent acne by unclogging pores and reducing inflammation. It is oil-free, non-comedogenic, and gentle enough for daily use. Additionally, it effectively removes dirt, excess oil, and makeup without over-drying the skin.' additional_kwargs={} example=False\n",
"\n",
"\n",
"Example #2:\n",
"If you are looking for warm weather and beautiful beaches in December, here are some top destinations to consider:\n",
"If you're looking for warm weather and beautiful beaches in December, here are a few destinations you might consider:\n",
"\n",
"1. Maldives: Known for its crystal-clear waters and luxurious resorts, the Maldives is a perfect winter getaway. With average temperatures of around 27°C (81°F), you can enjoy sunbathing, snorkeling, and diving in the stunning coral reefs.\n",
"1. Maldives: This tropical paradise offers pristine beaches, crystal-clear waters, and luxurious resorts. December is a great time to visit, with temperatures averaging around 28°C (82°F).\n",
"\n",
"2. Thailand: Thailand offers a variety of beach destinations such as Phuket, Krabi, and Koh Samui. With temperatures ranging from 28-32°C (82-89°F), you can relax on the white sandy beaches, explore vibrant marine life, and indulge in delicious Thai cuisine.\n",
"2. Thailand: Thailand's southern islands, such as Phuket, Krabi, and Koh Samui, offer warm weather and stunning beaches in December. You can relax on the white sands, go snorkeling or diving, and explore the vibrant local culture.\n",
"\n",
"3. Bali, Indonesia: Bali is a tropical paradise with warm temperatures around 30°C (86°F) in December. It offers a mix of stunning beaches, lush landscapes, and vibrant culture. You can enjoy surfing, snorkeling, or simply unwind in luxury beach resorts.\n",
"3. Bali, Indonesia: Bali is a popular destination known for its stunning beaches, lush landscapes, and vibrant culture. In December, you can enjoy warm temperatures and take part in water sports or simply unwind by the beach.\n",
"\n",
"4. Seychelles: Located in the Indian Ocean, Seychelles is known for its pristine white sand beaches and turquoise waters. With temperatures averaging around 29°C (84°F), you can enjoy swimming, snorkeling, and even spot rare wildlife in the national parks.\n",
"4. Cancun, Mexico: Cancun is a favorite destination for beach lovers, with its turquoise waters and soft white sands. December is a great time to visit, with temperatures around 27°C (81°F), and you can also explore the nearby Mayan ruins.\n",
"\n",
"5. Caribbean Islands: The Caribbean is a popular choice for warm weather and beach vacations in December. Destinations like Barbados, Jamaica, and the Dominican Republic offer beautiful beaches, water sports, and a vibrant island atmosphere.\n",
"5. Seychelles: This archipelago in the Indian Ocean boasts some of the world's most beautiful beaches. December is an excellent time to visit, as the weather is warm and you can enjoy activities like snorkeling, diving, and island hopping.\n",
"\n",
"Remember to check travel advisories and local COVID-19 guidelines before planning your trip.\n"
"Remember to check travel restrictions and safety guidelines before planning your trip, as they may vary due to the ongoing COVID-19 pandemic.\n"
]
}
],
Expand Down Expand Up @@ -218,7 +218,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 45,
"id": "af7c236f",
"metadata": {},
"outputs": [],
Expand All @@ -228,45 +228,43 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 46,
"id": "2a4a32f0",
"metadata": {},
"outputs": [],
"source": [
"template = \"\"\"Your job is to come up with a fun DIY project for the specified gender, age, and description of a kid.\n",
"description_template = \"\"\"Your job is to come up with a fun DIY project for the specified gender, age, and description of a kid.\n",
"% CHILD_DESCRIPTION\n",
"{child_description}\n",
"\n",
"YOUR RESPONSE:\n",
"\"\"\"\n",
"prompt_template = PromptTemplate(input_variables=[\"child_description\"], template=template)\n",
"description_prompt_template = PromptTemplate(input_variables=[\"child_description\"], template=description_template)\n",
"\n",
"# Holds my 'location' chain\n",
"description_chain = LLMChain(llm=llm, prompt=prompt_template)"
"description_chain = LLMChain(llm=llm, prompt=description_prompt_template)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 47,
"id": "6eec47ff",
"metadata": {},
"outputs": [],
"source": [
"template = \"\"\"Given a DIY project, give a short and simple recipe step-by-step guide on how to complete the project and a materials list.\n",
"diy_description_template = \"\"\"Given a DIY project, give a short and simple recipe step-by-step guide on how to complete the project and a materials list.\n",
"% DIY_PROJECT\n",
"{diy_project}\n",
"\n",
"YOUR RESPONSE:\n",
"\"\"\"\n",
"prompt_template = PromptTemplate(input_variables=[\"diy_project\"], template=template)\n",
"diy_prompt_template = PromptTemplate(input_variables=[\"diy_project\"], template=diy_description_template)\n",
"\n",
"# Holds my 'meal' chain\n",
"diy_chain = LLMChain(llm=llm, prompt=prompt_template)"
"diy_chain = LLMChain(llm=llm, prompt=diy_prompt_template)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 48,
"id": "84a15aea",
"metadata": {},
"outputs": [],
Expand All @@ -276,7 +274,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 49,
"id": "15928f72",
"metadata": {},
"outputs": [
Expand All @@ -287,44 +285,48 @@
"\n",
"\n",
"\u001b[1m> Entering new SimpleSequentialChain chain...\u001b[0m\n",
"\u001b[36;1m\u001b[1;3mDIY Princess Crown Craft Kit: \n",
"\u001b[36;1m\u001b[1;3mDIY Sparkling Fairy Wand:\n",
"\n",
"Materials needed:\n",
"- Cardboard or foam sheet\n",
"- Wooden dowel or stick\n",
"- Glitter foam sheets in various colors\n",
"- Ribbon or tulle\n",
"- Craft glue\n",
"- Scissors\n",
"- Glue\n",
"- Decorative items (such as glitter, stickers, feathers, beads, sequins)\n",
"- Elastic string or ribbon\n",
"- Decorative gems or sequins\n",
"- Glitter glue (optional)\n",
"\n",
"Instructions:\n",
"1. Cut a strip of cardboard or foam sheet that is long enough to fit around the child's head.\n",
"2. Measure the strip to the child's head size and cut to adjust if needed.\n",
"3. Let the child decorate the strip with glue and decorative items of their choice. They can use glitter, stickers, feathers, beads, sequins, or anything else they find appealing.\n",
"4. Once the decorations are complete, let the glue dry completely.\n",
"5. Attach elastic string or ribbon to both ends of the strip to create a crown that can be worn on the head.\n",
"6. Help the child tie the elastic string or ribbon securely, making sure it is not too tight or too loose.\n",
"7. The princess crown is now ready to be worn and enjoyed! The child can wear it during imaginative play, dress-up sessions, or even for a princess-themed birthday party.\n",
"1. Begin by cutting out a star shape from one of the glitter foam sheets. This will be the top of the wand.\n",
"2. Cut out a long strip of foam from another color and wrap it around the wooden dowel or stick, starting from the bottom. Secure it with craft glue.\n",
"3. Cut out smaller shapes like hearts, butterflies, or flowers from different colored glitter foam sheets.\n",
"4. Use craft glue to stick these shapes onto the wrapped foam strip, creating a beautiful pattern. Let them dry completely.\n",
"5. Once the foam shapes are secure, add some extra sparkle by applying glitter glue to the edges or adding decorative gems or sequins.\n",
"6. Finally, tie ribbons or tulle strands to the bottom of the wooden dowel or stick for an extra touch of magic.\n",
"7. Let the wand dry completely before giving it to the 5-year-old girl to play with.\n",
"\n",
"Note: Adult supervision may be required for cutting and tying the elastic string/ribbon.\u001b[0m\n",
"\u001b[33;1m\u001b[1;3mDIY Princess Crown Craft Kit:\n",
"This DIY project will allow the 5-year-old girl to express her creativity and imagination as she creates her very own sparkling fairy wand. She can use it for pretend play, dress-up parties, or even as a room decoration.\u001b[0m\n",
"\u001b[33;1m\u001b[1;3mDIY Sparkling Fairy Wand:\n",
"\n",
"Materials needed:\n",
"- Cardboard or foam sheet\n",
"- Wooden dowel or stick\n",
"- Glitter foam sheets in various colors\n",
"- Ribbon or tulle\n",
"- Craft glue\n",
"- Scissors\n",
"- Glue\n",
"- Decorative items (such as glitter, stickers, feathers, beads, sequins)\n",
"- Elastic string or ribbon\n",
"- Decorative gems or sequins\n",
"- Glitter glue (optional)\n",
"\n",
"Instructions:\n",
"1. Cut a strip of cardboard or foam sheet that is long enough to fit around the child's head.\n",
"2. Measure the strip to the child's head size and cut to adjust if needed.\n",
"3. Let the child decorate the strip with glue and decorative items of their choice. They can use glitter, stickers, feathers, beads, sequins, or anything else they find appealing.\n",
"4. Once the decorations are complete, let the glue dry completely.\n",
"5. Attach elastic string or ribbon to both ends of the strip to create a crown that can be worn on the head.\n",
"6. Help the child tie the elastic string or ribbon securely, making sure it is not too tight or too loose.\n",
"7. The princess crown is now ready to be worn and enjoyed! The child can wear it during imaginative play, dress-up sessions, or even for a princess-themed birthday party.\n",
"1. Cut out a star shape from a glitter foam sheet for the top of the wand.\n",
"2. Wrap a long strip of foam from another color around the wooden dowel or stick, securing it with craft glue.\n",
"3. Cut out smaller shapes like hearts, butterflies, or flowers from different colored glitter foam sheets.\n",
"4. Use craft glue to stick these shapes onto the wrapped foam strip to create a pattern. Let them dry completely.\n",
"5. Add extra sparkle by applying glitter glue to the edges or adding decorative gems or sequins.\n",
"6. Tie ribbons or tulle strands to the bottom of the wooden dowel or stick for an extra touch of magic.\n",
"7. Let the wand dry completely before giving it to the 5-year-old girl to play with.\n",
"\n",
"Note: Adult supervision may be required for cutting and tying the elastic string/ribbon.\u001b[0m\n",
"This DIY project allows the 5-year-old girl to express her creativity and imagination. She can use the sparkling fairy wand for pretend play, dress-up parties, or even as a room decoration.\u001b[0m\n",
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n"
]
Expand Down

0 comments on commit 8dd46e8

Please sign in to comment.