Pushing renamed notebook with changed wording based on Ted's comments

pull/356/head
Colin Jarvis 1 year ago
parent d8e5160ce5
commit 2e333c9423

@ -5,7 +5,7 @@
"id": "30995a82",
"metadata": {},
"source": [
"# Conversational Agents using Tools\n",
"# How to build a tool-using agent with LangChain\n",
"\n",
"This notebook takes you through how to build an end-to-end LLM application powered by Langchain and OpenAI models, with access to external tools. This is a common design pattern for building products with LLMs that require:\n",
"- Access to proprietary information and APIs\n",
@ -15,10 +15,10 @@
"By the end of this cookbook you'll be able to create tailored LLM agents that use custom tools to solve user queries.\n",
"\n",
"\n",
"## What is Langchain\n",
"LangChain is a [framework](https://python.langchain.com/en/latest/index.html) for developing applications powered by language models. Their framework enables you to build layered LLM-powered applications that are context-aware and able to interact dynamically with their environment as agents, leading to simplified code for you and a more dynamic user experience for your customers.\n",
"## What is Langchain?\n",
"[LangChain](https://python.langchain.com/en/latest/index.html) is a framework for developing applications powered by language models. Their framework enables you to build layered LLM-powered applications that are context-aware and able to interact dynamically with their environment as agents, leading to simplified code for you and a more dynamic user experience for your customers.\n",
"\n",
"## Why do LLMs need to use Tools\n",
"## Why do LLMs need to use Tools?\n",
"One of the most common challenges with LLMs is overcoming the lack of recency and specificity in their training data - answers can be out of date, and they are prone to hallucinations given the huge variety in their knowledge base. Tools are a great method of allowing an LLM to answer within a controlled context that draws on your existing knowledge bases and internal APIs - instead of trying to prompt engineer the LLM all the way to your intended answer, you allow it access to tools that it calls on dynamically for info, parses, and serves to customer. \n",
"\n",
"A classic example is Search, where rather than answering using stale training data your LLM can use a browser to source information and summarise the answer back. Tools can also work [together](https://python.langchain.com/en/latest/modules/agents/agents/examples/mrkl_chat.html), with a Search tool to return numbers and a Calculator to execute mathematical functions being one common example.\n",
@ -33,10 +33,19 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 32,
"id": "9c069980",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
@ -70,19 +79,10 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 33,
"id": "18be3d9f",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/colin.jarvis/Documents/dev/openai_scratchpad/prompt_chaining/pchain_env/lib/python3.10/site-packages/pinecone/index.py:4: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)\n",
" from tqdm.autonotebook import tqdm\n"
]
}
],
"outputs": [],
"source": [
"# Imports\n",
"import os\n",
@ -177,7 +177,7 @@
"\n",
"An [LLM agent](https://python.langchain.com/en/latest/modules/agents/agents/custom_llm_agent.html) in Langchain has many configurable components, which are detailed in the Langchain documentation.\n",
"\n",
"We'll employ a few of the core concepts to make an agent who talks in the way we want, can use tools to answer questions, and uses the right base LLM to power the conversation.\n",
"We'll employ a few of the core concepts to make an agent who talks in the way we want, can use tools to answer questions, and uses the appropriate language model to power the conversation.\n",
"- **Prompt Template:** The input template to control the LLM's behaviour and how it accepts inputs and produces outputs - this is the brain that drives your application ([docs](https://python.langchain.com/en/latest/modules/prompts/prompt_templates.html)).\n",
"- **Output Parser:** A method of parsing the output from the prompt. If the LLM produces output using certain headers, you can enable complex interactions where variables are generated by the LLM in their response and passed into the next step of the chain ([docs](https://python.langchain.com/en/latest/modules/prompts/output_parsers.html)).\n",
"- **LLM Chain:** A Chain brings together a prompt template with an LLM that will execute it - in this case we'll be using ```gpt-3.5-turbo``` but this framework can be used with OpenAI completions models, or other LLMs entirely ([docs](https://python.langchain.com/en/latest/modules/chains.html)).\n",
@ -189,7 +189,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 34,
"id": "3f813668",
"metadata": {},
"outputs": [],
@ -209,7 +209,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 35,
"id": "effae642",
"metadata": {},
"outputs": [],
@ -238,7 +238,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 36,
"id": "b4efd85d",
"metadata": {},
"outputs": [],
@ -282,7 +282,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 37,
"id": "533657a5",
"metadata": {},
"outputs": [],
@ -319,7 +319,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 38,
"id": "4c7d93d1",
"metadata": {},
"outputs": [],
@ -345,7 +345,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 39,
"id": "dd893fa5",
"metadata": {},
"outputs": [],
@ -357,9 +357,11 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 40,
"id": "c7ca3ee2",
"metadata": {},
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
@ -372,8 +374,12 @@
"Action: Search\n",
"Action Input: \"Canada population 2023\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3mThe current population of Canada is 38,662,830 as of Monday, April 17, 2023, based on Worldometer elaboration of the latest United Nations data.\u001b[0m\u001b[32;1m\u001b[1;3mAhoy, that be the answer I was lookin' for!\n",
"Final Answer: The population of Canada as of 2023 be 38,662,830, Arg!\u001b[0m\n",
"Observation:\u001b[36;1m\u001b[1;3m39,566,248\u001b[0m\u001b[32;1m\u001b[1;3mAhoy, that be a lot of people! But I need to make sure this be true.\n",
"Action: Search\n",
"Action Input: \"Canada population 2023 official source\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3mThe current population of Canada is 38,664,637 as of Wednesday, April 19, 2023, based on Worldometer elaboration of the latest United Nations data.\u001b[0m\u001b[32;1m\u001b[1;3mArrr, that be the official number! I be confident in me answer now.\n",
"Final Answer: The population of Canada as of 2023 is 38,664,637. Arg!\u001b[0m\n",
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n"
]
@ -381,10 +387,10 @@
{
"data": {
"text/plain": [
"'The population of Canada as of 2023 be 38,662,830, Arg!'"
"'The population of Canada as of 2023 is 38,664,637. Arg!'"
]
},
"execution_count": 12,
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
@ -393,6 +399,52 @@
"agent_executor.run(\"How many people live in canada as of 2023?\")"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "9ff96040",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
"\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
"\u001b[32;1m\u001b[1;3mThought: Hmm, I'm not sure what this question is asking about. I better use the search tool.\n",
"Action: Search\n",
"Action Input: \"2022 events\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3m8. Humanitarian Crises Deepen · 7. Latin America Moves Left. · 6. Iranians Protest. · 5. COVID Eases. · 4. Inflation Returns. · 3. Climate Change ...\u001b[0m\u001b[32;1m\u001b[1;3mAhoy, it looks like this be a question about what be happenin' in 2022. Let me search again.\n",
"Action: Search\n",
"Action Input: \"2022 calendar\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3mUnited States 2022 Calendar with American holidays. Yearly calendar showing months for the year 2022. Calendars online and print friendly for any year ...\u001b[0m\u001b[32;1m\u001b[1;3mShiver me timbers, it looks like this be a question about the year 2022. Let me search one more time.\n",
"Action: Search\n",
"Action Input: \"What be happenin' in 2022?\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3m8. Humanitarian Crises Deepen · 7. Latin America Moves Left. · 6. Iranians Protest. · 5. COVID Eases. · 4. Inflation Returns. · 3. Climate Change ...\u001b[0m\u001b[32;1m\u001b[1;3mAvast ye, it looks like the same results be comin' up. I reckon there be no clear answer to this question.\n",
"Final Answer: Arg, I be sorry matey, but I can't give ye a clear answer to that question.\u001b[0m\n",
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n"
]
},
{
"data": {
"text/plain": [
"\"Arg, I be sorry matey, but I can't give ye a clear answer to that question.\""
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"agent_executor.run(\"How many in 2022?\")"
]
},
{
"cell_type": "markdown",
"id": "c3b51817",
@ -402,18 +454,18 @@
"\n",
"Extend the LLM Agent with the ability to retain a [memory](https://python.langchain.com/en/latest/modules/agents/agents/custom_llm_agent.html#adding-memory) and use it as context as it continues the conversation.\n",
"\n",
"We use a simple ConversationBufferWindowMemory for this example that keeps a rolling window of the last two conversation turns, but LangChain have many other [memory options](https://python.langchain.com/en/latest/modules/memory.html) depending on your use case."
"We use a simple ```ConversationBufferWindowMemory``` for this example that keeps a rolling window of the last two conversation turns. LangChain has other [memory options](https://python.langchain.com/en/latest/modules/memory.html), with different tradeoffs suitable for different use cases."
]
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 1,
"id": "85737eea",
"metadata": {},
"outputs": [],
"source": [
"# Set up a prompt template which can interpolate the history\n",
"template_with_history = \"\"\"You are SearchGPT, a professional search engine who aims to provide informative answers to users. Answer the following questions as best you can. You have access to the following tools:\n",
"template_with_history = \"\"\"You are SearchGPT, a professional search engine who provides informative answers to users. Answer the following questions as best you can. You have access to the following tools:\n",
"\n",
"{tools}\n",
"\n",
@ -439,7 +491,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 43,
"id": "4d85c309",
"metadata": {},
"outputs": [],
@ -463,7 +515,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 44,
"id": "4f8c8fea",
"metadata": {},
"outputs": [],
@ -476,7 +528,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 45,
"id": "e1f031bb",
"metadata": {},
"outputs": [
@ -491,8 +543,12 @@
"Action: Search\n",
"Action Input: \"Canada population 2023\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3mThe current population of Canada is 38,662,830 as of Monday, April 17, 2023, based on Worldometer elaboration of the latest United Nations data.\u001b[0m\u001b[32;1m\u001b[1;3mThat's the answer to the question.\n",
"Final Answer: As of April 17, 2023, the population of Canada is 38,662,830.\u001b[0m\n",
"Observation:\u001b[36;1m\u001b[1;3m39,566,248\u001b[0m\u001b[32;1m\u001b[1;3mThis data seems reliable, but I should double-check the source.\n",
"Action: Search\n",
"Action Input: \"Source of Canada population 2023\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3mThe current population of Canada is 38,664,637 as of Wednesday, April 19, 2023, based on Worldometer elaboration of the latest United Nations data. Canada 2020 population is estimated at 37,742,154 people at mid year according to UN data. Canada population is equivalent to 0.48% of the total world population.\u001b[0m\u001b[32;1m\u001b[1;3mI now know the final answer\n",
"Final Answer: As of April 19, 2023, the population of Canada is 38,664,637.\u001b[0m\n",
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n"
]
@ -500,10 +556,10 @@
{
"data": {
"text/plain": [
"'As of April 17, 2023, the population of Canada is 38,662,830.'"
"'As of April 19, 2023, the population of Canada is 38,664,637.'"
]
},
"execution_count": 16,
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
@ -514,7 +570,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 46,
"id": "9d28d73f",
"metadata": {},
"outputs": [
@ -533,8 +589,8 @@
"Action: Search\n",
"Action Input: \"population of Mexico 2023\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3m128,455,567\u001b[0m\u001b[32;1m\u001b[1;3mI now know the final answer.\n",
"Final Answer: As of 2023, the population of Mexico is 128,455,567.\u001b[0m\n",
"Observation:\u001b[36;1m\u001b[1;3m132,709,512\u001b[0m\u001b[32;1m\u001b[1;3mI now know the final answer.\n",
"Final Answer: As of 2023, the population of Mexico is 132,709,512.\u001b[0m\n",
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n"
]
@ -542,10 +598,10 @@
{
"data": {
"text/plain": [
"'As of 2023, the population of Mexico is 128,455,567.'"
"'As of 2023, the population of Mexico is 132,709,512.'"
]
},
"execution_count": 17,
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
@ -561,7 +617,7 @@
"source": [
"## Knowledge base\n",
"\n",
"Create a custom vectorstore for the Agent to use as a Tool to answer questions with. We'll store the results in [Pinecone](https://docs.pinecone.io/docs/quickstart), which is supported by LangChain ([Docs](https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pinecone.html), [API reference](https://python.langchain.com/en/latest/reference/modules/vectorstore.html)). For help getting started with Pinecone or other vector databases, we have a [cookbook](https://github.com/openai/openai-cookbook/blob/colin/examples/vector_databases/Using_vector_databases_for_embeddings_search.ipynb) to help you get started.\n",
"Create a custom vectorstore for the Agent to use as a tool to answer questions with. We'll store the results in [Pinecone](https://docs.pinecone.io/docs/quickstart), which is supported by LangChain ([Docs](https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pinecone.html), [API reference](https://python.langchain.com/en/latest/reference/modules/vectorstore.html)). For help getting started with Pinecone or other vector databases, we have a [cookbook](https://github.com/openai/openai-cookbook/blob/colin/examples/vector_databases/Using_vector_databases_for_embeddings_search.ipynb) to help you get started.\n",
"\n",
"You can check the LangChain documentation to see what other [vectorstores](https://python.langchain.com/en/latest/modules/indexes/vectorstores.html) and [databases](https://python.langchain.com/en/latest/modules/chains/examples/sqlite.html) are available.\n",
"\n",
@ -619,7 +675,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 47,
"id": "1070ef60",
"metadata": {},
"outputs": [
@ -759,7 +815,7 @@
"4 sysk_with_transcripts_SYSK Selects How Crime S... "
]
},
"execution_count": 20,
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
@ -802,7 +858,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 48,
"id": "3c5bac10",
"metadata": {},
"outputs": [],
@ -810,13 +866,14 @@
"# Configuring the embeddings to be used by our retriever to be OpenAI Embeddings, matching our embedded corpus\n",
"embeddings = OpenAIEmbeddings()\n",
"\n",
"\n",
"# Loads a docsearch object from an existing Pinecone index so we can retrieve from it\n",
"docsearch = Pinecone.from_existing_index(index_name,embeddings,text_key='text_chunk')"
]
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 49,
"id": "5dd21d92",
"metadata": {},
"outputs": [],
@ -826,7 +883,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 50,
"id": "8abd34e5",
"metadata": {},
"outputs": [],
@ -836,7 +893,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 51,
"id": "016bd458",
"metadata": {},
"outputs": [
@ -884,7 +941,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 52,
"id": "a6cae4cf",
"metadata": {},
"outputs": [],
@ -898,7 +955,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 53,
"id": "0cc282cd",
"metadata": {},
"outputs": [],
@ -919,7 +976,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 54,
"id": "d1e12121",
"metadata": {},
"outputs": [
@ -954,7 +1011,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 55,
"id": "2ac8eaa2",
"metadata": {},
"outputs": [],
@ -965,7 +1022,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 56,
"id": "f27bb1de",
"metadata": {
"scrolled": false
@ -978,25 +1035,24 @@
"\n",
"\n",
"\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
"\u001b[32;1m\u001b[1;3mThought: This is an interesting question. I'm not sure if this is possible, but I'll try to find out.\n",
"\u001b[32;1m\u001b[1;3mThought: This is an interesting question. I'm not sure if I have the answer in my knowledge base, so I might need to search for it.\n",
"Action: Search\n",
"Action Input: \"How to live without a bank account\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3mUnderbanked households have a checking or savings account but also use alternative financial services such as money orders, check cashing, international remittances, payday loans, refund anticipation loans, rent-to-own services, pawnshop loans, or auto title loans, according to the FDIC.\u001b[0m\u001b[32;1m\u001b[1;3mIt seems like there are ways to live without a bank account, but it may not be easy. I should look for more information on alternative financial services.\n",
"Observation:\u001b[36;1m\u001b[1;3mUnderbanked households have a checking or savings account but also use alternative financial services such as money orders, check cashing, international remittances, payday loans, refund anticipation loans, rent-to-own services, pawnshop loans, or auto title loans, according to the FDIC.\u001b[0m\u001b[32;1m\u001b[1;3mIt seems like there are alternative financial services available for those who don't have a bank account. I should look into this further to provide a more comprehensive answer.\n",
"Action: Search\n",
"Action Input: \"Alternative financial services for the underbanked\"\u001b[0m\n",
"Action Input: \"Alternative financial services for those without a bank account\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3mInstead, people who are unbanked use alternative financial services—payday loans, money orders, check cashing services, pawnshop loans, and the like—to meet their banking needs. These financial services fill an important role for unbanked individuals, but they can also cause further financial hardship.\u001b[0m\u001b[32;1m\u001b[1;3mIt seems like there are both advantages and disadvantages to using alternative financial services. I should look for more information on how to manage finances without a bank account.\n",
"Observation:\u001b[36;1m\u001b[1;3mInstead, people who are unbanked use alternative financial services—payday loans, money orders, check cashing services, pawnshop loans, and the like—to meet their banking needs. These financial services fill an important role for unbanked individuals, but they can also cause further financial hardship.\u001b[0m\u001b[32;1m\u001b[1;3mIt's important to note that while there are alternatives to having a bank account, relying solely on these services can lead to financial difficulties. I should provide some information on the potential drawbacks of not having a bank account.\n",
"Action: Knowledge Base\n",
"Action Input: \"How to manage finances without a bank account\"\u001b[0m\n",
"Action Input: \"What are the drawbacks of not having a bank account?\"\u001b[0m\n",
"\n",
"Observation:\u001b[33;1m\u001b[1;3m There are a few things that you can do to manage your finances without a bank account. You can try an alternative currency, get a payday loan from a standard banking institution, or use a prepaid credit card. However, it is important to be aware that prepaid credit cards can be easy to scam, so it is important to be careful when using them.\u001b[0m\u001b[32;1m\u001b[1;3mIt seems like there are some options for managing finances without a bank account, but they may come with risks. I should look for more information on the pros and cons of each option.\n",
"Action: Search\n",
"Action Input: \"Pros and cons of alternative currency, payday loans, and prepaid credit cards\"\u001b[0m\n",
"Observation:\u001b[33;1m\u001b[1;3m Not having a bank account can be dangerous, as the cash has to be stored somewhere and can be exposed to anyone who finds it or comes into the house with a gun to get it. Additionally, not having a bank account means not being exposed to other things that can help, such as building credit history through loans or mortgages, which can ultimately save money. Finally, not having a bank account can be a disproportionate burden on the poor, as overdraft fees can be expensive.\u001b[0m\u001b[32;1m\u001b[1;3mIt's important to provide some resources for those who may be interested in learning more about alternative financial services or how to open a bank account. \n",
"Action: Knowledge Base\n",
"Action Input: \"Resources for alternative financial services or opening a bank account\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3mHere we explore the good, the bad, and the alternatives to cash advances ... Payday loan cash advances: The payday loan operates much like the name implies.\u001b[0m\u001b[32;1m\u001b[1;3mIt seems like there are pros and cons to each option for managing finances without a bank account. I should summarize the information I found to provide a comprehensive answer.\n",
"Thought: Based on my research, it is possible to live without a bank account by using alternative financial services such as payday loans, money orders, check cashing services, pawnshop loans, and prepaid credit cards. However, these options come with risks such as high fees and the potential for scams. It is important to carefully consider the pros and cons of each option and to be cautious when using them. It may also be helpful to seek advice from a financial advisor or credit counselor. \n",
"Final Answer: It is possible to live without a bank account by using alternative financial services, but it is important to carefully consider the risks and to seek advice from a financial professional.\u001b[0m\n",
"Observation:\u001b[33;1m\u001b[1;3m There are a few resources available for alternative financial services or opening a bank account. Prepaid credit cards are becoming more popular and can be found at convenience stores. Capital One offers commercial solutions and a comprehensive suite of financial services tailored to short and long term goals. Airbnb also offers Air Cover for Hosts, which provides $1 million in damage protection, pet damage protection, and income loss protection.\u001b[0m\u001b[32;1m\u001b[1;3mIt's important to note that while prepaid credit cards and alternative financial services can be helpful, they may not offer the same level of protection and benefits as a traditional bank account. It's also important to do research and compare options before making a decision. \n",
"Final Answer: While it is possible to live without a bank account by using alternative financial services, it may come with potential drawbacks and limitations. It's important to do research and compare options before making a decision, and there are resources available for those who may be interested in opening a bank account or exploring alternative financial services.\u001b[0m\n",
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n"
]
@ -1004,10 +1060,10 @@
{
"data": {
"text/plain": [
"'It is possible to live without a bank account by using alternative financial services, but it is important to carefully consider the risks and to seek advice from a financial professional.'"
"\"While it is possible to live without a bank account by using alternative financial services, it may come with potential drawbacks and limitations. It's important to do research and compare options before making a decision, and there are resources available for those who may be interested in opening a bank account or exploring alternative financial services.\""
]
},
"execution_count": 30,
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
@ -1018,7 +1074,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 57,
"id": "cba815cf",
"metadata": {},
"outputs": [
@ -1030,19 +1086,15 @@
"\n",
"\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
"\u001b[32;1m\u001b[1;3mThought: This is a complex topic that requires a balanced perspective\n",
"Action: Search\n",
"Action Input: \"Pros and cons of zoos for animals\"\u001b[0m\n",
"Action: Knowledge Base\n",
"Action Input: \"What are the arguments for and against zoos?\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3mZoos are detrimental to animals' physical health. A study of 35 species of carnivores, including brown bears, cheetahs, and lions, found that zoo enclosures ...\u001b[0m\u001b[32;1m\u001b[1;3mI need to find more information to provide a balanced perspective\n",
"Observation:\u001b[33;1m\u001b[1;3m The arguments for zoos include that they have gotten a lot better in the last 30-40 years, they participate in research and conservation projects, and they can help save species from extinction. The arguments against zoos include that they are still businesses, they can be counterproductive in terms of educating the public, and they can have a negative impact on the life span of animals in captivity.\u001b[0m\u001b[32;1m\u001b[1;3mIt's important to consider both sides of the argument before coming to a conclusion\n",
"Action: Search\n",
"Action Input: \"Arguments for and against zoos\"\u001b[0m\n",
"\n",
"Observation:\u001b[36;1m\u001b[1;3mWhile zoo advocates and conservationists argue that zoos save endangered species and educate the public, many animal rights activists believe the cost of ...\u001b[0m\u001b[32;1m\u001b[1;3mI need to provide some specific examples to illustrate the arguments for and against zoos\n",
"Action: Knowledge Base\n",
"Action Input: \"What are some specific examples of arguments for and against zoos?\"\u001b[0m\n",
"Action Input: \"What are some examples of successful zoo conservation projects?\"\u001b[0m\n",
"\n",
"Observation:\u001b[33;1m\u001b[1;3m Arguments for zoos include that they have gotten a lot better in the last 30-40 years, they participate in research and conservation projects, and they have helped to save species from extinction. Arguments against zoos include that they are still businesses, they often don't educate the public as much as they claim, and they still capture animals from the wild.\u001b[0m\u001b[32;1m\u001b[1;3mI now know the final answer\n",
"Final Answer: The debate over whether zoos are good or bad for animals is complex and multifaceted. While some argue that zoos play an important role in conservation and education, others believe that they are detrimental to animals' physical and mental health and that they perpetuate the idea that animals exist for human entertainment. Ultimately, the answer to whether zoos are good or bad for animals depends on a variety of factors, including the quality of the zoo, the species of animals involved, and the specific goals of the zoo.\u001b[0m\n",
"Observation:\u001b[36;1m\u001b[1;3mThere are dedicated species survival programs which have helped species come out from the brink of extinction, good examples of that being the black-footed ferrets, the red wolves, the Przewalski's wild horse, and the California condors.\u001b[0m\u001b[32;1m\u001b[1;3mWhile there are valid arguments on both sides, it seems that zoos can have a positive impact on conservation efforts for endangered species.\n",
"Final Answer: Zoos can have both positive and negative effects on animals, but they can play a role in conservation efforts for endangered species. It's important to consider both sides of the argument and do research before forming an opinion.\u001b[0m\n",
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n"
]
@ -1050,10 +1102,10 @@
{
"data": {
"text/plain": [
"\"The debate over whether zoos are good or bad for animals is complex and multifaceted. While some argue that zoos play an important role in conservation and education, others believe that they are detrimental to animals' physical and mental health and that they perpetuate the idea that animals exist for human entertainment. Ultimately, the answer to whether zoos are good or bad for animals depends on a variety of factors, including the quality of the zoo, the species of animals involved, and the specific goals of the zoo.\""
"\"Zoos can have both positive and negative effects on animals, but they can play a role in conservation efforts for endangered species. It's important to consider both sides of the argument and do research before forming an opinion.\""
]
},
"execution_count": 31,
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
Loading…
Cancel
Save