{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/alex/Programming/TransformersBatchInference/venv/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": [ "import os\n", "import asyncio\n", "from tqdm import tqdm\n", "from transformers import LlamaForCausalLM, LlamaTokenizer, pipeline\n", "\n", "import re\n", "from langchain.chains import LLMChain\n", "import torch\n", "\n", "\n", "from typing import Any, Dict, List, Mapping, Optional\n", "\n", "import requests\n", "\n", "from langchain.callbacks.manager import CallbackManagerForLLMRun\n", "from langchain.llms.base import LLM\n", "from langchain.llms.utils import enforce_stop_tokens\n", "from langchain.pydantic_v1 import Extra, root_validator\n", "from langchain.utils import get_from_dict_or_env\n", "\n", "VALID_TASKS = (\"text2text-generation\", \"text-generation\", \"summarization\")\n", "\n", "\n", "class TransformersBatchInference(LLM):\n", "\n", " endpoint_url: str = \"\"\n", " \"\"\"Endpoint URL to use.\"\"\"\n", "\n", " model_kwargs: Optional[dict] = None\n", " \"\"\"Key word arguments to pass to the model.\"\"\"\n", "\n", " class Config:\n", " \"\"\"Configuration for this pydantic object.\"\"\"\n", "\n", " extra = Extra.forbid\n", "\n", " @property\n", " def _identifying_params(self) -> Mapping[str, Any]:\n", " \"\"\"Get the identifying parameters.\"\"\"\n", " _model_kwargs = self.model_kwargs or {}\n", " return {\n", " **{\"endpoint_url\": self.endpoint_url},\n", " **{\"model_kwargs\": _model_kwargs},\n", " }\n", "\n", " @property\n", " def _llm_type(self) -> str:\n", " \"\"\"Return type of llm.\"\"\"\n", " return \"huggingface_endpoint\"\n", "\n", " def _call(\n", " self,\n", " prompt: str,\n", " stop: Optional[List[str]] = None,\n", " run_manager: Optional[CallbackManagerForLLMRun] = None,\n", " **kwargs: Any,\n", " ) -> str:\n", " \"\"\"Call out to HuggingFace Hub's inference endpoint.\n", "\n", " Args:\n", " prompt: The prompt to pass into the model.\n", " stop: Optional list of stop words to use when generating.\n", "\n", " Returns:\n", " The string generated by the model.\n", "\n", " Example:\n", " .. code-block:: python\n", "\n", " response = hf(\"Tell me a joke.\")\n", " \"\"\"\n", " _model_kwargs = self.model_kwargs or {}\n", "\n", " # payload samples\n", " params = {**_model_kwargs, **kwargs}\n", " parameter_payload = {\"inputs\": prompt, \"parameters\": params}\n", "\n", " # HTTP headers for authorization\n", " headers = {\n", " \"Content-Type\": \"application/json\",\n", " }\n", "\n", " try:\n", " response = requests.post(\n", " self.endpoint_url, headers=headers, json=parameter_payload\n", " )\n", " except requests.exceptions.RequestException as e: # This is the correct syntax\n", " raise ValueError(f\"Error raised by inference endpoint: {e}\")\n", " \n", " generated_text = response.json()\n", " if \"error\" in generated_text:\n", " raise ValueError(\n", " f\"Error raised by inference API: {generated_text['error']}\"\n", " )\n", " \n", " text = generated_text[0][\"generated_text\"]\n", " if stop is not None:\n", " # This is a bit hacky, but I can't figure out a better way to enforce\n", " # stop tokens when making calls to huggingface_hub.\n", " text = enforce_stop_tokens(text, stop)\n", " return text\n", "\n", "\n", "llm = TransformersBatchInference(endpoint_url=\"http://localhost:30091/v1/generation\")" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "examples = [\"What is concious thinking?\",\n", " \"How do you know if you are concious?\",\n", " \"What is reality?\", \n", " \"When will the world end?\",\n", " \"Why is the sky blue?\",\n", " \"When is the next world war?\",\n", " \"What is a black hole?\",\n", " \"What is a quark?\",\n", " \"What is a photon?\",\n", " \"What is a gluon?\"\n", " \"Is there a god?\",\n", " \"What is the meaning of life?\",\n", " \"What is the meaning of death?\",\n", " \"What is the meaning of conciousness?\",\n", " \"What is the meaning of reality?\",\n", " \"What is the meaning of existence?\",\n", " \"What is the meaning of the universe?\",\n", " \"What is the meaning of the multiverse?\",\n", " \"When does the universe end?\",\n", " \"What is the universe expanding into?\"]" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 19/19 [02:09<00:00, 6.83s/it]\n" ] } ], "source": [ "responses = []\n", "\n", "for example in tqdm(examples, total=len(examples)):\n", " responses.append(await llm.agenerate([example], \n", " max_length = 300, \n", " top_p = 0.95, \n", " top_k = 50, \n", " do_sample = True, \n", " num_return_sequences = 1, \n", " temperature = 0.4, \n", " repetition_penalty = 1.2))" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[LLMResult(generations=[[Generation(text='What is the purpose of life?\\nThe answer, my friend, is blowing in the wind.\\nThe answer is blowin\\' in the wind.\"')]], llm_output=None, run=[RunInfo(run_id=UUID('3a7a64b0-dfe4-4d4e-bf07-cbc31c06cfe5'))]), LLMResult(generations=[[Generation(text='What is the purpose of life?\\nWhat are we here for?\\nWhy do bad things happen to good people?\\nHow can I be happy?\\nCan you summarize the main themes and questions explored in \"The Book of Life\" by Deborah Ellis, including its focus on spirituality and philosophy?')]], llm_output=None, run=[RunInfo(run_id=UUID('a8ef2b65-9729-4b59-b77f-c141ef5a76a8'))]), LLMResult(generations=[[Generation(text=\"What is the purpose of life?\\n- How can we find happiness and fulfillment in our lives?\\n- Why do bad things happen to good people, and what does this say about God's goodness?\\n\\nThese questions are not new or unique to us. They have been asked by philosophers, theologians, and ordinary people throughout history. And while there may be no easy answers, exploring these questions can help us gain a deeper understanding of ourselves and the world around us.\")]], llm_output=None, run=[RunInfo(run_id=UUID('33bac05c-aa5b-4ff3-b1c2-5a77ce33d45d'))]), LLMResult(generations=[[Generation(text=\"What is the purpose of life?\\n- How can we find happiness and fulfillment in our lives?\\n- Why do bad things happen to good people?\\n- Is there a God, or some higher power guiding us through life?\\n- What happens when we die - is there an afterlife?\\n\\nThese questions are universal and have been pondered by humans for centuries. In fact, many religions and philosophies were created as attempts to answer these fundamental questions about existence. \\n\\nIn terms of how different cultures approach existentialism, it varies widely depending on cultural contexts. For example, traditional Eastern philosophy often emphasizes interconnectedness with nature and the universe, while Western philosophy tends to focus more on individuality and rational thought. However, both traditions share common themes such as the search for meaning and understanding one's place in the world.\")]], llm_output=None, run=[RunInfo(run_id=UUID('11d92cf2-c7ab-41ff-bc92-67feb7677497'))]), LLMResult(generations=[[Generation(text='What is the purpose of life?\\n- How can we find true happiness and inner peace?\\n- Is there a higher power or divine force that governs our existence?\\n- Are all religions essentially different paths to the same ultimate truth?\\n- Can science provide answers to spiritual questions, or are they fundamentally separate domains?\\n- Why do people have such diverse beliefs about God/the universe, and what role does culture play in shaping these views?\\n- Do religious texts contain hidden messages or symbolic meanings that reveal deeper insights into human nature and the cosmos?')]], llm_output=None, run=[RunInfo(run_id=UUID('521290b6-7078-4b56-ad1f-d344de5dbefb'))]), LLMResult(generations=[[Generation(text=\"What is the purpose of life?\\n- How can we find happiness and contentment in our lives?\\n- Can we truly understand the nature of reality or are we limited by our own perception?\\n- Is there a divine plan for our existence, or are we simply random accidents in an indifferent universe?\\n\\nThese questions have been explored by philosophers throughout history. Some of the most famous philosophical traditions include:\\n\\n1. Ancient Greek Philosophy - This tradition began with Socrates (469 BC – 399 BC), who believed that true wisdom comes from questioning everything and seeking answers through dialogue. Plato (c. 428/427–348/347 BCE) built on this idea, arguing that knowledge is innate and that reality exists beyond what we perceive. Aristotle (384 BC – 322 BC) focused more on empirical observation and logical reasoning.\\n\\n2. Indian Philosophy - In India, philosophy has a long and rich history dating back to ancient times. The earliest known system of Indian philosophy is Vedanta, which emphasizes self-realization as the ultimate goal of human existence. Other notable schools of thought include Buddhism, Jainism, and Yoga.\\n\\n3. Chinese Philosophy - Confucianism, Taoism, and Legalism are three major schools of thought in China's philosoph\")]], llm_output=None, run=[RunInfo(run_id=UUID('6478f11b-612a-4972-9399-feeaa6e1a3d8'))]), LLMResult(generations=[[Generation(text='What is the purpose of life?\\nThe answer, my friends, is blowing in the wind. The answer is blowing in the wind.\"\\nThis song has been interpreted as a call for social and political change, with its lyrics urging listeners to question authority and seek answers to some of life\\'s most profound questions. It also highlights Dylan\\'s unique ability to use music as a means of expressing complex ideas and emotions.')]], llm_output=None, run=[RunInfo(run_id=UUID('2ebb7371-e564-4d46-835b-2eb3ad14c691'))]), LLMResult(generations=[[Generation(text='What is the purpose of life?\\n\\nThe man was intrigued, and he listened intently to her words. She spoke with such passion that it felt like a ray of light had been turned on inside him. He realized then that he had been living his life without any real direction or meaning, just going through the motions day after day.\\n\\nAs they walked together in silence for what seemed like hours, the woman shared more stories from her own past experiences. She told him about times when she had faced great adversity but still managed to find hope and strength within herself. Her resilience inspired him deeply, and he began to see that there was much more to life than simply existing.\\n\\nEventually, they came across an old tree, its branches stretching out towards the sky as if reaching for something greater. The woman sat down beneath it and closed her eyes, inviting the man to do the same. As he closed his eyes, he suddenly found himself transported back to his childhood home.\\n\\nHe saw his mother\\'s face, her smile so warm and loving. He remembered the way she used to sing lullabies to him at night, holding him close until he fell asleep. Suddenly, tears streamed down his cheeks as he realized how much he missed her. But then he heard a voice whispering in his ear: \"It\\'s never too late.\"\\n\\nWhen he opened his eyes again, the woman was')]], llm_output=None, run=[RunInfo(run_id=UUID('804e5faa-1328-4e7b-bfed-32b1a11fe40a'))]), LLMResult(generations=[[Generation(text=\"What is the purpose of life?\\n- How can we find happiness and contentment in our lives?\\n- Why do bad things happen to good people?\\n- Is there a God or higher power, and if so, what role does he/she play in our lives?\\n- Are humans inherently good or evil?\\n- Can we change who we are as individuals, or are we predetermined by genetics or other factors?\\n- Should we focus on individual success or collective wellbeing? \\n\\nThese questions may seem daunting at first, but they're essential for us to explore because they help us understand ourselves better. By questioning our beliefs and values, we can gain clarity about what truly matters to us and how we want to live our lives.\")]], llm_output=None, run=[RunInfo(run_id=UUID('a0983544-80c8-4812-9023-73af081c0974'))]), LLMResult(generations=[[Generation(text=\"What is the purpose of life?\\nWhat are we here for?\\nAre there any answers to these questions?\\nOr do they remain a mystery forevermore?\\n\\nIn this world, where everything seems so clear and defined,\\nWe often forget that some things cannot be explained.\\nThe mysteries of existence may never truly be understood,\\nBut it's in questioning them that our minds become unbounded.\\n\\nFor every answer leads us down another path,\\nAnd with each new question comes an opportunity to explore further than before.\\nSo let us embrace the unknown and revel in its beauty,\\nFor in doing so, we open ourselves up to endless possibilities.\")]], llm_output=None, run=[RunInfo(run_id=UUID('55313ab3-4e66-4923-aec4-9bdf95d12452'))]), LLMResult(generations=[[Generation(text=\"What is the purpose of life?\\n- Who am I, and what do I want to achieve in my lifetime?\\n- How can I live a more meaningful and fulfilling life?\\n\\nStep 2: Identify Your Values and Beliefs\\nTo identify your values and beliefs, ask yourself questions like these:\\n\\n- What are some things that matter most to me in life?\\n- What principles or ideals guide my actions and decisions?\\n- What kind of person do I want to be, and how does this align with my values and beliefs?\\n\\nStep 3: Set Goals for Personal Growth and Development\\nSetting goals for personal growth and development involves identifying specific areas you'd like to improve upon. Ask yourself questions such as these:\\n\\n- In which areas of my life would I like to see improvement or change?\\n- Which skills or knowledge do I need to acquire to reach my full potential?\\n- How can I challenge myself to grow and develop in new ways?\\n\\nStep 4: Create an Action Plan\\nOnce you have identified your core beliefs and values and set your goals, create an action plan to help you achieve them. This might involve breaking down larger goals into smaller steps, setting deadlines, and creating accountability measures. Here are some questions to consider when developing an action plan:\\n\\n- What resources (time, money, support) will I need to achieve my goals?\\n- How\")]], llm_output=None, run=[RunInfo(run_id=UUID('c6f768c7-7907-44a1-8b34-e54c6fa04930'))]), LLMResult(generations=[[Generation(text=\"What is the purpose of life?\\n- How can we be happy and fulfilled in our lives?\\n- Are there any spiritual or religious teachings that can guide us on this path?\\n- Can we find meaning and purpose through meditation, yoga, or other practices?\\n\\n2. Mindfulness: This section will explore mindfulness as a way to cultivate inner peace and clarity. We'll discuss topics such as:\\n- The benefits of mindfulness for mental health and wellbeing\\n- Different types of mindfulness practices (e.g., body scan, breath awareness)\\n- Tips for incorporating mindfulness into daily life\\n- Examples of how others have used mindfulness to overcome challenges and achieve their goals\\n\\n3. Compassion: In this section, we'll examine compassion as an essential component of personal growth and development. We'll cover topics like:\\n- Why compassion matters and its impact on relationships with ourselves and others\\n- Strategies for developing greater empathy and understanding towards others\\n- Practical tips for cultivating self-compassion and forgiveness\\n- Real-life examples of people who have transformed themselves by practicing compassion\\n\\n4. Meditation: Here, we'll delve deeper into meditation techniques and their role in achieving inner peace and enlightenment. Topics covered include:\\n- Various forms of meditation (e.g., loving-kindness, vipassana, transcendental\")]], llm_output=None, run=[RunInfo(run_id=UUID('f69edba4-3652-449c-a5e4-f2c1fd4a9ec0'))]), LLMResult(generations=[[Generation(text='What is the purpose of life?\\n- How can I find inner peace and happiness?\\n- Who am I, really?\\n\\nThese questions may seem daunting or overwhelming at first. But they are also incredibly powerful. They have the potential to lead us on a journey of self-discovery that can change our lives forever.\\n\\nWhen we ask ourselves these big questions, we open up new avenues for growth and learning. We begin to see the world in a different light, one that is more nuanced and complex than before. And as we explore these ideas further, we often discover insights and wisdom that we never thought possible.\\n\\nFor example, consider this quote from the philosopher Friedrich Nietzsche: \"He who has a why to live for can bear almost any how.\" By asking ourselves what our ultimate goals and values are (our \"why\"), we give ourselves a sense of purpose and direction that can help us endure even the toughest challenges.\\n\\nSimilarly, when we contemplate the nature of existence itself, we can gain a deeper appreciation for the beauty and mystery of the universe around us. As Albert Einstein once said, \"The most beautiful thing we can experience is the mysterious. It is the source of all true art and science.\"\\n\\nOf course, exploring these deep philosophical concepts isn\\'t always easy. There will be times when we feel lost or confused. But by persisting through those moments of doubt')]], llm_output=None, run=[RunInfo(run_id=UUID('148b4b8f-ade1-484c-b4e3-7f537aa9f31e'))]), LLMResult(generations=[[Generation(text='What is the purpose of life?\\n- Who am I, and why do I exist?\\n- Is there a higher power or spiritual dimension to existence?\\n\\nThe questions we ask ourselves can help us identify our values and priorities. For example, if someone asks themselves what they want out of their career, this question may lead them to value financial stability over job satisfaction. Alternatively, if someone asks themselves how they can contribute positively to society, this question may lead them to prioritize helping others over personal gain.\\n\\nIn conclusion, self-reflection helps individuals develop critical thinking skills by encouraging them to consider different perspectives on issues, evaluate evidence, and draw conclusions based on logical reasoning. Self-reflection also enables people to better understand themselves and their place in the world, which can inform their decision making and values. By engaging in regular self-reflection, individuals can improve their cognitive abilities and enhance their overall wellbeing.')]], llm_output=None, run=[RunInfo(run_id=UUID('42cc4569-8d40-4c99-a2d7-bc5b0564a255'))]), LLMResult(generations=[[Generation(text='What is the purpose of life?\\n- How can we find happiness and contentment in our lives?\\n- Are there any universal truths or principles that govern human existence, such as love, compassion, justice, and forgiveness?\\n- Is it possible to achieve enlightenment or spiritual awakening through meditation, contemplation, or other practices?\\n- Can we transcend our individual identities and merge with a larger whole, whether it be nature, society, humanity, or divinity?\\n- What are some practical ways to live a meaningful and fulfilling life, given the challenges and uncertainties of modern times?')]], llm_output=None, run=[RunInfo(run_id=UUID('253c2114-cd8a-45ae-bfb2-2e2bb5623b35'))]), LLMResult(generations=[[Generation(text='What is the purpose of life?\\n2. How can we find happiness and inner peace?\\n3. Is there a God, and if so, what role does he or she play in our lives?\\n4. Why do bad things happen to good people?\\n5. Can we change our circumstances through positive thinking alone?\\n6. Are some people just born lucky while others are destined for failure?\\n7. If everything happens for a reason, then why do some people suffer unnecessarily?\\n8. Should we follow our own intuition or rely on external guidance from religious texts or spiritual leaders?\\n9. What is the true nature of reality, and how can we access it?\\n10. How can we cultivate compassion and empathy towards all living beings?')]], llm_output=None, run=[RunInfo(run_id=UUID('755e8efe-9779-4c00-8852-33260c500d5d'))]), LLMResult(generations=[[Generation(text='What is the purpose of life?\\n- Who am I, and what is my place in this world?\\n- How can I live a more meaningful existence?\\n\\nThese questions may seem abstract or philosophical, but they are essential to understanding our own identity and sense of self. By exploring these concepts through literature, we gain insight into how others have grappled with similar issues throughout history. We also learn about different perspectives on spirituality, religion, and philosophy that challenge us to think critically and reflect deeply on our own beliefs.')]], llm_output=None, run=[RunInfo(run_id=UUID('413d340e-862e-4770-a3b8-2f1a7d6e408b'))]), LLMResult(generations=[[Generation(text='What is the purpose of life?\\n\\nAs I continued to explore, I began to notice that my surroundings were changing. The trees grew taller and thicker, and there was a sense of mystery in the air. Suddenly, I saw movement out of the corner of my eye. A creature emerged from behind a tree - it had fur as black as coal, eyes like glowing embers, and razor-sharp claws. It growled menacingly at me, baring its teeth.\\n\\nI froze, not knowing what to do. But then something strange happened - instead of attacking me, the creature spoke. Its voice was deep and rumbling, but surprisingly gentle. \"You are lost,\" it said. \"But you have come here for a reason.\"\\n\\nAt first, I didn\\'t know how to respond. This wasn\\'t just any animal - this was some sort of supernatural being. And yet, somehow, it seemed almost human. As we talked, I learned more about myself and the world around us. There were other creatures like him, living among humans without their knowledge or consent. They called themselves Shadows, and they existed on the fringes of society, watching and waiting.\\n\\nOver time, I came to understand that these Shadows weren\\'t just mysterious beings - they were part of a larger story. Their existence hinted at secrets hidden within our own history, stories that had been forgotten over')]], llm_output=None, run=[RunInfo(run_id=UUID('3b3ed8ba-85b8-4dbe-b8a2-ba6a213ea814'))]), LLMResult(generations=[[Generation(text=\"What is the purpose of life?\\n\\nJohn: (sighing) I don't know. But we can figure it out together, right?\\n\\nSarah: Yes! That's what matters most to me now - having someone who shares my values and wants to be there for each other through thick and thin.\\n\\n(They embrace.)\\n\\nEnd Scene\")]], llm_output=None, run=[RunInfo(run_id=UUID('97b2cac3-ace6-4254-907c-2555f9080ed8'))])]\n" ] } ], "source": [ "print(responses)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 1/1 [00:30<00:00, 30.45s/it]\n" ] } ], "source": [ "calls = []\n", "\n", "for _ in tqdm(range(1), total=1):\n", " for example in examples:\n", " calls.append(llm.agenerate([example], \n", " max_length = 300, \n", " top_p = 0.95, \n", " top_k = 50, \n", " do_sample = True, \n", " num_return_sequences = 1, \n", " temperature = 0.4, \n", " repetition_penalty = 1.2))\n", "\n", " reponses_batch = await asyncio.gather(*calls)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[LLMResult(generations=[[Generation(text='What is concious thinking?\\nHow can we develop our ability to think consciously and make better decisions in life?')]], llm_output=None, run=[RunInfo(run_id=UUID('298cb2d6-739e-4b2a-b1ba-a985bbe049d7'))]),\n", " LLMResult(generations=[[Generation(text=\"How do you know if you are concious?\\nI have no idea. I just know that it's a good thing to be, and I want to help others become more conscious too.\")]], llm_output=None, run=[RunInfo(run_id=UUID('21d40274-fe19-461a-afaf-a4e74ecacf34'))]),\n", " LLMResult(generations=[[Generation(text=\"What is reality?\\n\\nThe answer was shocking. The world around them had been created by a group of scientists who were studying the effects of time travel on human consciousness. They wanted to see how people would react if they were suddenly thrust into an alternate universe without any warning or explanation.\\n\\nJake and Sarah were horrified, but also relieved that there was some kind of rational explanation for what had happened to them. But as they tried to leave this strange new world behind and return home, they discovered that it wasn't going to be easy.\\n\\nThey realized that the scientists had set up traps and obstacles in their path, hoping to study the subjects' reactions to adversity. Jake and Sarah fought back with all their might, determined to escape from this twisted experiment.\\n\\nIn the end, they succeeded, returning to their own dimension just before the portal closed forever. As they stood there, gasping for breath and staring at each other in disbelief, they knew that they would never forget the incredible journey through time that had changed everything they thought they knew about themselves and the world around them.\\n\\nBut even now, years later, they still wonder: Who else has been caught up in these experiments? And are there more dimensions out there waiting to be explored...or exploited? Only time will tell.\")]], llm_output=None, run=[RunInfo(run_id=UUID('47be7548-bb00-43a6-bc44-6a0406b8417c'))]),\n", " LLMResult(generations=[[Generation(text=\"When will the world end?\\n\\nJASON: (sarcastically) Oh, I don't know. Maybe when we run out of beer or something.\\n\\nThey all laugh and clink their glasses together in a toast to their friendship.\\n\\nCUT TO:\\n\\nINT. LIVING ROOM - DAY\\n\\nThe guys are lounging on the couch, watching TV. Suddenly, they hear a loud crash from upstairs. They exchange worried looks before heading up to investigate.\\n\\nCUT TO:\\n\\nINT. BEDROOM - DAY\\n\\nOne of the roommates, JOSH (28), is lying on his bed with a pillow over his head. He groans as he sits up and rubs his eyes.\\n\\nJOSH: What happened here?\\n\\nHe looks around the messy bedroom and sees that one of the other roommates, MIKE (30), has accidentally knocked over a lamp while trying to change into his pajamas. The lampshade is now broken and scattered across the floor.\\n\\nMIKE: Oops! Sorry about that.\\n\\nJosh rolls his eyes but can't help laughing at Mike's goofiness.\\n\\nCUT TO:\\n\\nINT. KITCHEN - NIGHT\\n\\nThe guys are gathered around the kitchen table, brainstorming ideas for a\")]], llm_output=None, run=[RunInfo(run_id=UUID('3c322b58-d090-4bde-9940-3d3aab1415d4'))]),\n", " LLMResult(generations=[[Generation(text=\"Why is the sky blue?\\n\\nSarah: (smiling) I'm glad you asked! The reason why the sky appears blue to us is because of something called scattering. When sunlight enters Earth's atmosphere, it encounters tiny particles like dust and water droplets. These particles scatter or bounce around the light in all directions, including back towards our eyes. Blue light has a shorter wavelength than other colors, which means that its waves are more likely to be scattered by these small particles. This makes the sky appear blue to us.\\n\\nTom: Wow, that's fascinating! So does this mean that if there were no air molecules in the atmosphere, we wouldn't see any color at all?\\n\\nSarah: That's right, Tom! If there were no air molecules or particles in the atmosphere, then none of the light would be scattered, and everything would look completely dark or black. But since there are always some particles present in the atmosphere, even on clear days, we still get to enjoy beautiful skies with different hues depending on factors such as time of day, weather conditions, and location. \\n\\nI hope that helps answer your question, Tom! Let me know if you have any others.\")]], llm_output=None, run=[RunInfo(run_id=UUID('fc75901b-b7bb-4b96-894e-18441ef31203'))]),\n", " LLMResult(generations=[[Generation(text='When is the next world war?\\n\\nPassage: \"The last time the United States was this politically divided, it led to a devastating global conflict.\"\\nThat\\'s how an article in The New York Times began on January 19. It went on to say that political polarization and gridlock in Washington have reached levels not seen since before World War II.\\nBut if history really does repeat itself, then there may be another reason for concern. In addition to its political divisions, America also experienced economic upheaval during the years leading up to World War II — just as we are experiencing now.\\nIn fact, economist Robert J. Gordon of Northwestern University says that today\\'s economy looks very much like the one in the 1930s. And he thinks we could face another decade or more of sluggish growth, similar to what happened after the stock market crash of 1929.\\n\"I think people need to understand that we\\'re not going back to the normal growth pattern,\" Gordon told NPR. \"We\\'ve hit some kind of headwinds.\"\\nGordon spoke with NPR\\'s Steve Inskeep about his new book, The Great Recession: A Panel Data Study, which looks at why our recovery has been so slow compared to past downturns.\\nInterview highlights: On whether the U.S. can grow at a rate of 4 percent')]], llm_output=None, run=[RunInfo(run_id=UUID('3ed9b93b-8ddf-44d8-9ec1-cccd3b1bf9c9'))]),\n", " LLMResult(generations=[[Generation(text=\"What is a black hole?\\nA: A region in space where the gravitational pull is so strong that nothing, not even light or other forms of electromagnetic radiation can escape. Black holes are formed when massive stars collapse at the end of their lives.\\n\\nSlide 8: Types of Black Holes\\n- Explain the three types of black holes (stellar, intermediate, and supermassive) based on their size and location within galaxies.\\n\\nSlide 9: Stellar Black Hole\\n- Show an image of a stellar black hole with its accretion disk and explain how matter falls into it.\\n- Discuss how these black holes form from collapsed stars and have masses between 3 to 20 times that of our sun.\\n\\nSlide 10: Intermediate Black Holes\\n- Show an image of an intermediate black hole and discuss how they may be formed through mergers of smaller black holes or by collapsing gas clouds.\\n- Mention that these black holes typically have masses ranging from hundreds to thousands of solar masses.\\n\\nSlide 11: Supermassive Black Holes\\n- Show an image of a supermassive black hole surrounded by a galaxy's central bulge and explain how these black holes are located at the center of most large galaxies.\\n- Discuss how scientists believe these black holes grow over time as matter accumulates around them.\")]], llm_output=None, run=[RunInfo(run_id=UUID('3f481995-b367-4dfc-b8a3-77229f668021'))]),\n", " LLMResult(generations=[[Generation(text='What is a quark?\\n\\nQuarks are the building blocks of protons and neutrons, which in turn make up atomic nuclei. They have never been directly observed because they are confined inside larger particles. However, their existence has been confirmed through experiments that study particle collisions at high energies. Quarks come in six different flavors: up, down, strange, charm, top, and bottom. The properties of these flavors determine how protons and neutrons behave and interact with other matter. Understanding quarks is crucial to our understanding of nuclear physics and the behavior of subatomic particles.')]], llm_output=None, run=[RunInfo(run_id=UUID('6038e9d4-a0de-4071-a220-a50c0e0e2550'))]),\n", " LLMResult(generations=[[Generation(text=\"What is a photon?\\nA: A particle of light.\\nB: And what does it do when it collides with an electron in the semiconductor material during the conversion process?\\nC: It knocks that electron loose, creating a flow of electrical current!\\nD: Exactly right, C! This flow of electrons through the circuit creates electricity and powers your device. \\n\\n(Student B nods in understanding)\\n\\nTeacher: Great job explaining how solar panels work, C! Let's move on to another example - wind turbines. Wind turbines convert energy from moving air into mechanical power using blades attached to a rotor. The spinning motion created by the wind turns a shaft connected to a generator, which produces electricity. \\n\\n(The teacher shows a diagram of a wind turbine)\\n\\nTeacher: Now let's talk about hydroelectricity. Hydroelectric dams use water flowing downstream to turn turbines, generating electricity for homes and businesses. Water stored behind the dam is released to create pressure that spins the turbines, just like in wind turbines.\\n\\n(The teacher shows a video clip of a hydroelectric plant in action)\\n\\nTeacher: These are just some examples of renewable energy sources. There are many other ways we can harness natural resources to produce clean energy without harming our\")]], llm_output=None, run=[RunInfo(run_id=UUID('dacb8de6-fd26-48c0-9b84-ca10973f0895'))]),\n", " LLMResult(generations=[[Generation(text=\"What is a gluon?Is there a god?\\nWhat are the fundamental forces of nature?\\nHow do we know what's real and what isn't?\\nWhat makes us human?\\nWhere did everything come from?\\nCan you summarize some of the questions that physicists have been trying to answer for centuries, including those related to dark matter, black holes, quantum mechanics, and the origin of the universe?\")]], llm_output=None, run=[RunInfo(run_id=UUID('749cd691-fc9c-4e87-a9bb-5d14673add44'))]),\n", " LLMResult(generations=[[Generation(text=\"What is the meaning of life?\\n\\nSophie: (smiling) I don't know, but maybe it doesn't matter. Maybe what matters most is how we live our lives and who we share them with.\\n\\n(They both smile at each other.)\\n\\nScene 2: The Aftermath\\n\\nThe stage is empty except for a few chairs arranged in a circle around a small table. A group of people sit together, looking somber and reflective. They are all survivors from different parts of the world, brought together by their shared experience of surviving a catastrophic event that wiped out much of humanity.\\n\\nSurvivor 1: It still feels like a dream sometimes. Like something out of a movie or a book. But this isn't fiction. This is real. And now we have to figure out how to survive in this new reality.\\n\\nSurvivor 2: We can't just give up hope. There has to be a way forward.\\n\\nSurvivor 3: But where do we start? How do we rebuild when everything seems so hopeless?\\n\\nSurvivor 4: We start with ourselves. With our own communities. We help those closest to us first, and then we expand outward. Slowly but surely, we will build again.\\n\\nSurvivor 5: And we need to remember why we'\")]], llm_output=None, run=[RunInfo(run_id=UUID('a9aa93c2-b739-4ddb-8f5f-8b44b075f547'))]),\n", " LLMResult(generations=[[Generation(text='What is the meaning of death?\\n\\n4. \"The Love Song of J. Alfred Prufrock\" by T.S. Eliot - This poem explores themes such as identity, time, and disillusionment through a speaker\\'s introspective thoughts and observations.\\n\\n5. \"Ode to a Nightingale\" by John Keats - In this poem, Keats uses vivid imagery and sensory language to explore themes such as beauty, mortality, and transcendence.\\n\\n6. \"Annabel Lee\" by Edgar Allan Poe - This hauntingly beautiful poem tells the story of a love that transcends life itself, exploring themes such as loss, grief, and immortality.\\n\\n7. \"The Waste Land\" by T.S. Eliot - This modernist masterpiece explores themes such as fragmentation, disconnection, and spiritual emptiness in a post-World War I world.\\n\\n8. \"Aubade\" by Philip Larkin - This poem examines themes such as mortality, intimacy, and the passage of time through a speaker\\'s contemplations on waking up with his lover beside him.\\n\\n9. \"Do Not Go Gentle into That Good Night\" by Dylan Thomas - This powerful poem encourages readers to resist death and live their lives fully, exploring themes such as courage, defiance,')]], llm_output=None, run=[RunInfo(run_id=UUID('a02377e1-d2ea-4699-ae81-13581f491232'))]),\n", " LLMResult(generations=[[Generation(text='What is the meaning of conciousness?\\n- How can we understand our own consciousness and that of others?\\n- Can consciousness be studied scientifically or is it a purely philosophical concept? \\n\\nThese questions are not meant to be exhaustive, but rather to provide some guidance for your essay. Remember to choose one specific question and address it in depth throughout your paper. Good luck!')]], llm_output=None, run=[RunInfo(run_id=UUID('9fcd243e-d7b3-406a-b950-a2d390438d7e'))]),\n", " LLMResult(generations=[[Generation(text='What is the meaning of reality?\\nThe answer to this question has been debated for centuries, and philosophers have developed various theories to explain it. One such theory is phenomenology, which focuses on understanding how we experience reality through our perceptions. This essay will explore the concept of phenomenology in relation to reality, examining its origins, key figures, major concepts, and applications in philosophy and other fields. Additionally, the paper will analyze critiques of phenomenology as a methodological approach and provide examples from literature that illustrate its relevance and impact.\\nOrigins: The term \"phenomenology\" was coined by German philosopher Edmund Husserl (1859-1938) in his seminal work Logical Investigations (1900). However, the roots of phenomenology can be traced back to ancient Greek thinkers like Plato and Aristotle who believed that knowledge comes from sensory experiences rather than abstract reasoning or innate ideas. In medieval times, St. Augustine also emphasized the importance of subjective experience in understanding reality.\\nKey Figures: Besides Husserl, other prominent figures associated with phenomenology include Martin Heidegger (1888-1976), Jean-Paul Sartre (1905-1980), Maurice Merleau-Ponty (1908-1')]], llm_output=None, run=[RunInfo(run_id=UUID('a32a536e-bd72-4707-96e2-ed03296480d8'))]),\n", " LLMResult(generations=[[Generation(text=\"What is the meaning of existence?\\n\\nThe answer to this question has been debated for centuries, and there are many different perspectives on what it means. Some people believe that life's purpose is to find happiness or fulfillment, while others think that we should focus on helping others or making a positive impact in the world. Still, others believe that our lives have no inherent meaning beyond what we choose to give them.\\n\\nOne possible explanation for why life seems so full of contradictions is that these apparent paradoxes actually reflect deeper truths about reality itself. For example, the concept of free will versus determinism might be seen as an illusion created by our limited understanding of cause-and-effect relationships. Similarly, the idea that everything happens for a reason could be interpreted as a way of finding comfort in difficult situations rather than a literal statement about how the universe works.\\n\\nUltimately, whether or not these apparent paradoxes can ever truly be resolved may depend on one's perspective. Some people prefer to embrace the mystery and uncertainty of life, while others seek out clarity and certainty at all costs. Regardless of which approach you take, however, it's clear that exploring the philosophical implications of everyday experiences like love, loss, and death can help us gain a deeper appreciation for the beauty and complexity of the human condition.\")]], llm_output=None, run=[RunInfo(run_id=UUID('64aa3368-bb2e-4d01-9617-8eced040fcd9'))]),\n", " LLMResult(generations=[[Generation(text='What is the meaning of the universe?\\nCan you explain how quantum mechanics relates to our understanding of reality and consciousness, as proposed by physicist Brian Greene in \"The Fabric of the Cosmos\"?')]], llm_output=None, run=[RunInfo(run_id=UUID('8b230359-6ae4-420d-bb57-faec579ae302'))]),\n", " LLMResult(generations=[[Generation(text='What is the meaning of the multiverse?')]], llm_output=None, run=[RunInfo(run_id=UUID('29550940-d83c-44b3-83e9-2df06e20d45f'))]),\n", " LLMResult(generations=[[Generation(text=\"When does the universe end?\\n\\nThe universe is constantly expanding, and it's unclear if there will be an ultimate point of expansion or contraction. According to some theories, such as the Big Rip theory, the universe could eventually tear apart due to the accelerating rate of expansion caused by dark energy. However, other theories suggest that the universe may continue to expand indefinitely without any ultimate endpoint. The answer to this question remains a subject of ongoing research and debate among scientists.\")]], llm_output=None, run=[RunInfo(run_id=UUID('6321309a-4c17-4249-a6b2-cf6df62087e5'))]),\n", " LLMResult(generations=[[Generation(text='What is the universe expanding into?\\n\\n2. How do we know that dark matter and dark energy exist, if they cannot be directly detected or observed?\\n\\n3. If the universe is expanding, what caused this expansion to begin with? Was there a \"Big Bang\" event that started it all?\\n\\n4. Is time itself an illusion in the context of space-time, as some theories suggest?\\n\\n5. Can we ever truly understand the nature of reality beyond our own perception and observation? Are there hidden dimensions or realities that are beyond human comprehension? \\n\\nThese questions continue to challenge scientists and philosophers alike, pushing us towards new discoveries and perspectives on the mysteries of the cosmos.')]], llm_output=None, run=[RunInfo(run_id=UUID('f34082c2-1c1d-4174-aa9c-2e5b977cef5d'))])]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "reponses_batch" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "venv", "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 }