{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "49d94364", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: streamlit in /opt/conda/lib/python3.12/site-packages (1.45.1)\n", "Requirement already satisfied: langchain-community in /opt/conda/lib/python3.12/site-packages (0.3.24)\n", "Requirement already satisfied: langchain-openai in /opt/conda/lib/python3.12/site-packages (0.3.18)\n", "Requirement already satisfied: langchain-text-splitters in /opt/conda/lib/python3.12/site-packages (0.3.8)\n", "Requirement already satisfied: requests in /opt/conda/lib/python3.12/site-packages (2.32.3)\n", "Requirement already satisfied: pathlib in /opt/conda/lib/python3.12/site-packages (1.0.1)\n", "Requirement already satisfied: pypdf in /opt/conda/lib/python3.12/site-packages (5.5.0)\n", "Requirement already satisfied: altair<6,>=4.0 in /opt/conda/lib/python3.12/site-packages (from streamlit) (5.5.0)\n", "Requirement already satisfied: blinker<2,>=1.5.0 in /opt/conda/lib/python3.12/site-packages (from streamlit) (1.9.0)\n", "Requirement already satisfied: cachetools<6,>=4.0 in /opt/conda/lib/python3.12/site-packages (from streamlit) (5.5.2)\n", "Requirement already satisfied: click<9,>=7.0 in /opt/conda/lib/python3.12/site-packages (from streamlit) (8.2.0)\n", "Requirement already satisfied: numpy<3,>=1.23 in /opt/conda/lib/python3.12/site-packages (from streamlit) (1.26.4)\n", "Requirement already satisfied: packaging<25,>=20 in /opt/conda/lib/python3.12/site-packages (from streamlit) (24.2)\n", "Requirement already satisfied: pandas<3,>=1.4.0 in /opt/conda/lib/python3.12/site-packages (from streamlit) (2.2.3)\n", "Requirement already satisfied: pillow<12,>=7.1.0 in /opt/conda/lib/python3.12/site-packages (from streamlit) (11.2.1)\n", "Requirement already satisfied: protobuf<7,>=3.20 in /opt/conda/lib/python3.12/site-packages (from streamlit) (5.29.3)\n", "Requirement already satisfied: pyarrow>=7.0 in /opt/conda/lib/python3.12/site-packages (from streamlit) (19.0.1)\n", "Requirement already satisfied: tenacity<10,>=8.1.0 in /opt/conda/lib/python3.12/site-packages (from streamlit) (9.1.2)\n", "Requirement already satisfied: toml<2,>=0.10.1 in /opt/conda/lib/python3.12/site-packages (from streamlit) (0.10.2)\n", "Requirement already satisfied: typing-extensions<5,>=4.4.0 in /opt/conda/lib/python3.12/site-packages (from streamlit) (4.13.2)\n", "Requirement already satisfied: watchdog<7,>=2.1.5 in /opt/conda/lib/python3.12/site-packages (from streamlit) (6.0.0)\n", "Requirement already satisfied: gitpython!=3.1.19,<4,>=3.0.7 in /opt/conda/lib/python3.12/site-packages (from streamlit) (3.1.44)\n", "Requirement already satisfied: pydeck<1,>=0.8.0b4 in /opt/conda/lib/python3.12/site-packages (from streamlit) (0.9.1)\n", "Requirement already satisfied: tornado<7,>=6.0.3 in /opt/conda/lib/python3.12/site-packages (from streamlit) (6.5)\n", "Requirement already satisfied: charset_normalizer<4,>=2 in /opt/conda/lib/python3.12/site-packages (from requests) (3.4.2)\n", "Requirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.12/site-packages (from requests) (3.10)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/conda/lib/python3.12/site-packages (from requests) (2.4.0)\n", "Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.12/site-packages (from requests) (2025.4.26)\n", "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.12/site-packages (from altair<6,>=4.0->streamlit) (3.1.6)\n", "Requirement already satisfied: jsonschema>=3.0 in /opt/conda/lib/python3.12/site-packages (from altair<6,>=4.0->streamlit) (4.23.0)\n", "Requirement already satisfied: narwhals>=1.14.2 in /opt/conda/lib/python3.12/site-packages (from altair<6,>=4.0->streamlit) (1.39.1)\n", "Requirement already satisfied: gitdb<5,>=4.0.1 in /opt/conda/lib/python3.12/site-packages (from gitpython!=3.1.19,<4,>=3.0.7->streamlit) (4.0.12)\n", "Requirement already satisfied: smmap<6,>=3.0.1 in /opt/conda/lib/python3.12/site-packages (from gitdb<5,>=4.0.1->gitpython!=3.1.19,<4,>=3.0.7->streamlit) (5.0.2)\n", "Requirement already satisfied: python-dateutil>=2.8.2 in /opt/conda/lib/python3.12/site-packages (from pandas<3,>=1.4.0->streamlit) (2.9.0.post0)\n", "Requirement already satisfied: pytz>=2020.1 in /opt/conda/lib/python3.12/site-packages (from pandas<3,>=1.4.0->streamlit) (2025.2)\n", "Requirement already satisfied: tzdata>=2022.7 in /opt/conda/lib/python3.12/site-packages (from pandas<3,>=1.4.0->streamlit) (2025.2)\n", "Requirement already satisfied: langchain-core<1.0.0,>=0.3.59 in /opt/conda/lib/python3.12/site-packages (from langchain-community) (0.3.61)\n", "Requirement already satisfied: langchain<1.0.0,>=0.3.25 in /opt/conda/lib/python3.12/site-packages (from langchain-community) (0.3.25)\n", "Requirement already satisfied: SQLAlchemy<3,>=1.4 in /opt/conda/lib/python3.12/site-packages (from langchain-community) (2.0.41)\n", "Requirement already satisfied: PyYAML>=5.3 in /opt/conda/lib/python3.12/site-packages (from langchain-community) (6.0.2)\n", "Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /opt/conda/lib/python3.12/site-packages (from langchain-community) (3.11.18)\n", "Requirement already satisfied: dataclasses-json<0.7,>=0.5.7 in /opt/conda/lib/python3.12/site-packages (from langchain-community) (0.6.7)\n", "Requirement already satisfied: pydantic-settings<3.0.0,>=2.4.0 in /opt/conda/lib/python3.12/site-packages (from langchain-community) (2.9.1)\n", "Requirement already satisfied: langsmith<0.4,>=0.1.125 in /opt/conda/lib/python3.12/site-packages (from langchain-community) (0.2.11)\n", "Requirement already satisfied: httpx-sse<1.0.0,>=0.4.0 in /opt/conda/lib/python3.12/site-packages (from langchain-community) (0.4.0)\n", "Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /opt/conda/lib/python3.12/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (2.6.1)\n", "Requirement already satisfied: aiosignal>=1.1.2 in /opt/conda/lib/python3.12/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (1.3.2)\n", "Requirement already satisfied: attrs>=17.3.0 in /opt/conda/lib/python3.12/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (25.3.0)\n", "Requirement already satisfied: frozenlist>=1.1.1 in /opt/conda/lib/python3.12/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (1.6.0)\n", "Requirement already satisfied: multidict<7.0,>=4.5 in /opt/conda/lib/python3.12/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (6.4.4)\n", "Requirement already satisfied: propcache>=0.2.0 in /opt/conda/lib/python3.12/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (0.3.1)\n", "Requirement already satisfied: yarl<2.0,>=1.17.0 in /opt/conda/lib/python3.12/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain-community) (1.20.0)\n", "Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /opt/conda/lib/python3.12/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain-community) (3.26.1)\n", "Requirement already satisfied: typing-inspect<1,>=0.4.0 in /opt/conda/lib/python3.12/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain-community) (0.9.0)\n", "Requirement already satisfied: pydantic<3.0.0,>=2.7.4 in /opt/conda/lib/python3.12/site-packages (from langchain<1.0.0,>=0.3.25->langchain-community) (2.11.4)\n", "Requirement already satisfied: jsonpatch<2.0,>=1.33 in /opt/conda/lib/python3.12/site-packages (from langchain-core<1.0.0,>=0.3.59->langchain-community) (1.33)\n", "Requirement already satisfied: jsonpointer>=1.9 in /opt/conda/lib/python3.12/site-packages (from jsonpatch<2.0,>=1.33->langchain-core<1.0.0,>=0.3.59->langchain-community) (3.0.0)\n", "Requirement already satisfied: httpx<1,>=0.23.0 in /opt/conda/lib/python3.12/site-packages (from langsmith<0.4,>=0.1.125->langchain-community) (0.28.1)\n", "Requirement already satisfied: orjson<4.0.0,>=3.9.14 in /opt/conda/lib/python3.12/site-packages (from langsmith<0.4,>=0.1.125->langchain-community) (3.10.18)\n", "Requirement already satisfied: requests-toolbelt<2.0.0,>=1.0.0 in /opt/conda/lib/python3.12/site-packages (from langsmith<0.4,>=0.1.125->langchain-community) (1.0.0)\n", "Requirement already satisfied: anyio in /opt/conda/lib/python3.12/site-packages (from httpx<1,>=0.23.0->langsmith<0.4,>=0.1.125->langchain-community) (4.9.0)\n", "Requirement already satisfied: httpcore==1.* in /opt/conda/lib/python3.12/site-packages (from httpx<1,>=0.23.0->langsmith<0.4,>=0.1.125->langchain-community) (1.0.9)\n", "Requirement already satisfied: h11>=0.16 in /opt/conda/lib/python3.12/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->langsmith<0.4,>=0.1.125->langchain-community) (0.16.0)\n", "Requirement already satisfied: annotated-types>=0.6.0 in /opt/conda/lib/python3.12/site-packages (from pydantic<3.0.0,>=2.7.4->langchain<1.0.0,>=0.3.25->langchain-community) (0.7.0)\n", "Requirement already satisfied: pydantic-core==2.33.2 in /opt/conda/lib/python3.12/site-packages (from pydantic<3.0.0,>=2.7.4->langchain<1.0.0,>=0.3.25->langchain-community) (2.33.2)\n", "Requirement already satisfied: typing-inspection>=0.4.0 in /opt/conda/lib/python3.12/site-packages (from pydantic<3.0.0,>=2.7.4->langchain<1.0.0,>=0.3.25->langchain-community) (0.4.0)\n", "Requirement already satisfied: python-dotenv>=0.21.0 in /opt/conda/lib/python3.12/site-packages (from pydantic-settings<3.0.0,>=2.4.0->langchain-community) (1.1.0)\n", "Requirement already satisfied: greenlet>=1 in /opt/conda/lib/python3.12/site-packages (from SQLAlchemy<3,>=1.4->langchain-community) (3.2.2)\n", "Requirement already satisfied: mypy_extensions>=0.3.0 in /opt/conda/lib/python3.12/site-packages (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7,>=0.5.7->langchain-community) (1.1.0)\n", "Requirement already satisfied: openai<2.0.0,>=1.68.2 in /opt/conda/lib/python3.12/site-packages (from langchain-openai) (1.82.0)\n", "Requirement already satisfied: tiktoken<1,>=0.7 in /opt/conda/lib/python3.12/site-packages (from langchain-openai) (0.9.0)\n", "Requirement already satisfied: distro<2,>=1.7.0 in /opt/conda/lib/python3.12/site-packages (from openai<2.0.0,>=1.68.2->langchain-openai) (1.9.0)\n", "Requirement already satisfied: jiter<1,>=0.4.0 in /opt/conda/lib/python3.12/site-packages (from openai<2.0.0,>=1.68.2->langchain-openai) (0.10.0)\n", "Requirement already satisfied: sniffio in /opt/conda/lib/python3.12/site-packages (from openai<2.0.0,>=1.68.2->langchain-openai) (1.3.1)\n", "Requirement already satisfied: tqdm>4 in /opt/conda/lib/python3.12/site-packages (from openai<2.0.0,>=1.68.2->langchain-openai) (4.67.1)\n", "Requirement already satisfied: regex>=2022.1.18 in /opt/conda/lib/python3.12/site-packages (from tiktoken<1,>=0.7->langchain-openai) (2024.11.6)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.12/site-packages (from jinja2->altair<6,>=4.0->streamlit) (3.0.2)\n", "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /opt/conda/lib/python3.12/site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit) (2025.4.1)\n", "Requirement already satisfied: referencing>=0.28.4 in /opt/conda/lib/python3.12/site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit) (0.36.2)\n", "Requirement already satisfied: rpds-py>=0.7.1 in /opt/conda/lib/python3.12/site-packages (from jsonschema>=3.0->altair<6,>=4.0->streamlit) (0.25.0)\n", "Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.12/site-packages (from python-dateutil>=2.8.2->pandas<3,>=1.4.0->streamlit) (1.17.0)\n" ] } ], "source": [ "!pip install streamlit langchain-community langchain-openai langchain-text-splitters requests pathlib pypdf" ] }, { "cell_type": "code", "execution_count": 2, "id": "d0bb4874-7f7b-40a9-88ea-922aaed0f3a3", "metadata": {}, "outputs": [], "source": [ "## Handle secrets either from env vars or streamlit manager\n", "import streamlit as st\n", "import os\n", "api_key = os.getenv(\"LITELLM_KEY\")\n", "if api_key is None:\n", " api_key = st.secrets[\"LITELLM_KEY\"]\n", "cirrus_key = os.getenv(\"CIRRUS_KEY\")\n", "if cirrus_key is None:\n", " cirrus_key = st.secrets[\"CIRRUS_KEY\"] \n" ] }, { "cell_type": "code", "execution_count": 3, "id": "95ed10f3-5339-40cd-bf16-b0854f8b4b91", "metadata": {}, "outputs": [], "source": [ "import os\n", "import requests\n", "import zipfile\n", "\n", "def download_and_unzip(url, output_dir):\n", " response = requests.get(url)\n", " zip_file_path = os.path.basename(url)\n", " with open(zip_file_path, 'wb') as f:\n", " f.write(response.content)\n", " with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:\n", " zip_ref.extractall(output_dir)\n", " os.remove(zip_file_path)\n", "\n", "download_and_unzip(\"https://minio.carlboettiger.info/public-data/hwc.zip\", \"hwc\")" ] }, { "cell_type": "code", "execution_count": 4, "id": "2fbca6dc-a90b-4dd4-8225-8baac5c6622d", "metadata": {}, "outputs": [], "source": [ "import pathlib\n", "from langchain_community.document_loaders import PyPDFLoader\n", "\n", "def pdf_loader(path):\n", " all_documents = []\n", " docs_dir = pathlib.Path(path)\n", " for file in docs_dir.iterdir():\n", " loader = PyPDFLoader(file)\n", " documents = loader.load()\n", " all_documents.extend(documents)\n", " return all_documents\n", "\n", "docs = pdf_loader('hwc/')\n" ] }, { "cell_type": "code", "execution_count": 5, "id": "60fe1968", "metadata": {}, "outputs": [], "source": [ "\n", "# NRP embedding model tends to throw errors\n", "# embedding = OpenAIEmbeddings(model = \"embed-mistral\", api_key = api_key, base_url = \"https://llm.nrp-nautilus.io\")\n", "\n" ] }, { "cell_type": "code", "execution_count": 6, "id": "0a8a004d-bb80-42bf-b7e6-15a54e2dd804", "metadata": {}, "outputs": [], "source": [ "## Use the model on Cirrus instead:\n", "from langchain_openai import OpenAIEmbeddings\n", "embedding = OpenAIEmbeddings(\n", " model = \"cirrus\",\n", " api_key = cirrus_key, \n", " base_url = \"https://llm.cirrus.carlboettiger.info/v1\",\n", ")" ] }, { "cell_type": "code", "execution_count": 7, "id": "fd8bcc13-d06d-43dd-9e06-4f29da803133", "metadata": {}, "outputs": [], "source": [ "# Build a retrival agent\n", "from langchain_text_splitters import RecursiveCharacterTextSplitter\n", "text_splitter = RecursiveCharacterTextSplitter(chunk_size=5000, chunk_overlap=500)\n", "splits = text_splitter.split_documents(docs)\n" ] }, { "cell_type": "code", "execution_count": 8, "id": "7f388394-5da2-4db8-8e48-e10436c8532d", "metadata": {}, "outputs": [], "source": [ "# slow part here, runs on remote GPU\n", "from langchain_core.vectorstores import InMemoryVectorStore\n", "vectorstore = InMemoryVectorStore.from_documents(documents = splits, embedding = embedding)\n", "retriever = vectorstore.as_retriever()" ] }, { "cell_type": "code", "execution_count": 9, "id": "2bf50abf-5ccd-4de5-9fc4-c9043a66a108", "metadata": {}, "outputs": [], "source": [ "\n", "\n", "# Choose any of the models listed by their short-name:\n", "# see `curl -H \"Authorization: Bearer $OPENAI_API_KEY\" https://llm.nrp-nautilus.io/v1/models`\n", "models = {\"llama3\": \"llama3-sdsc\", \n", " \"deepseek-small\": \"DeepSeek-R1-Distill-Qwen-32B\",\n", " \"deepseek\": \"deepseek-r1-qwen-qualcomm\",\n", " \"gemma3\": \"gemma3\",\n", " \"phi3\": \"phi3\",\n", " \"olmo\": \"olmo\"\n", " }\n", "\n", "from langchain_openai import ChatOpenAI\n", "llm = ChatOpenAI(model = models['gemma3'],\n", " api_key = api_key, \n", " base_url = \"https://llm.nrp-nautilus.io\", \n", " temperature=0)\n", "\n", "\n", "from langchain.chains import create_retrieval_chain\n", "from langchain.chains.combine_documents import create_stuff_documents_chain\n", "from langchain_core.prompts import ChatPromptTemplate\n", "system_prompt = (\n", " \"You are an assistant for question-answering tasks. \"\n", " \"Use the following scientific articles as the retrieved context to answer \"\n", " \"the question. Appropriately cite the articles from the context on which your answer is based using (Author, Year) format. \"\n", " \"Do not attempt to cite articles that are not in the context.\"\n", " \"If you don't know the answer, say that you don't know.\"\n", " \"Use up to five sentences maximum and keep the \"\n", " \"answer concise.\"\n", " \"\\n\\n\"\n", " \"{context}\"\n", ")\n", "prompt = ChatPromptTemplate.from_messages(\n", " [\n", " (\"system\", system_prompt),\n", " (\"human\", \"{input}\"),\n", " ]\n", ")\n", "question_answer_chain = create_stuff_documents_chain(llm, prompt)\n", "rag_chain = create_retrieval_chain(retriever, question_answer_chain)\n" ] }, { "cell_type": "code", "execution_count": 10, "id": "e15c64e7-0916-4042-8274-870e4fdb1af7", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'input': 'I live in Tanzania and am having issues with lions breaking into my boma and preying on cattle. What interventions might work best for me?',\n", " 'context': [Document(id='20f4ca4d-9fb3-42bd-b433-a4a0437bd86a', metadata={'producer': 'Acrobat Distiller 10.1.10 (Windows); modified using iText 4.2.0 by 1T3XT', 'creator': 'LaTeX with hyperref package', 'creationdate': '2020-01-16T12:33:42+05:30', 'keywords': '', 'moddate': '2025-05-27T12:12:25-07:00', 'subject': 'Conservation Biology 2020.34:232-243', 'wps-proclevel': '3', 'wps-journaldoi': '10.1111/(ISSN)1523-1739', 'author': '', 'title': 'Predicting intervention priorities for wildlife conflicts', 'wps-articledoi': '10.1111/cobi.13372', 'source': 'hwc/Baynham-Herd et al. 2019.pdf', 'total_pages': 12, 'page': 10, 'page_label': '242'}, page_content='242 Conflict Intervention Priorities\\nhelps foster more effective collaboration (Game et al.\\n2013; Lute et al. 2018). Third, both the survey results\\nand feedback were consistent with recent scholarship\\n(Redpath et al. 2017) that highlights participatory and\\nstakeholder-first conflict interventions as best practice\\nand advocates multipronged (Hazzah et al. 2014) and\\nadaptive management strategies (Bunnefeld et al. 2017).\\nEducation and awareness programs were often cited in\\nfeedback as being necessary additions to any interven-\\ntions. However, given the failures of many awareness-\\nbased conservation programs (Schultz 2011), a further\\nexploration into why and where conservation decision\\nmakers deem them most appropriate is important. Ap-\\nproaches that are specifically aimed at a particular au-\\ndience, such as social marketing (Salazar et al. 2018),\\nmay be more effective than simple information provision\\nor—often-problematic—enforcement (Duffy et al. 2019).\\nHowever, how different interventions compliment, or\\nnegate, each other is an area in need of greater explo-\\nration (van Eeden et al. 2018).\\nAcknowledgments\\nThis study was supported by a grant from the Natural\\nEnvironment Research Council (NERC) (grant number\\nNERC NE/L002558/1). We also thank the ECCB 2018\\ncommittee, University of Jyv¨askyl¨a, and all the respon-\\ndents for supporting us with this study.\\nSupporting Information\\nFurther information on the scenario presentation\\n(Appendix S1), sample (Appendix S2), additional results\\n(Appendix S3), and the full survey (Appendix S4) are\\navailable online. The authors are solely responsible for\\nthe content and functionality of these materials. Queries\\n(other than absence of the material) should be directed\\nto the corresponding author.\\nLiterature Cited\\nBargh JA. 2006. What have we been priming all these years? on\\nthe development, mechanisms, and ecology of nonconscious so-\\ncial behavior. European Journal of Social Psychology36:147–168.\\nhttps://doi.org/10.1002/ejsp.336.\\nBarua M, Bhagwat SA, Jadhav S. 2013. The hidden dimensions of human-\\nwildlife conflict: health impacts, opportunity and transaction costs.\\nBiological Conservation157:309–316.\\nBaynham-Herd Z, Redpath S, Bunnefeld N, Molony T, Keane A. 2018.\\nConservation conflicts: behavioural threats, frames, and interven-\\ntion recommendations. Biological Conservation222:180–188.\\nBennett NJ, et al. 2017. Mainstreaming the social sciences in conserva-\\ntion. Conservation Biology31:56–66.\\nBunnefeld N, Nicholson E, Milner-Gulland EJ, editors. 2017. Decision-\\nmaking in conservation and natural resource management: mod-\\nels for interdisciplinary approaches. Cambridge University Press,\\nUnited Kingdom.\\nCan ¨OE, D’Cruze N, Garshelis DL, Beecham J, Macdonald DW. 2014.\\nResolving human-bear conflict: A global survey of countries, experts,\\nand key factors. Conservation Letters7:501–513.\\nCarswell LP, Speckman SG, Gill VA. 2015. Shellfish fishery conflicts\\nand perceptions of sea otters in California and Alaska. Sea Otter\\nConservation 333–368.\\nCastelblanco-Mart´ınez DN, Nourisson C, Quintana-Rizzo E, Padilla-\\nSaldivar J, Schmitter-Soto JJ. 2012. Potential effects of human pres-\\nsure and habitat fragmentation on population viability of the an-\\ntillean manatee Trichechus manatusmanatus: a predictive model.\\nEndangered Species Research18:129–145.\\nDeMotts R, Hoon P. 2012. Whose elephants? Conserving, compen-\\nsating, and competing in northern Botswana. Society and Natural\\nResources 25:837–851.\\nDickman A, Johnson PJ, Van Kesteren F, MacDonald DW. 2015. The\\nmoral basis for conservation: How is it affected by culture? Frontiers\\nin Ecology and the Environment13:325–331.\\nDuffy R, et al. 2019. Why we must question the militarisation of con-\\nservation. Biological Conservation232:66–73.\\nEcheverri A, Chan KMA, Zhao J. 2017. How messaging shapes attitudes\\ntoward sea otters as a species at risk. Human Dimensions of Wildlife\\n22:142–156.\\nEklund A, L ´opez-Bao JV, Tourani M, Chapron G, Frank J. 2017.\\nLimited evidence on the effectiveness of interventions to re-\\nduce livestock predation by large carnivores. Scientific Reports7\\nhttps://doi.org/10.1038/s41598-017-02323-w.\\nEvans JSBT, Javier N, Andr´es O, Mario Q, Eloy R, Miguel D. 2008. Dual-\\nprocessing accounts of reasoning, judgment, and social cognition.\\nAnnual Review of Psychology59:255–278.\\nFern´andez-Gil A, et al. 2016. Conflict misleads large carnivore man-\\nagement and conservation: brown bears and wolves in Spain Mar-\\ngalida. PLOS ONE 11(e0151541) https://doi.org/10.1371/journal.\\npone.0151541.\\nFisher J. 2012. No pay, no care? A case study exploring motivations for\\nparticipation in payments for ecosystem services in Uganda. Oryx\\n46:45–54.\\nFukuda Y, Manolis C, Saalfeld K, Zuur A. 2015. Dead or alive?\\nFactors affecting the survival of victims during attacks by salt-\\nwater crocodiles (Crocodylus porosus) in Australia. PLOS ONE\\n10(e0126778) https://doi.org/10.1371/journal.pone.0126778.\\nGame ET, Kareiva P, Possingham HP. 2013. Six common mistakes in'),\n", " Document(id='e1b4ed29-237c-4cde-8ed7-cbf6ffed090d', metadata={'producer': 'Acrobat Distiller 8.1.0 (Windows)', 'creator': 'Elsevier', 'creationdate': '2016-09-26T20:02:29+05:30', 'crossmarkdomains[2]': 'elsevier.com', 'crossmarkmajorversiondate': '2010-04-23', 'subject': 'Animal Behaviour, 120 (2016) 245-254. doi:10.1016/j.anbehav.2016.07.013', 'author': 'Bradley F. Blackwell', 'elsevierwebpdfspecifications': '6.5', 'crossmarkdomainexclusive': 'true', 'robots': 'noindex', 'moddate': '2016-09-26T20:03:01+05:30', 'doi': '10.1016/j.anbehav.2016.07.013', 'crossmarkdomains[1]': 'sciencedirect.com', 'title': 'No single solution: application of behavioural principles in mitigating human-wildlife conflict', 'source': 'hwc/Blackwell et al. 2016.pdf', 'total_pages': 10, 'page': 0, 'page_label': '245'}, page_content='* Correspondence: B. F. Blackwell, U.S. Department of Agriculture, Animal and\\nPlant Health Inspection Service, Wildlife Services, National Wildlife Research\\nCenter, Ohio Field Station, Sandusky, OH, 44870, U.S.A.\\nE-mail address: bradley.f.blackwell@aphis.usda.gov (B. F. Blackwell).\\nContents lists available atScienceDirect\\nAnimal Behaviour\\njournal homepage: www.elsevier.com/locate/anbehav\\nhttp://dx.doi.org/10.1016/j.anbehav.2016.07.013\\n0003-3472/Published by Elsevier Ltd on behalf of The Association for the Study of Animal Behaviour.\\nAnimal Behaviour 120 (2016) 245e254\\nSPECIAL ISSUE: CONSERVATION BEHAVIOUR'),\n", " Document(id='7af07fdc-96ab-4b05-b8b4-d8193cc0a227', metadata={'producer': 'Adobe PDF Library 15.0; modified using iText® 5.3.5 ©2000-2012 1T3XT BVBA (SPRINGER SBM; licensed version)', 'creator': 'Springer', 'creationdate': '2020-09-14T15:09:33+05:30', 'crossmarkdomains[1]': 'springer.com', 'moddate': '2020-09-14T15:58:07+02:00', 'crossmarkmajorversiondate': '2010-04-23', 'subject': 'Scientific Reports, https://doi.org/10.1038/s41598-020-72343-6', 'author': 'Igor Khorozyan', 'title': 'Variation and conservation implications of the effectiveness of anti-bear interventions', 'crossmarkdomainexclusive': 'true', 'robots': 'noindex', 'doi': '10.1038/s41598-020-72343-6', 'crossmarkdomains[2]': 'springerlink.com', 'source': 'hwc/Khorozyan and Waltert 2020.pdf', 'total_pages': 9, 'page': 2, 'page_label': '3'}, page_content='3\\nVol.:(0123456789)Scientific RepoRtS | (2020) 10:15341 | https://doi.org/10.1038/s41598-020-72343-6\\nwww.nature.com/scientificreports/\\nnumbers increase and more bears need more food26,43,44. Hence, the effectiveness of anti-bear interventions can \\nbe lower than expected when hungry bears become persistent and more aggressive in damaging behaviour. As \\nhigh density may lead to more bears involved in conflicts, it also could increase the demand for bear removal45 \\nand affect the effectiveness of removal techniques such as translocation and lethal control.\\nIn this paper, we compiled a global database of intervention effectiveness against bears and studied how it \\nis related to bear species and densities, duration of intervention application, and intervention techniques. We \\nattempted to find and describe the most effective and the least effective interventions against bears. Further, we \\ntested several hypotheses: (1) lethal control and invasive management are less effective than non-invasive inter-\\nventions due to high mortality and replacement by new individuals which resume damaging human assets; (2) \\ninterventions vary in their effectiveness due to the time required for bears to become habituated to interventions \\nand make them ineffective; and (3) intervention effectiveness is reduced at low and high bear densities when \\nbears search for more food.\\nResults\\nWe produced a dataset containing 77 cases of intervention effectiveness from 48 source publications (Dataset S1). \\nTable\\xa02 shows the distribution of these cases across intervention categories, intervention types and bear species. \\nThe species were biased towards American black bear and brown bear (χ\\n2 = 42.737, df = 3, p < 0.001; Table\\xa02) and \\nintervention categories were dominated by aversion and husbandry (χ2 = 16.442, df = 4, p = 0.002), but there was \\nno difference between intervention types (χ2 = 12.922, df = 11, p = 0.298). Interventions were applied to protect \\nneighbourhood safety (n = 37), small stock (n = 12), beehives (n = 10), mixed assets (n = 7), cattle (n = 5) and \\ntree plantations (n = 5) (χ2 = 59.158, df = 5, p < 0.001), and crops (n = 1) which was excluded. An overwhelming \\nmajority of cases originated from the USA (n = 49) followed by Canada (n = 11), Norway (n = 5), Japan (n = 4) \\nand other countries pooled (n = 1 from each of Austria, China, Indonesia, Italy, Slovakia, Slovenia, Spain and \\nSweden) (χ2 = 93.584, df = 4, p < 0.001).\\nWe obtained data for all 77 cases, except for bear density (n = 76, missing datum for a sun bear case12) and \\nduration of intervention (n = 75, two missing data for American black bear and polar bear46).\\nIn our study, the percentage of damage reduction (DR) differed between intervention categories (Kruskal–Wal-\\nlis KW χ2 = 10.118, df = 4, p = 0.038), but not between intervention types (χ2 = 14.954, df = 11, p = 0.185), bear spe-\\ncies (χ2 = 0.887, df = 3, p = 0.829), countries (χ2 = 4.850, df = 4, p = 0.303) and protected assets (χ2 = 7.083, df = 5, \\np = 0.215) (Fig.\\xa01). The effectiveness of husbandry (median DR = 94.2%, 95% CI = 66.7–100%) was significantly \\nhigher than that of aversion (45.7%, 13.7–79.5%; Mann–Whitney U = 146.0, p = 0.019), invasive management \\n(55.8%, 30.0–78.8%; U = 49.5, p = 0.017) and non-invasive management (17.3%, 0.3–70.5%; U = 70.0, p = 0.006). \\nThe difference between the effectiveness of lethal control (26.1%, −\\xa034.2 to 100%) and other interventions was \\ninsignificant (U varied from 20.0 to 56.5, p from 0.161 to 0.836) (Fig.\\xa0 1). Out of the husbandry interventions, \\nthe best were electric fences (97.1%, 79.2–100%) which were significantly more effective than acoustic deterrents \\n(48.4%, 22.7–83.3%; U = 14.5, p = 0.007), mixed deterrents (14.3%, 0.0–20.0%; U = 0.00, p = 0.002), translocation \\n(55.8%, 30.0–78.8%; U = 14.0, p = 0.004), food/garbage isolation (54.1%, 3.8–86.0%; U = 3.0, p = 0.014), sup-\\nplemental feeding (42.2%, −\\xa0171.9 to 73.3%; U = 4.0, p = 0.021) and pooled mixed deterrents (14.3%, 0–20.0%), \\nchange of habits (−\\xa03.4%, −\\xa011.1 to 0%), vegetation care (0.3%, 0.3–20.8%), calving control (100%), mixed tech-\\nniques (97.8%) and livestock replacement (99.8%) (U = 17.5, p = 0.023). Electric fences were marginally more \\neffective than shooting (26.1%, −\\xa034.2 to 100%; U = 9.5, p = 0.050) (Fig.\\xa01). Wherever sample size allowed, these \\nTable 2. The distribution of 77 cases used in this study to assess the effectiveness of interventions against \\nbears.\\nCategories of interventions Types of interventions\\nAmerican black bear \\n(n = 40) Asiatic black bear (n = 4) Brown bear (n = 24) Polar bear (n = 8) Sun bear (n = 1)\\nAversion (n = 26)\\nAcoustic deterrents 2 3 5\\nChemical deterrents 2 1 2\\nMixed deterrents 4 1\\nPhysical deterrents 4 1 1\\nHusbandry (n = 19)\\nElectric fences 5 1 3 1\\nEnclosures 1 3\\nGuarding animals 3 1\\nMixed techniques 1\\nInvasive management (n = 11) Translocation 6 5\\nLethal control (n = 5) Shooting 3 2\\nNon-invasive management \\n(n = 16)\\nCalving control 1'),\n", " Document(id='29d13a05-fdd6-4f8c-b794-cf0e1fc6fdaa', metadata={'producer': 'Canon iR C5800', 'creator': 'Canon iR C5800', 'creationdate': '2009-03-09T08:39:40-05:00', 'subject': 'Image', 'source': 'hwc/Dolbeer et al. 1994.pdf', 'total_pages': 34, 'page': 27, 'page_label': '28'}, page_content='L~J;~...\\'\\n¿- ~1i\\n~ø~~/\\n,\\'~ \\'~J-\\'::~;\"~\\' ~-~\\n\\'-\\na\\nc\\nb\\n..--~\\n1-\\n~~-\\n, :~\\';~\\'?\\'\".\\n-1~~~~f~\\':\".o.,\".~.~) ~\\nç J)\\';i-ir,i.();::u-::::;v\\'\\n~d/idlj¡ti# - \"\"... .. . \\'. ý.o:.. .1l)\"\\',y\\'A \\'jt:)\\n.: .\\' ~:-~J.~,,:::;:,\\'.\"\\'h _ .. \" i.-/ J. l1?~\"P~.o~\\'::~ ....( I:? ~\\'J.J.I\\n\\'-~:~.éiiA~~t~\\'?:,)J -~\\ne\\n¡=j\\'~0\\'Ó .~\\n! r- ..\\'7~l)S,\\n. \\'~RfÖ\\'~~j£\\'\"J;\\').,;.... i\\n/!Æ,?-:\\'\\'~, j\\nq~ f\\\\ .;- .J\\')~~:\\' -\\' i\\n(1\"\\nFig. /8. a. A leg-hold trap is first laid on the ground to detemiine best location of hole. b. The hole should be about II cm deep and shape to\\naccommodate the trap. c. If a stake is used. it is driven into the boHom of the hole. If a drag is used, it is placed in the hole. The chain is then put\\ninto the hole and covered with soil unlIlthe hole is about 3 cm deep and packed to provide a firm foundation. d. TIie front jaw is raised and the pan\\ncover is placed over the pan so soil cannot get under the pan. e. The trap is covered with finely sifted soil to a depth of 0.6-1.2 cm. A siick or whisk\\nbroom is used to touch up and make set appear as natural as possible (from DorscH 1987).\\nThe location of a trap set influences its selectivity.\\nWhen placed beside a carcass, a trap can catch non-\\ntarget animals such as vultures, eagles, badgers, and\\nother carrion-feeders. Nine meters away from the car-\\ncass normally is a safe distance to set traps to avoid\\nnontarget animals. Weather also can affect the opera-\\ntion of traps. Frozen or wet ground can prevent a trap\\nfrom springing.\\nLeg-hold traps must be checked often to prevent the\\nlengthy restraint of captured animals. Most states have\\nlaws on the types of traps, baits and sets, and trap visi-\\ntation schedule,')],\n", " 'answer': \"Based on the provided articles, several interventions could help protect your cattle from lions in Tanzania. The most effective approach appears to be **husbandry techniques**, specifically **electric fences** (Can ÖE et al. 2014). The data shows electric fences have a very high damage reduction rate (97.1%) compared to other methods. \\n\\nOther potentially useful interventions, though less effective than electric fencing, include **guarding animals** and **enclosures** (Can ÖE et al. 2014). \\n\\nIt's important to note that **lethal control (shooting)** showed low effectiveness in the reviewed studies (Can ÖE et al. 2014). While it might seem like a direct solution, it doesn't appear to provide long-term protection and may not be significantly better than other methods.\\n\\n\\n\\n\"}" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "prompt = \"I live in Tanzania and am having issues with lions breaking into my boma and preying on cattle. What interventions might work best for me?\"\n", "results = rag_chain.invoke({\"input\": prompt})\n", "results" ] }, { "cell_type": "code", "execution_count": 11, "id": "35613607-2c36-4761-a8ea-8c0889530f34", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'input': 'What are the most cost-effective prevention methods for elephants raiding my crops?',\n", " 'context': [Document(id='20f4ca4d-9fb3-42bd-b433-a4a0437bd86a', metadata={'producer': 'Acrobat Distiller 10.1.10 (Windows); modified using iText 4.2.0 by 1T3XT', 'creator': 'LaTeX with hyperref package', 'creationdate': '2020-01-16T12:33:42+05:30', 'keywords': '', 'moddate': '2025-05-27T12:12:25-07:00', 'subject': 'Conservation Biology 2020.34:232-243', 'wps-proclevel': '3', 'wps-journaldoi': '10.1111/(ISSN)1523-1739', 'author': '', 'title': 'Predicting intervention priorities for wildlife conflicts', 'wps-articledoi': '10.1111/cobi.13372', 'source': 'hwc/Baynham-Herd et al. 2019.pdf', 'total_pages': 12, 'page': 10, 'page_label': '242'}, page_content='242 Conflict Intervention Priorities\\nhelps foster more effective collaboration (Game et al.\\n2013; Lute et al. 2018). Third, both the survey results\\nand feedback were consistent with recent scholarship\\n(Redpath et al. 2017) that highlights participatory and\\nstakeholder-first conflict interventions as best practice\\nand advocates multipronged (Hazzah et al. 2014) and\\nadaptive management strategies (Bunnefeld et al. 2017).\\nEducation and awareness programs were often cited in\\nfeedback as being necessary additions to any interven-\\ntions. However, given the failures of many awareness-\\nbased conservation programs (Schultz 2011), a further\\nexploration into why and where conservation decision\\nmakers deem them most appropriate is important. Ap-\\nproaches that are specifically aimed at a particular au-\\ndience, such as social marketing (Salazar et al. 2018),\\nmay be more effective than simple information provision\\nor—often-problematic—enforcement (Duffy et al. 2019).\\nHowever, how different interventions compliment, or\\nnegate, each other is an area in need of greater explo-\\nration (van Eeden et al. 2018).\\nAcknowledgments\\nThis study was supported by a grant from the Natural\\nEnvironment Research Council (NERC) (grant number\\nNERC NE/L002558/1). We also thank the ECCB 2018\\ncommittee, University of Jyv¨askyl¨a, and all the respon-\\ndents for supporting us with this study.\\nSupporting Information\\nFurther information on the scenario presentation\\n(Appendix S1), sample (Appendix S2), additional results\\n(Appendix S3), and the full survey (Appendix S4) are\\navailable online. The authors are solely responsible for\\nthe content and functionality of these materials. Queries\\n(other than absence of the material) should be directed\\nto the corresponding author.\\nLiterature Cited\\nBargh JA. 2006. What have we been priming all these years? on\\nthe development, mechanisms, and ecology of nonconscious so-\\ncial behavior. European Journal of Social Psychology36:147–168.\\nhttps://doi.org/10.1002/ejsp.336.\\nBarua M, Bhagwat SA, Jadhav S. 2013. The hidden dimensions of human-\\nwildlife conflict: health impacts, opportunity and transaction costs.\\nBiological Conservation157:309–316.\\nBaynham-Herd Z, Redpath S, Bunnefeld N, Molony T, Keane A. 2018.\\nConservation conflicts: behavioural threats, frames, and interven-\\ntion recommendations. Biological Conservation222:180–188.\\nBennett NJ, et al. 2017. Mainstreaming the social sciences in conserva-\\ntion. Conservation Biology31:56–66.\\nBunnefeld N, Nicholson E, Milner-Gulland EJ, editors. 2017. Decision-\\nmaking in conservation and natural resource management: mod-\\nels for interdisciplinary approaches. Cambridge University Press,\\nUnited Kingdom.\\nCan ¨OE, D’Cruze N, Garshelis DL, Beecham J, Macdonald DW. 2014.\\nResolving human-bear conflict: A global survey of countries, experts,\\nand key factors. Conservation Letters7:501–513.\\nCarswell LP, Speckman SG, Gill VA. 2015. Shellfish fishery conflicts\\nand perceptions of sea otters in California and Alaska. Sea Otter\\nConservation 333–368.\\nCastelblanco-Mart´ınez DN, Nourisson C, Quintana-Rizzo E, Padilla-\\nSaldivar J, Schmitter-Soto JJ. 2012. Potential effects of human pres-\\nsure and habitat fragmentation on population viability of the an-\\ntillean manatee Trichechus manatusmanatus: a predictive model.\\nEndangered Species Research18:129–145.\\nDeMotts R, Hoon P. 2012. Whose elephants? Conserving, compen-\\nsating, and competing in northern Botswana. Society and Natural\\nResources 25:837–851.\\nDickman A, Johnson PJ, Van Kesteren F, MacDonald DW. 2015. The\\nmoral basis for conservation: How is it affected by culture? Frontiers\\nin Ecology and the Environment13:325–331.\\nDuffy R, et al. 2019. Why we must question the militarisation of con-\\nservation. Biological Conservation232:66–73.\\nEcheverri A, Chan KMA, Zhao J. 2017. How messaging shapes attitudes\\ntoward sea otters as a species at risk. Human Dimensions of Wildlife\\n22:142–156.\\nEklund A, L ´opez-Bao JV, Tourani M, Chapron G, Frank J. 2017.\\nLimited evidence on the effectiveness of interventions to re-\\nduce livestock predation by large carnivores. Scientific Reports7\\nhttps://doi.org/10.1038/s41598-017-02323-w.\\nEvans JSBT, Javier N, Andr´es O, Mario Q, Eloy R, Miguel D. 2008. Dual-\\nprocessing accounts of reasoning, judgment, and social cognition.\\nAnnual Review of Psychology59:255–278.\\nFern´andez-Gil A, et al. 2016. Conflict misleads large carnivore man-\\nagement and conservation: brown bears and wolves in Spain Mar-\\ngalida. PLOS ONE 11(e0151541) https://doi.org/10.1371/journal.\\npone.0151541.\\nFisher J. 2012. No pay, no care? A case study exploring motivations for\\nparticipation in payments for ecosystem services in Uganda. Oryx\\n46:45–54.\\nFukuda Y, Manolis C, Saalfeld K, Zuur A. 2015. Dead or alive?\\nFactors affecting the survival of victims during attacks by salt-\\nwater crocodiles (Crocodylus porosus) in Australia. PLOS ONE\\n10(e0126778) https://doi.org/10.1371/journal.pone.0126778.\\nGame ET, Kareiva P, Possingham HP. 2013. Six common mistakes in'),\n", " Document(id='29d13a05-fdd6-4f8c-b794-cf0e1fc6fdaa', metadata={'producer': 'Canon iR C5800', 'creator': 'Canon iR C5800', 'creationdate': '2009-03-09T08:39:40-05:00', 'subject': 'Image', 'source': 'hwc/Dolbeer et al. 1994.pdf', 'total_pages': 34, 'page': 27, 'page_label': '28'}, page_content='L~J;~...\\'\\n¿- ~1i\\n~ø~~/\\n,\\'~ \\'~J-\\'::~;\"~\\' ~-~\\n\\'-\\na\\nc\\nb\\n..--~\\n1-\\n~~-\\n, :~\\';~\\'?\\'\".\\n-1~~~~f~\\':\".o.,\".~.~) ~\\nç J)\\';i-ir,i.();::u-::::;v\\'\\n~d/idlj¡ti# - \"\"... .. . \\'. ý.o:.. .1l)\"\\',y\\'A \\'jt:)\\n.: .\\' ~:-~J.~,,:::;:,\\'.\"\\'h _ .. \" i.-/ J. l1?~\"P~.o~\\'::~ ....( I:? ~\\'J.J.I\\n\\'-~:~.éiiA~~t~\\'?:,)J -~\\ne\\n¡=j\\'~0\\'Ó .~\\n! r- ..\\'7~l)S,\\n. \\'~RfÖ\\'~~j£\\'\"J;\\').,;.... i\\n/!Æ,?-:\\'\\'~, j\\nq~ f\\\\ .;- .J\\')~~:\\' -\\' i\\n(1\"\\nFig. /8. a. A leg-hold trap is first laid on the ground to detemiine best location of hole. b. The hole should be about II cm deep and shape to\\naccommodate the trap. c. If a stake is used. it is driven into the boHom of the hole. If a drag is used, it is placed in the hole. The chain is then put\\ninto the hole and covered with soil unlIlthe hole is about 3 cm deep and packed to provide a firm foundation. d. TIie front jaw is raised and the pan\\ncover is placed over the pan so soil cannot get under the pan. e. The trap is covered with finely sifted soil to a depth of 0.6-1.2 cm. A siick or whisk\\nbroom is used to touch up and make set appear as natural as possible (from DorscH 1987).\\nThe location of a trap set influences its selectivity.\\nWhen placed beside a carcass, a trap can catch non-\\ntarget animals such as vultures, eagles, badgers, and\\nother carrion-feeders. Nine meters away from the car-\\ncass normally is a safe distance to set traps to avoid\\nnontarget animals. Weather also can affect the opera-\\ntion of traps. Frozen or wet ground can prevent a trap\\nfrom springing.\\nLeg-hold traps must be checked often to prevent the\\nlengthy restraint of captured animals. Most states have\\nlaws on the types of traps, baits and sets, and trap visi-\\ntation schedule,'),\n", " Document(id='2da6f679-fc6d-4c12-8125-0fa9ec386673', metadata={'producer': 'Canon iR C5800', 'creator': 'Canon iR C5800', 'creationdate': '2009-03-09T08:39:40-05:00', 'subject': 'Image', 'source': 'hwc/Dolbeer et al. 1994.pdf', 'total_pages': 34, 'page': 14, 'page_label': '15'}, page_content='with their tracks, trails, and droppings.\\nControl Tecfiniques.-Habitat modification, fencing\\nand proofing, repellents, live traps, boy snares, shooting,\\ntoxic baits for jack rabbits in some localities.\\nTREE SQUIRRELS\\nTree squirrels can be categonzed into three groups:\\nlarge trce squirrels (gray, fox, and tassel-eared), pine\\nsquirrels (red and Douglas\\'), and flying squirrels (northern\\nand southern) (Jackson 1993). Squirrels eat plants and\\nfruits, dig up newly planted bulbs and seeds, strip bark\\nand leaves from trces and shrubs, invade homes, and con-\\nsume bird eggs (Hadidian et aI. 1987, Jackson 1993).\\nThey cause problems by shorting out transfonners and\\ngnawing on power and telephone lines (Marsh and How-\\nard 1982, Hamilton et aI. 1987)_\\nSquirrels often can be observcd at the damage site.\\nDamage to conifer seeds is indicated by green, unopened\\ncones scaltered on the ground under mature trees and by\\nthe accumulated cone scales and \"cores\" at feeding sta-\\ntions. Bark stripping can be obscrvcd in trees, and bark\\nfragments often are found on the ground, as are the tips\\nof twigs and small branchcs.\\nCoiitrol T(\\'cfiníques.-Fencing and proofing, repellents,\\nlive traps, shooting, conibear traps, leg-hold traps (#0-1),\\ntoxicants.\\nWOOORA TS\\nWood rats, also called pack rats, brush rats, or trade rats,\\nare attracted to food supplies left in buildings and will\\nremove small objects such as spoons, forks, knives, and\\nother items, sometimes leaving sticks or other objects \"in\\ntrade.\" They often construct conspicuous stick houses in'),\n", " Document(id='ce69d1d7-dcde-4f5d-91fc-f4b8b52652c9', metadata={'producer': 'GPL Ghostscript 9.26', 'creator': '', 'creationdate': '2022-06-06T23:09:49-07:00', 'moddate': '2022-06-06T23:09:49-07:00', 'title': '', 'author': '', 'subject': '', 'keywords': '', 'source': 'hwc/Kavcic et al. 2013.pdf', 'total_pages': 9, 'page': 2, 'page_label': '3'}, page_content='hypothesis was that index of pre- and post-ban use\\nwas the same for both types of feeding sites.\\nWe calculated the average annual number of\\nobserved bears during pre- and post-ban periods\\nfor each feeding site. We then used these averages\\ninstead of raw data from individual counts. We\\ncalculated an annual index of feeding site use by\\npooling data from all feeding sites (average number\\nof bears counted at feeding sites in post-ban period\\ndivided by average number of bears counted in pre-\\nban period). Subsequently, we used bootstrapping\\nwith 1,000 simulations to test for differences between\\nSUPPLEMENTAL FEEDING AND BEAR DEPREDATIONS N Kavcˇicˇ et al. 113\\nUrsus 24(2):111–119 (2013)')],\n", " 'answer': 'I am sorry, but the provided text does not contain information about preventing elephants from raiding crops. Therefore, I cannot answer your question.'}" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "prompt = \"What are the most cost-effective prevention methods for elephants raiding my crops?\"\n", "\n", "results = rag_chain.invoke({\"input\": prompt})\n", "results" ] }, { "cell_type": "code", "execution_count": 12, "id": "3dfc39f6-86e9-47c3-ab67-08f90ebbb823", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'input': 'I have a small herd of goats and cattle and I am worried about jaguars preying on them. What preventative measures can I take?',\n", " 'context': [Document(id='9e597163-975a-4020-a2d3-848859b86bce', metadata={'producer': 'pdfTeX-1.40.21', 'creator': 'LaTeX with hyperref', 'creationdate': '2022-06-23T12:24:35+08:00', 'author': 'Lydia N. Tiller, Ernest Oniba, Godfrey Opira, Ewan J. Brennan, Lucy E. King, Victor Ndombi, Derick Wanjala and Marion R. Robertson', 'keywords': 'African elephants; human-elephant conflict; crop raiding; olfactory mitigation;elephant repellent', 'moddate': '2022-06-23T06:36:53+02:00', 'subject': 'Human–elephant conflict is increasing across many parts of Asia and Africa. Mitigating elephant crop raiding has become a major focus of conservation intervention, however, many existing methods for tackling this problem are expensive and difficult to execute. Thus, there is a need for more affordable, farm-based methods. Testing these methods is key to ensuring their effectiveness and feasibility. In this study, we tested a novel olfactory deterrent, the “smelly elephant repellent”, a foul-smelling organic liquid, on 40 farms in Uganda and Kenya. Our results show that the repellent was effective at deterring elephants from crop raiding. Over the study period, 82% of 309 elephant crop raids were deterred in Uganda. In Kenya, the repellent deterred 63% of 24 crop raiding incidents, and there was a significant effect of the repellent on test sites compared with control sites. The smelly repellent could be a helpful crop raiding mitigation tool for farmers, as this study showed it to be effective, relatively cheap, quick to produce from locally available ingredients, and communities have a positive attitude towards using it. Ongoing work is exploring the potential for a market-based approach to take this to scale in a financially sustainable way.', 'title': '“Smelly” Elephant Repellent: Assessing the Efficacy of a Novel Olfactory Approach to Mitigating Elephant Crop Raiding in Uganda and Kenya', 'source': 'hwc/Tiller et al. 2022.pdf', 'total_pages': 15, 'page': 7, 'page_label': '8'}, page_content='Diversity 2022, 14, 509 8 of 15\\nTable 1. Descriptive statistics from the total number of crop-raid events testing the smelly elephant\\nrepellent trials in Kenya (n = 24) and Uganda (n = 309).\\nStudy Site\\nKenya Uganda\\nNumber of farmers 10 30\\nTrial seasons Nov. 2019–Jan. 2020\\nDec. 2020–Jan. 2021\\nOct.–Dec. 2018\\nMay–Jul. 2019\\nOct.–Dec. 2019\\nMay–Jul. 2020\\nCrops grown Cowpeas, green grams, maize, pigeon peas Cassava, ground nuts, maize, millet, rice,\\nsorghum, soya beans, sweet potatoes\\nAverage number of elephants 2 ( ±0.43) 6 ( ±0.38)\\nPercentage of incidents where crops\\nwere eaten (%) 37 (n = 9) 18 (n = 55)\\nPercentage of incidents where crops\\nwere not eaten (%) 63 (n = 15) 82 (n = 254)\\nDiversity\\xa02022,\\xa014,\\xa0x\\xa0FOR\\xa0PEER\\xa0REVIEW\\xa0 9\\xa0of\\xa016\\xa0\\n\\xa0\\n\\xa0\\n\\xa0\\n\\xa0\\nFigure\\xa04.\\xa0Camera\\xa0trap\\xa0images\\xa0taken\\xa0in\\xa0December\\xa02020\\xa0of\\xa0a\\xa0bull\\xa0elephant\\xa0approaching\\xa0the\\xa0smelly\\xa0\\nrepellent\\xa0fence\\xa0at\\xa0a\\xa0farm\\xa0in\\xa0Kenya.\\xa0\\nFigure 4. Camera trap images taken in December 2020 of a bull elephant approaching the smelly\\nrepellent fence at a farm in Kenya.'),\n", " Document(id='ce69d1d7-dcde-4f5d-91fc-f4b8b52652c9', metadata={'producer': 'GPL Ghostscript 9.26', 'creator': '', 'creationdate': '2022-06-06T23:09:49-07:00', 'moddate': '2022-06-06T23:09:49-07:00', 'title': '', 'author': '', 'subject': '', 'keywords': '', 'source': 'hwc/Kavcic et al. 2013.pdf', 'total_pages': 9, 'page': 2, 'page_label': '3'}, page_content='hypothesis was that index of pre- and post-ban use\\nwas the same for both types of feeding sites.\\nWe calculated the average annual number of\\nobserved bears during pre- and post-ban periods\\nfor each feeding site. We then used these averages\\ninstead of raw data from individual counts. We\\ncalculated an annual index of feeding site use by\\npooling data from all feeding sites (average number\\nof bears counted at feeding sites in post-ban period\\ndivided by average number of bears counted in pre-\\nban period). Subsequently, we used bootstrapping\\nwith 1,000 simulations to test for differences between\\nSUPPLEMENTAL FEEDING AND BEAR DEPREDATIONS N Kavcˇicˇ et al. 113\\nUrsus 24(2):111–119 (2013)'),\n", " Document(id='dca4b538-8519-4855-b4da-4a37bdc166f2', metadata={'producer': 'Acrobat Distiller 4.05 for Macintosh; modified using iText 4.2.0 by 1T3XT', 'creator': 'Textures¨: PSPrinter 8.3.1', 'creationdate': 'D:20031120165048', 'moddate': '2025-05-27T11:42:09-07:00', 'subject': 'Conservation Biology 2003.17:1531-1537', 'author': 'BNMAC10', 'title': 'Nonlethal Techniques for Managing Predation: Primary and Secondary Repellents', 'source': 'hwc/Shivik et al. 2003.pdf', 'total_pages': 7, 'page': 2, 'page_label': '3'}, page_content='Shivik et al. Nonlethal Predator Control 1533\\nintrusion by wild wolves with flagging hung on fence\\nlines (Musiani et al. 2003 [this issue]).\\nFlashing highway lights and sirens have been used as\\ndisruptive stimuli to deter wolves on farms in Minnesota\\n(Fritts 1982; Fritts et al. 1992), although the degree of ef-\\nfectiveness is unknown. Other researchers reported that\\nelectronic guards (a siren and strobe device that activates\\nrandomly at night) are effective for preventing predation\\nby coyotes (Linhart et al. 1984). Little other research has\\nbeen conducted to test the effect of frightening devices\\non reducing livestock depredations by wolves (Smith\\net al. 2000), probably because investigations usually con-\\ncluded that light and sound stimuli are limited in useful-\\nness because of habituation (Bombford & O ’Brien 1990;\\nKoehler et al. 1990). Primary repellents are limited in their\\neffectiveness because of habituation, and unless disrup-\\ntive stimuli are sufficiently noxious to prevent an animal\\nfrom continuing a behavior, the continued use of the dis-\\nruptive stimuli will result in an extinction of the neopho-\\nbic effect. The effectiveness of disruptive stimuli can be\\nprolonged by randomizing stimuli and location and by\\nusing behavior-contingent technologies that selectively\\nactivate dependent upon behavior of the predator being\\nrepelled (Shivik & Martin 2001).\\nOne disruptive stimulus approach to livestock protec-\\ntion resulted in the development of an animal-activated\\ndisruptive stimulus device for wolves (more commonly\\nreferred to as a radio activated guard [RAG], Shivik & Mar-\\ntin 2001). The current version of the RAG system is com-\\nmercially available as the Model 9000 Frightening Device\\n(Avian Systems Louisville, Kentucky) and is designed to\\nkeep radiocollared predators out of small (<16 ha) areas,\\nsuch as those containing infant livestock. Activation of\\nthe device triggers a strobe light and loud sound effects.\\nTo reduce the ability of animals to habituate to the device,\\nthere are 30 different recorded sounds. The devices are\\ncurrently being employed in Idaho, with indications of\\nsubstantial, but not unlimited effectiveness (Breck et al.\\n2002).\\nSecondary Repellents\\nWhereas primary repellents rely on novelty and are ren-\\ndered ineffective due to animal learning, secondary repel-\\nlents rely on animal learning to become effective. That\\nis, secondary repellents are linked to a behavior and re-\\nsult in aversive conditioning after a link is established\\nbetween a behavior and a negative outcome. Aversive\\nstimuli cause discomfort, pain, or an otherwise negative\\nexperience and are paired with specific behaviors to re-\\nduce the occurrence of these behaviors (Shivik & Mar-\\ntin 2001). Aversive stimuli are often difficult to apply in\\nmanagement situations, usually because controlling the\\nspecificity of aversion to an area or prey item can be dif-\\nficult (e.g., a bear that receives a negative stimulus from\\na rubber bullet will not necessarily form an aversion to\\nthe area where it was shot, but will often learn to avoid\\nthe person who shot it instead). However, because fields\\nof theory and evolution are based on aversive condition-\\ning in natural conditions (e.g., aposomatic indicators),\\nit is safe to assume these concepts can be employed in\\nsuch a way that they are useful for protecting a resource\\nof immediate human concern. For example, Gustavson\\net al. (1974) suggest that aversive conditioning, through\\nthe mechanism of conditioned taste aversion, may be an\\neffective management tool, although conditioned taste\\naversion is more useful for reducing consumptive behav-\\niors of particular foods rather than for limiting killing be-\\nhavior by predators (Conover & Kessler 1994). Similarly,\\nthe concept and theory of using electric shock as aversive\\nstimuli to alter domestic animal and wildlife behavior has\\nbeen intensively studied (Krane & Wagner 1975; Linhart\\net al. 1976; Quigley et al. 1990; Tiedeman et al. 1997).\\nAndelt et al. (1999) recently demonstrated the effective-\\nness of domestic-dog training collars for conditioning coy-\\notes, and Shivik et al. (2002) expanded this concept, ap-\\nplying it to wild wolves.\\nMethods\\nCase Study 1: Primary Repellents in Wolf Territories\\nin Wisconsin (U.S.A.)\\nAttack and kill behaviors are separate and distinct\\nfrom consumption behaviors for predation management\\n(Klunder & O ’Boyle 1979; Sterner 1995). However, be-\\ncause experimental evaluations of depredation control\\ntechnologies are difficult to implement in actual manage-\\nment situations, we tested two repellents for their efficacy\\nin reducing consumption only. We tested the effective-\\nness of two disruptive stimulus approaches (fladry and\\na behavior-contingent light and sound device) and used\\ndeer carcasses as an attractive resource placed in wolf\\nterritories in northwest Wisconsin.\\nSix wolf packs (Bird Sanctuary, Casey Creek, Chain\\nLake, Crotte Creek, Shoberg, and Tranus Lake) were iden-'),\n", " Document(id='04a476ea-20e7-4e27-aef1-b8391546cdab', metadata={'producer': 'pdfTeX-1.40.21', 'creator': 'LaTeX with hyperref', 'creationdate': '2022-06-23T12:24:35+08:00', 'author': 'Lydia N. Tiller, Ernest Oniba, Godfrey Opira, Ewan J. Brennan, Lucy E. King, Victor Ndombi, Derick Wanjala and Marion R. Robertson', 'keywords': 'African elephants; human-elephant conflict; crop raiding; olfactory mitigation;elephant repellent', 'moddate': '2022-06-23T06:36:53+02:00', 'subject': 'Human–elephant conflict is increasing across many parts of Asia and Africa. Mitigating elephant crop raiding has become a major focus of conservation intervention, however, many existing methods for tackling this problem are expensive and difficult to execute. Thus, there is a need for more affordable, farm-based methods. Testing these methods is key to ensuring their effectiveness and feasibility. In this study, we tested a novel olfactory deterrent, the “smelly elephant repellent”, a foul-smelling organic liquid, on 40 farms in Uganda and Kenya. Our results show that the repellent was effective at deterring elephants from crop raiding. Over the study period, 82% of 309 elephant crop raids were deterred in Uganda. In Kenya, the repellent deterred 63% of 24 crop raiding incidents, and there was a significant effect of the repellent on test sites compared with control sites. The smelly repellent could be a helpful crop raiding mitigation tool for farmers, as this study showed it to be effective, relatively cheap, quick to produce from locally available ingredients, and communities have a positive attitude towards using it. Ongoing work is exploring the potential for a market-based approach to take this to scale in a financially sustainable way.', 'title': '“Smelly” Elephant Repellent: Assessing the Efficacy of a Novel Olfactory Approach to Mitigating Elephant Crop Raiding in Uganda and Kenya', 'source': 'hwc/Tiller et al. 2022.pdf', 'total_pages': 15, 'page': 0, 'page_label': '1'}, page_content='Citation: Tiller, L.N.; Oniba, E.;\\nOpira, G.; Brennan, E.J.; King, L.E.;\\nNdombi, V .; Wanjala, D.; Robertson,\\nM.R. “Smelly” Elephant Repellent:\\nAssessing the Efficacy of a Novel\\nOlfactory Approach to Mitigating\\nElephant Crop Raiding in Uganda\\nand Kenya. Diversity 2022, 14, 509.\\nhttps://doi.org/10.3390/d14070509\\nAcademic Editors: Michael Wink and\\nMichelle Henley\\nReceived: 26 May 2022\\nAccepted: 18 June 2022\\nPublished: 23 June 2022\\nPublisher’s Note:MDPI stays neutral\\nwith regard to jurisdictional claims in\\npublished maps and institutional affil-\\niations.\\nCopyright: © 2022 by the authors.\\nLicensee MDPI, Basel, Switzerland.\\nThis article is an open access article\\ndistributed under the terms and\\nconditions of the Creative Commons\\nAttribution (CC BY) license (https://\\ncreativecommons.org/licenses/by/\\n4.0/).\\ndiversity\\nArticle\\n“Smelly” Elephant Repellent: Assessing the Efficacy of a Novel\\nOlfactory Approach to Mitigating Elephant Crop Raiding in\\nUganda and Kenya\\nLydia N. Tiller1,2\\n , Ernest Oniba 3,4 , Godfrey Opira 3, Ewan J. Brennan 1, Lucy E. King 1,5 , Victor Ndombi 1,\\nDerick Wanjala 1 and Marion R. Robertson 3, *\\n1 Save the Elephants, Nairobi P .O. Box 54667, Kenya; lydiatiller@gmail.com (L.N.T.);\\newan@savetheelephants.org (E.J.B.); lucy@savetheelephants.org (L.E.K.); victor@savetheelephants.org (V .N.);\\nderick@savetheelephants.org (D.W.)\\n2 Durrell Institute of Conservation and Ecology, University of Kent, Canterbury CT2 7NZ, UK\\n3 WildAid, 220 Montgomery Street #1200, San Francisco, CA 94104, USA; onibaernest@gmail.com (E.O.);\\nopira@wildaid.org (G.O.)\\n4 Wildlife Conservation Society Uganda, Plot 802, Kiwafu Road, Kampala P .O. Box 7487, Uganda\\n5 Department of Zoology, University of Oxford, Oxford OX1 3PS, UK\\n* Correspondence: robertson@wildaid.org\\nAbstract: Human–elephant conflict is increasing across many parts of Asia and Africa. Mitigating\\nelephant crop raiding has become a major focus of conservation intervention, however, many existing\\nmethods for tackling this problem are expensive and difficult to execute. Thus, there is a need for\\nmore affordable, farm-based methods. Testing these methods is key to ensuring their effectiveness\\nand feasibility. In this study, we tested a novel olfactory deterrent, the “smelly elephant repellent”, a\\nfoul-smelling organic liquid, on 40 farms in Uganda and Kenya. Our results show that the repellent\\nwas effective at deterring elephants from crop raiding. Over the study period, 82% of 309 elephant\\ncrop raids were deterred in Uganda. In Kenya, the repellent deterred 63% of 24 crop raiding incidents,\\nand there was a significant effect of the repellent on test sites compared with control sites. The smelly\\nrepellent could be a helpful crop raiding mitigation tool for farmers, as this study showed it to be\\neffective, relatively cheap, quick to produce from locally available ingredients, and communities have\\na positive attitude towards using it. Ongoing work is exploring the potential for a market-based\\napproach to take this to scale in a financially sustainable way.\\nKeywords: African elephants; human-elephant conflict; crop raiding; olfactory mitigation;\\nelephant repellent\\n1. Introduction\\nHuman activities have modified and transformed over half of the Earth’s land sur-\\nface [1], causing extensive habitat loss and fragmentation and leading to a global decline\\nin species [2–5]. This land-use change has expanded the interface between farmland and\\nnatural habitats, creating agricultural frontiers that increase interactions and resource com-\\npetition between humans and wildlife populations [6–8]. The resultant human–wildlife\\nconflict is one of the most complex issues facing conservation today [7,8].\\nHuman–wildlife conflict can have negative impacts on people through damage to\\ncrops and property, livestock depredation, and potential human injury or loss of life [9,10].\\nThis can lead to retaliatory killing of wildlife [11,12] and strongly undermines support for\\nconservation efforts [13–15].\\nAfrican and Asian elephants are particularly prone to conflict as they often range\\noutside the boundaries of protected areas into places inhabited by people [16]. Damage\\nto cultivated food crops by foraging elephants is one of the most widespread forms of\\nhuman–elephant conflict, and farming communities can incur substantial costs. People\\nDiversity 2022, 14, 509. https://doi.org/10.3390/d14070509 https://www.mdpi.com/journal/diversity')],\n", " 'answer': \"The provided articles do not contain information about jaguars or livestock protection from them. Therefore, I don't know the answer to your question.\\n\\n\\n\\n\"}" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rag_chain.invoke({\"input\": \n", " \"I have a small herd of goats and cattle and I am worried about jaguars preying on them. What preventative measures can I take?\"\n", " })" ] }, { "cell_type": "code", "execution_count": 13, "id": "56091874-0e41-4b35-be4f-08d8ec6faf56", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'input': 'I am trying to prevent coyotes from eating the calves of my free-range cattle. What may work best?',\n", " 'context': [Document(id='20f4ca4d-9fb3-42bd-b433-a4a0437bd86a', metadata={'producer': 'Acrobat Distiller 10.1.10 (Windows); modified using iText 4.2.0 by 1T3XT', 'creator': 'LaTeX with hyperref package', 'creationdate': '2020-01-16T12:33:42+05:30', 'keywords': '', 'moddate': '2025-05-27T12:12:25-07:00', 'subject': 'Conservation Biology 2020.34:232-243', 'wps-proclevel': '3', 'wps-journaldoi': '10.1111/(ISSN)1523-1739', 'author': '', 'title': 'Predicting intervention priorities for wildlife conflicts', 'wps-articledoi': '10.1111/cobi.13372', 'source': 'hwc/Baynham-Herd et al. 2019.pdf', 'total_pages': 12, 'page': 10, 'page_label': '242'}, page_content='242 Conflict Intervention Priorities\\nhelps foster more effective collaboration (Game et al.\\n2013; Lute et al. 2018). Third, both the survey results\\nand feedback were consistent with recent scholarship\\n(Redpath et al. 2017) that highlights participatory and\\nstakeholder-first conflict interventions as best practice\\nand advocates multipronged (Hazzah et al. 2014) and\\nadaptive management strategies (Bunnefeld et al. 2017).\\nEducation and awareness programs were often cited in\\nfeedback as being necessary additions to any interven-\\ntions. However, given the failures of many awareness-\\nbased conservation programs (Schultz 2011), a further\\nexploration into why and where conservation decision\\nmakers deem them most appropriate is important. Ap-\\nproaches that are specifically aimed at a particular au-\\ndience, such as social marketing (Salazar et al. 2018),\\nmay be more effective than simple information provision\\nor—often-problematic—enforcement (Duffy et al. 2019).\\nHowever, how different interventions compliment, or\\nnegate, each other is an area in need of greater explo-\\nration (van Eeden et al. 2018).\\nAcknowledgments\\nThis study was supported by a grant from the Natural\\nEnvironment Research Council (NERC) (grant number\\nNERC NE/L002558/1). We also thank the ECCB 2018\\ncommittee, University of Jyv¨askyl¨a, and all the respon-\\ndents for supporting us with this study.\\nSupporting Information\\nFurther information on the scenario presentation\\n(Appendix S1), sample (Appendix S2), additional results\\n(Appendix S3), and the full survey (Appendix S4) are\\navailable online. The authors are solely responsible for\\nthe content and functionality of these materials. Queries\\n(other than absence of the material) should be directed\\nto the corresponding author.\\nLiterature Cited\\nBargh JA. 2006. What have we been priming all these years? on\\nthe development, mechanisms, and ecology of nonconscious so-\\ncial behavior. European Journal of Social Psychology36:147–168.\\nhttps://doi.org/10.1002/ejsp.336.\\nBarua M, Bhagwat SA, Jadhav S. 2013. The hidden dimensions of human-\\nwildlife conflict: health impacts, opportunity and transaction costs.\\nBiological Conservation157:309–316.\\nBaynham-Herd Z, Redpath S, Bunnefeld N, Molony T, Keane A. 2018.\\nConservation conflicts: behavioural threats, frames, and interven-\\ntion recommendations. Biological Conservation222:180–188.\\nBennett NJ, et al. 2017. Mainstreaming the social sciences in conserva-\\ntion. Conservation Biology31:56–66.\\nBunnefeld N, Nicholson E, Milner-Gulland EJ, editors. 2017. Decision-\\nmaking in conservation and natural resource management: mod-\\nels for interdisciplinary approaches. Cambridge University Press,\\nUnited Kingdom.\\nCan ¨OE, D’Cruze N, Garshelis DL, Beecham J, Macdonald DW. 2014.\\nResolving human-bear conflict: A global survey of countries, experts,\\nand key factors. Conservation Letters7:501–513.\\nCarswell LP, Speckman SG, Gill VA. 2015. Shellfish fishery conflicts\\nand perceptions of sea otters in California and Alaska. Sea Otter\\nConservation 333–368.\\nCastelblanco-Mart´ınez DN, Nourisson C, Quintana-Rizzo E, Padilla-\\nSaldivar J, Schmitter-Soto JJ. 2012. Potential effects of human pres-\\nsure and habitat fragmentation on population viability of the an-\\ntillean manatee Trichechus manatusmanatus: a predictive model.\\nEndangered Species Research18:129–145.\\nDeMotts R, Hoon P. 2012. Whose elephants? Conserving, compen-\\nsating, and competing in northern Botswana. Society and Natural\\nResources 25:837–851.\\nDickman A, Johnson PJ, Van Kesteren F, MacDonald DW. 2015. The\\nmoral basis for conservation: How is it affected by culture? Frontiers\\nin Ecology and the Environment13:325–331.\\nDuffy R, et al. 2019. Why we must question the militarisation of con-\\nservation. Biological Conservation232:66–73.\\nEcheverri A, Chan KMA, Zhao J. 2017. How messaging shapes attitudes\\ntoward sea otters as a species at risk. Human Dimensions of Wildlife\\n22:142–156.\\nEklund A, L ´opez-Bao JV, Tourani M, Chapron G, Frank J. 2017.\\nLimited evidence on the effectiveness of interventions to re-\\nduce livestock predation by large carnivores. Scientific Reports7\\nhttps://doi.org/10.1038/s41598-017-02323-w.\\nEvans JSBT, Javier N, Andr´es O, Mario Q, Eloy R, Miguel D. 2008. Dual-\\nprocessing accounts of reasoning, judgment, and social cognition.\\nAnnual Review of Psychology59:255–278.\\nFern´andez-Gil A, et al. 2016. Conflict misleads large carnivore man-\\nagement and conservation: brown bears and wolves in Spain Mar-\\ngalida. PLOS ONE 11(e0151541) https://doi.org/10.1371/journal.\\npone.0151541.\\nFisher J. 2012. No pay, no care? A case study exploring motivations for\\nparticipation in payments for ecosystem services in Uganda. Oryx\\n46:45–54.\\nFukuda Y, Manolis C, Saalfeld K, Zuur A. 2015. Dead or alive?\\nFactors affecting the survival of victims during attacks by salt-\\nwater crocodiles (Crocodylus porosus) in Australia. PLOS ONE\\n10(e0126778) https://doi.org/10.1371/journal.pone.0126778.\\nGame ET, Kareiva P, Possingham HP. 2013. Six common mistakes in'),\n", " Document(id='29d13a05-fdd6-4f8c-b794-cf0e1fc6fdaa', metadata={'producer': 'Canon iR C5800', 'creator': 'Canon iR C5800', 'creationdate': '2009-03-09T08:39:40-05:00', 'subject': 'Image', 'source': 'hwc/Dolbeer et al. 1994.pdf', 'total_pages': 34, 'page': 27, 'page_label': '28'}, page_content='L~J;~...\\'\\n¿- ~1i\\n~ø~~/\\n,\\'~ \\'~J-\\'::~;\"~\\' ~-~\\n\\'-\\na\\nc\\nb\\n..--~\\n1-\\n~~-\\n, :~\\';~\\'?\\'\".\\n-1~~~~f~\\':\".o.,\".~.~) ~\\nç J)\\';i-ir,i.();::u-::::;v\\'\\n~d/idlj¡ti# - \"\"... .. . \\'. ý.o:.. .1l)\"\\',y\\'A \\'jt:)\\n.: .\\' ~:-~J.~,,:::;:,\\'.\"\\'h _ .. \" i.-/ J. l1?~\"P~.o~\\'::~ ....( I:? ~\\'J.J.I\\n\\'-~:~.éiiA~~t~\\'?:,)J -~\\ne\\n¡=j\\'~0\\'Ó .~\\n! r- ..\\'7~l)S,\\n. \\'~RfÖ\\'~~j£\\'\"J;\\').,;.... i\\n/!Æ,?-:\\'\\'~, j\\nq~ f\\\\ .;- .J\\')~~:\\' -\\' i\\n(1\"\\nFig. /8. a. A leg-hold trap is first laid on the ground to detemiine best location of hole. b. The hole should be about II cm deep and shape to\\naccommodate the trap. c. If a stake is used. it is driven into the boHom of the hole. If a drag is used, it is placed in the hole. The chain is then put\\ninto the hole and covered with soil unlIlthe hole is about 3 cm deep and packed to provide a firm foundation. d. TIie front jaw is raised and the pan\\ncover is placed over the pan so soil cannot get under the pan. e. The trap is covered with finely sifted soil to a depth of 0.6-1.2 cm. A siick or whisk\\nbroom is used to touch up and make set appear as natural as possible (from DorscH 1987).\\nThe location of a trap set influences its selectivity.\\nWhen placed beside a carcass, a trap can catch non-\\ntarget animals such as vultures, eagles, badgers, and\\nother carrion-feeders. Nine meters away from the car-\\ncass normally is a safe distance to set traps to avoid\\nnontarget animals. Weather also can affect the opera-\\ntion of traps. Frozen or wet ground can prevent a trap\\nfrom springing.\\nLeg-hold traps must be checked often to prevent the\\nlengthy restraint of captured animals. Most states have\\nlaws on the types of traps, baits and sets, and trap visi-\\ntation schedule,'),\n", " Document(id='e1b4ed29-237c-4cde-8ed7-cbf6ffed090d', metadata={'producer': 'Acrobat Distiller 8.1.0 (Windows)', 'creator': 'Elsevier', 'creationdate': '2016-09-26T20:02:29+05:30', 'crossmarkdomains[2]': 'elsevier.com', 'crossmarkmajorversiondate': '2010-04-23', 'subject': 'Animal Behaviour, 120 (2016) 245-254. doi:10.1016/j.anbehav.2016.07.013', 'author': 'Bradley F. Blackwell', 'elsevierwebpdfspecifications': '6.5', 'crossmarkdomainexclusive': 'true', 'robots': 'noindex', 'moddate': '2016-09-26T20:03:01+05:30', 'doi': '10.1016/j.anbehav.2016.07.013', 'crossmarkdomains[1]': 'sciencedirect.com', 'title': 'No single solution: application of behavioural principles in mitigating human-wildlife conflict', 'source': 'hwc/Blackwell et al. 2016.pdf', 'total_pages': 10, 'page': 0, 'page_label': '245'}, page_content='* Correspondence: B. F. Blackwell, U.S. Department of Agriculture, Animal and\\nPlant Health Inspection Service, Wildlife Services, National Wildlife Research\\nCenter, Ohio Field Station, Sandusky, OH, 44870, U.S.A.\\nE-mail address: bradley.f.blackwell@aphis.usda.gov (B. F. Blackwell).\\nContents lists available atScienceDirect\\nAnimal Behaviour\\njournal homepage: www.elsevier.com/locate/anbehav\\nhttp://dx.doi.org/10.1016/j.anbehav.2016.07.013\\n0003-3472/Published by Elsevier Ltd on behalf of The Association for the Study of Animal Behaviour.\\nAnimal Behaviour 120 (2016) 245e254\\nSPECIAL ISSUE: CONSERVATION BEHAVIOUR'),\n", " Document(id='015e62f1-83e6-4f19-846c-e2606b4a44f9', metadata={'producer': 'Canon iR C5800', 'creator': 'Canon iR C5800', 'creationdate': '2009-03-09T08:39:40-05:00', 'subject': 'Image', 'source': 'hwc/Dolbeer et al. 1994.pdf', 'total_pages': 34, 'page': 28, 'page_label': '29'}, page_content='502\\nFENCING AND BARRIERS\\nLivestock, poultr, and crops can be protected from\\npredation with properly placed fencing and barers. Or-\\ndinai fencing wil not keep most predators from gardens\\nor poultr rages. However, many of them can be ex-\\ncluded bi adding a single wire strand electnfied by a com-\\nmercial fence charger, 20 cm out from the fence and 20\\nem above the ground. Storer et al. (1938) reported success\\nin keeping bear out of storehouses and other areas by thç\\nuse of a speifically designed electnc fence. An antipre-\\ndator electnc fence can provide some producers with a\\nself-help method of effectively preventing coyote depre-\\ndation of livestock (Nass and Theade 1988). One design\\nis a fence 1.5 m high with 12 alternating ground and\\ncharged wires space 10-15 cm apar (Gates et al. 1978).\\nSkunks can be controlled around a poultry range by\\nsurrounding the range with a 0.9-m wire-netting fence set\\n0.6 m above ground and 0.3 m below the surface; a 15-\\ncm length of the par below the surface is bent outwardly\\nat right angles and buned 15 cm deep. Mink and weaels\\ncan be excluded from domestic animal quarers by co v-enng all openings larger than 2.5 cm with metal or hard-\\nware cloth.\\nAll holes in foundations of buildings should be closed\\nor screened to prevent small predators such as skunks and\\nopossums from living in or under them. If they have al-\\nready established a home, all entrances except one should\\nbe closed. The soil should be loosened or flour should be\\nsprinkled in front of the hole so a track can be detected.\\nThe area should be checked for tracks after dark, and if\\ntrcks indicate the animal has left the location, the open-\\ning should be sealed securely.\\nM-4\\nThe M-44, registered by the EPA for the control of\\ncoyotes, foxes, and feral dogs, is a mechanical device that\\nejects sodium cyanide into the animal\\'s mouth (Connolly\\n1988). The unit consists of a casc holder wrapped with\\ncloth, fur, wool, or steel wool; a plastic capsule or case\\nthat holds the cyanidc; and a 7-cm ejector unit. The M-\\n44 case is loadcd with 12 grains (0.78 g) of sodium cy-\\nanide and an additive to reduce caking. A spring-Ioadcd\\nplunger ejccts the cyanide. These componcnts, when as-\\nsemblcd, are encased in a tube driven into the ground.\\nThe cocked ejector with the case in the holder is screwed\\non top, placcd into thc tube, and baited. The bait usually\\nis made from fctid meat, musks, and beavcr castors. Whcn\\nan animal is attracted to thc bait and trics to pick up the\\nbaited case holder with its tecth. thc cyanidc is ejectcd\\ninto its mouth. Dogs, skunks, raccoons, bears, and opos-\\nsums sometimes arc attracted to the bait used on M-44s;\\nhowever, selectivity is cnhanccd by proper site and bait\\n(sccnt) sclections. The EPA and individual states have\\nplaccd numcrous restrictions on the use of M-44s.\\nLITERATURE CITED\\nAGÜERO. D. A., R. J. JOIINSON, AND K. M. ESKRIDGE. 1991. Mono-\\nfilament lines repel house sparrows from fèedin); siles. Wildl. Soc.\\nBulL. 19:416--22.\\nALSAGER. D. E. 1977. Impact of pocket );ophers (ThoIiOIlVS lalf\\'oides)\\non the quantitaiive productivity of rangeland vègeution in southern\\nAlberta: a damage assessment tool. Pa~ès ,)7-57 iii W. B. Jackson\\nand R. E. Marsh. cds. Vertebrate 1)C~1 conirol and management\\nmaterials. Am. Soc. Test. Maierials Spec. Pub!. 625.\\nANDERSON, T. E. 19ó9. identifying, evaluating, and controlling wildlife\\ndamage. Pages 497-520 in R. H. Giles, ed. Wildlife management\\ntechniques. Third ed. The Wild!. Soc., Washington, D.C.\\nANONY, R. M., V. G. BARNES, JR., AND J. EVANS. 1978. \"VEXAR\"\\nplastic netting to reduce poket gopher depredation of conifer se-\\nlings. Pr. Vertebr. Pest Conf. 8:138-144.\\nARNE, D. H., AND J. S. DUBOSE. 1982. The impact of the bever on\\nthe environment and economics in the southeastern United States.\\nTrans. Int. Congr. Game BioI. 14:241-247.\\nAUSTN, D. D., AND P. J. URNESS. 1989. Evaluating production losses\\nfrom mule deer depreation in apple orchards. Wild!. Soc. BulL.\\n17:161-165.\\nBACUS, LC. 1968. Th be foot snare. U.S. Fish Wild!. Servo Field\\nTraining Aid 2. 14pp.\\nBAKER, R. 0., R. M. TIMM, AND G. R. BODMAN. 1993. Rodent-proof\\nconstrction. In S. E. Hygnstrom, R. M. Timm, and G. E. Laon,\\ncds. Prvention and control of wildlife damage. Univ. Nebraka\\nCoop. Ext. Ser., Lincoln.\\nBARRE, R. H. 1993. Feral hogs. In S. E. Hygnstrom. R. M. Timm,\\nand G. E. Lan, cds. Prvention and control of wildlife damage.\\nUniv. Nebraka Coop. Ext. Serv., Lincoln.\\nBEIER, P., AND R. H. BARREl. 1987. Beaver habitat use and impact\\nin Truckee River basin, California. J. Wild!. Manage. 51 :794-799.\\nBESSER, J. F. 1986. A guide to aid growers in reucing bird damage\\nto U.S. agricultur.il crops. Denver Wild!. Res. Cent. Bird Damage\\nRes. Rep. 377. 9lpp.\\n-, AND D. J. BRADY. 1986. Bird damage to ripening field com\\nincreaes in the United Slates from 1971 10 1981. U.S. Fish Wildl.\\nServo Fish Wild!. Leall. 7. 6pp.\\n-, J. W. DEGRAZO, ANDJ. L GUARINO. 1968. COSiS of wintering')],\n", " 'answer': \"Based on the provided text, several methods could help prevent coyote predation of livestock. Properly placed fencing with an electrified strand (20 cm out and 20 cm above the ground) is one option (Gates et al. 1978; Storer et al. 1938). Additionally, the M-44 device, which ejects sodium cyanide, is registered for coyote control, though its use is restricted by the EPA and state regulations (Connolly 1988). It's important to note that selectivity with the M-44 can be enhanced by careful site and bait selection.\\n\\n\\n\\n\"}" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rag_chain.invoke({\"input\": \"I am trying to prevent coyotes from eating the calves of my free-range cattle. What may work best?\"})" ] }, { "cell_type": "code", "execution_count": 14, "id": "918dc691-6c66-46b2-8930-01dbeb6f712b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'input': 'We have major issues with deer raiding our large agricultural fields. Is there anything I can try to prevent this that won’t break the bank?',\n", " 'context': [Document(id='7d64f897-b500-4aac-8f4c-cf0bd19c062e', metadata={'producer': 'PyPDF', 'creator': 'Elsevier', 'creationdate': '2022-06-07T02:40:21+00:00', 'author': 'Charlotte Lorand', 'crossmarkdomains[1]': 'elsevier.com', 'crossmarkdomains[2]': 'sciencedirect.com', 'crossmarkdomainexclusive': 'true', 'crossmarkmajorversiondate': '2010-04-23', 'elsevierwebpdfspecifications': '7.0', 'keywords': 'Human-carnivore coexistence; Lethal control; Non-lethal management; Conservation interventions; Effectiveness; Evidence-based', 'moddate': '2022-06-07T02:40:21+00:00', 'subject': 'Science of the Total Environment, 838 (2022) 156195. doi:10.1016/j.scitotenv.2022.156195', 'title': \"Effectiveness of interventions for managing human-large carnivore conflicts worldwide: Scare them off, don't remove them\", 'doi': '10.1016/j.scitotenv.2022.156195', 'robots': 'noindex', 'source': 'hwc/Lorand et al. 2022.pdf', 'total_pages': 11, 'page': 5, 'page_label': '6'}, page_content='and among lethal interventions, 48.6% investigated culling (N =1 7 ) ,\\n34.3% retaliatory killing (N = 12), and 17.1% trophy-hunting (N =6 ) .\\nContrary to the whole body of literature, most of these case studies were\\nlocated in the Neartic (63.6%) followed by the Afrotropic (24.5%) and\\nPaleartic (7.7%) (Fig. 3). Nonetheless, the species included in the case studies\\nreflected the generalfindings, with most of the management experiments\\nbeing conducted on wolves (29.4%) followed by bears (23.8%) and leopards\\n(16.1%) (Fig. 2). Surprisingly, almost none of the experiments were con-\\nducted on tigers, despite their strong presence in the whole literature and\\ntheir heavy impact, including attacks on humans (Dhungana et al., 2016).\\nFig. 2.Species prevalence in literature (black bars,N = 525) and case studies (gray bars, N = 143).\\nFig. 3.Geographic prevalence in literature (black bars, N = 525) and case studies (gray bars,N = 143), with species involved per geographic area. In circles, mean results of\\neffectiveness (black bars), certainty of evidence (gray bars) and harm (white bars) assessments for each geographical area (NLT: non-lethal interventions; T: translocations; L:\\nlethal interventions).\\nC. Lorand et al. Science of the Total Environment 838 (2022) 156195\\n6'),\n", " Document(id='f99fb5b6-c0d4-4315-89d5-02c25c951abd', metadata={'producer': 'PyPDF', 'creator': 'Elsevier', 'creationdate': '2022-06-07T02:40:21+00:00', 'author': 'Charlotte Lorand', 'crossmarkdomains[1]': 'elsevier.com', 'crossmarkdomains[2]': 'sciencedirect.com', 'crossmarkdomainexclusive': 'true', 'crossmarkmajorversiondate': '2010-04-23', 'elsevierwebpdfspecifications': '7.0', 'keywords': 'Human-carnivore coexistence; Lethal control; Non-lethal management; Conservation interventions; Effectiveness; Evidence-based', 'moddate': '2022-06-07T02:40:21+00:00', 'subject': 'Science of the Total Environment, 838 (2022) 156195. doi:10.1016/j.scitotenv.2022.156195', 'title': \"Effectiveness of interventions for managing human-large carnivore conflicts worldwide: Scare them off, don't remove them\", 'doi': '10.1016/j.scitotenv.2022.156195', 'robots': 'noindex', 'source': 'hwc/Lorand et al. 2022.pdf', 'total_pages': 11, 'page': 4, 'page_label': '5'}, page_content='likelihood ratio test that compared the modelfit with and without a group-\\ning factor (here, the case study ID).\\nIn addition to the scoring consistency of evaluators, we investigated\\nwhether average Effectiveness, CoE, HC, and HP scores changed over the\\ntime period covered by our study cases (1975–2021) or differed according\\nto the intervention considered (lethal and non-lethal interventions, translo-\\ncations). We modeled the scores for the four metrics as functions of the in-\\ntervention type and time (year of publication of the case study) based on the\\nmixed-effects linear regression models with the evaluator ID and case study\\nID used as random factors and the intervention type and publication year\\nrespectively incorporated as qualitative and quantitativefixed-effects ex-\\nplanatory variables. Models were implemented using thelmer function of\\nthe lme4 Rp a c k a g e(Bates et al., 2015).\\n3. Results\\n3.1. Features of human-large carnivore conflicts around the world\\nFrom our literature search, we examined 525 articles describing the fea-\\ntures of human-large carnivore conflict, and found a great heterogeneity in\\nnumbers of published studies depending on the geographic location of the\\nconflict, as well as the species involved (refer to Appendix 1 for details).\\n3.1.1. Geographic range\\nLiterature was skewed toward conflicts in the Palearctic (25.7%), Ne-\\narctic (22.9%), and Afrotropic (22.5%). Conflicts in the Indomalaya\\n(8.4%), Neotropic (7.0%), and Australasia (2.1%) were reported more\\nrarely.\\n3.1.2. Species involved\\nThe frequency of involvement in reported conflicts depending on the\\nspecies (total of 13 species) was highly unbalanced toward wolves (Canis\\nlupus, 19.0%), bears (Ursus sp., 15.0%) and leopards (Panthera pardus,\\n12.6%). Among the other species, lions (Panthera leo, 9.3%) were the\\nmost frequently dealt with, followed by tigers (Panthera tigris, 6.7%),\\npumas (Puma concolor, 5.1%) and coyotes (Canis latrans,5 . 1 % ). Other spe-\\ncies such as lynx (Lynx lynx), hyenas (Hyaena sp.) or cheetah (Acinonyx\\njubatus) were found in 5.0% of the articles or less (Fig. 2).\\n3.1.3. Types of conflicts and impacts\\nBy far, depredation on livestock was the major issue depicted in litera-\\nture, reported in 25.0% of all the articles considered (N = 525), and\\n50.6% of articles describing conflict(N = 259; seeFig. 1for details and\\nmain findings), all disregarding the species involved. The other predomi-\\nnant issues were the management of damage-causing individuals, attacks\\non humans (both 8.5%), urban coexistence, legislative disagreement or dis-\\nease control.\\n3.1.4. Remediation strategies\\nIn the whole panel of articles focusing on specific remediation strategies\\n(N =2 6 6 ;Fig. 1), preventive and reactive strategies were the most docu-\\nmented (37.2% and 47.0%, respectively). In particular, reactive strategies\\nhave been used historically, with a predominance of lethal control\\n(50.4%). Meanwhile, mitigation strategies and integrated programs were\\nless documented (10.2% and 5.6%, respectively).\\n3.2. Effectiveness assessment\\nWe assessed 143 case studies (selected according to the method de-\\nscribed inSection 2.2) from 103 articles (listed in Appendix 3) published\\nbetween 1975 and 2021. Overall, 57.3% (N = 82) of the case studies fo-\\ncused on non-lethal interventions, of which 35.4% on aversive conditioning\\n(N = 29), 22.0% on frightening devices (N = 18), and 4342.74% on zoo-\\ntechnical devices (N = 35). Translocations and lethal interventions made\\nfor 18.2% and 24.5% of the case studies (N = 26 and N = 35 respectively)\\nC. Lorand et al. Science of the Total Environment 838 (2022) 156195\\n5'),\n", " Document(id='4a72f9d1-9322-4d07-a06e-84ab27fe5930', metadata={'producer': 'iText® 5.3.5 ©2000-2012 1T3XT BVBA (AGPL-version)', 'creator': 'Springer', 'creationdate': '2018-03-22T06:58:50+05:30', 'title': 'Limited evidence on the effectiveness of interventions to reduce livestock predation by large carnivores', 'keywords': '', 'moddate': '2018-04-05T11:35:12+02:00', 'subject': 'Scientific Reports, doi:10.1038/s41598-017-02323-w', 'doi': '10.1038/s41598-017-02323-w', 'author': 'Ann Eklund', 'source': 'hwc/Eklund et al. 2017.pdf', 'total_pages': 9, 'page': 5, 'page_label': '6'}, page_content='principles of an adaptive approach56 and plan interventions to allow evaluations of effect and causality. We hope \\nresearchers embrace the challenge to improve study designs and move towards solid evaluations of management \\ninterventions.\\nWe fully acknowledge the difficulties facing research projects studying large carnivores and livestock and that \\nit is far from always possible to perform randomized controlled trials. Nevertheless, we suggest the field of large \\ncarnivore management follows the lead of medical sciences and conservation practices, and aim to produce evi-\\ndence of the highest possible quality\\n57. If we continue to do research in the way we have so far been doing, many \\nmore papers will be published in the coming years, but likely providing very little reliable knowledge on the effec-\\ntiveness of interventions that cost farmers and tax payers vast amounts of money, as well as the lives of livestock \\nand carnivores around the globe.\\nMethods\\nLiterature review. To be included in this literature review, studies had to i) be written in English and pub-\\nlished in a peer-reviewed scientific journal; ii) include an empirical study of wild (i.e., not captive) carnivores; iii) \\ninclude a quantitative evaluation of interventions to prevent/reduce depredation of livestock (excluding apiaries); \\niv) include a description of the methods used to implement the intervention (treatment) and of a study design \\nsufficient for replication; and v) include a matched control to which the treatment was compared.\\nWe compiled a database from the Zoological Record (http://wokinfo.com/products_tools/specialized/zr/) con-\\ntaining publications between 1 January, 1990 and 16 June, 2016. The search was made with the subject descriptors \\n“Carnivora OR Canidae OR Felidae OR Hyaenidae OR Mustelidae OR Procyonidae OR Ursidae OR Viverridae OR \\nViverridae”. In total, we retrieved 48,894 titles. The titles and abstracts of these publications were imported to \\nEndNote X7.0.2 (Thomson Reuters, New Y ork, United States) and screened by the following search string: “depre -\\ndation OR stock OR poultry OR damage OR mitigation OR conflict OR control OR cull OR cow OR bull OR calf OR \\ncalves OR chicken OR hen OR ewe OR lamb OR pet OR cat OR hound OR pony OR ponies OR mule OR reindeer OR \\nllama OR yak OR buffalo OR livestock OR cattle OR sheep OR goat OR horse OR pig OR dog OR attack OR camel OR \\ndonkey”. With this screening, we were left with 27,781 publications.\\nWe manually screened the remaining publications to identify studies written in English that dealt with depre-\\ndation of domestic animals (livestock and pets) by terrestrial mammalian large carnivores. Large carnivores were \\ndefined as species with an average body mass of >15 kg. We included studies of the 28 species listed by Ripple et al.\\n58'),\n", " Document(id='ce69d1d7-dcde-4f5d-91fc-f4b8b52652c9', metadata={'producer': 'GPL Ghostscript 9.26', 'creator': '', 'creationdate': '2022-06-06T23:09:49-07:00', 'moddate': '2022-06-06T23:09:49-07:00', 'title': '', 'author': '', 'subject': '', 'keywords': '', 'source': 'hwc/Kavcic et al. 2013.pdf', 'total_pages': 9, 'page': 2, 'page_label': '3'}, page_content='hypothesis was that index of pre- and post-ban use\\nwas the same for both types of feeding sites.\\nWe calculated the average annual number of\\nobserved bears during pre- and post-ban periods\\nfor each feeding site. We then used these averages\\ninstead of raw data from individual counts. We\\ncalculated an annual index of feeding site use by\\npooling data from all feeding sites (average number\\nof bears counted at feeding sites in post-ban period\\ndivided by average number of bears counted in pre-\\nban period). Subsequently, we used bootstrapping\\nwith 1,000 simulations to test for differences between\\nSUPPLEMENTAL FEEDING AND BEAR DEPREDATIONS N Kavcˇicˇ et al. 113\\nUrsus 24(2):111–119 (2013)')],\n", " 'answer': \"The provided articles primarily focus on human-large carnivore conflict, not deer. Therefore, I don't have information within these documents to answer your question about preventing deer from raiding agricultural fields.\"}" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rag_chain.invoke({\"input\": \"We have major issues with deer raiding our large agricultural fields. Is there anything I can try to prevent this that won’t break the bank?\"})" ] }, { "cell_type": "code", "execution_count": 15, "id": "07b9578c-9a89-4874-a34d-30a060ed3407", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'input': 'We live in a suburban area and bears sometimes come into our town to eat from our fruit trees and trash. What are the best ways for us to prevent this as a community? We don’t want to have to get rid of our fruit trees…',\n", " 'context': [Document(id='20f4ca4d-9fb3-42bd-b433-a4a0437bd86a', metadata={'producer': 'Acrobat Distiller 10.1.10 (Windows); modified using iText 4.2.0 by 1T3XT', 'creator': 'LaTeX with hyperref package', 'creationdate': '2020-01-16T12:33:42+05:30', 'keywords': '', 'moddate': '2025-05-27T12:12:25-07:00', 'subject': 'Conservation Biology 2020.34:232-243', 'wps-proclevel': '3', 'wps-journaldoi': '10.1111/(ISSN)1523-1739', 'author': '', 'title': 'Predicting intervention priorities for wildlife conflicts', 'wps-articledoi': '10.1111/cobi.13372', 'source': 'hwc/Baynham-Herd et al. 2019.pdf', 'total_pages': 12, 'page': 10, 'page_label': '242'}, page_content='242 Conflict Intervention Priorities\\nhelps foster more effective collaboration (Game et al.\\n2013; Lute et al. 2018). Third, both the survey results\\nand feedback were consistent with recent scholarship\\n(Redpath et al. 2017) that highlights participatory and\\nstakeholder-first conflict interventions as best practice\\nand advocates multipronged (Hazzah et al. 2014) and\\nadaptive management strategies (Bunnefeld et al. 2017).\\nEducation and awareness programs were often cited in\\nfeedback as being necessary additions to any interven-\\ntions. However, given the failures of many awareness-\\nbased conservation programs (Schultz 2011), a further\\nexploration into why and where conservation decision\\nmakers deem them most appropriate is important. Ap-\\nproaches that are specifically aimed at a particular au-\\ndience, such as social marketing (Salazar et al. 2018),\\nmay be more effective than simple information provision\\nor—often-problematic—enforcement (Duffy et al. 2019).\\nHowever, how different interventions compliment, or\\nnegate, each other is an area in need of greater explo-\\nration (van Eeden et al. 2018).\\nAcknowledgments\\nThis study was supported by a grant from the Natural\\nEnvironment Research Council (NERC) (grant number\\nNERC NE/L002558/1). We also thank the ECCB 2018\\ncommittee, University of Jyv¨askyl¨a, and all the respon-\\ndents for supporting us with this study.\\nSupporting Information\\nFurther information on the scenario presentation\\n(Appendix S1), sample (Appendix S2), additional results\\n(Appendix S3), and the full survey (Appendix S4) are\\navailable online. The authors are solely responsible for\\nthe content and functionality of these materials. Queries\\n(other than absence of the material) should be directed\\nto the corresponding author.\\nLiterature Cited\\nBargh JA. 2006. What have we been priming all these years? on\\nthe development, mechanisms, and ecology of nonconscious so-\\ncial behavior. European Journal of Social Psychology36:147–168.\\nhttps://doi.org/10.1002/ejsp.336.\\nBarua M, Bhagwat SA, Jadhav S. 2013. The hidden dimensions of human-\\nwildlife conflict: health impacts, opportunity and transaction costs.\\nBiological Conservation157:309–316.\\nBaynham-Herd Z, Redpath S, Bunnefeld N, Molony T, Keane A. 2018.\\nConservation conflicts: behavioural threats, frames, and interven-\\ntion recommendations. Biological Conservation222:180–188.\\nBennett NJ, et al. 2017. Mainstreaming the social sciences in conserva-\\ntion. Conservation Biology31:56–66.\\nBunnefeld N, Nicholson E, Milner-Gulland EJ, editors. 2017. Decision-\\nmaking in conservation and natural resource management: mod-\\nels for interdisciplinary approaches. Cambridge University Press,\\nUnited Kingdom.\\nCan ¨OE, D’Cruze N, Garshelis DL, Beecham J, Macdonald DW. 2014.\\nResolving human-bear conflict: A global survey of countries, experts,\\nand key factors. Conservation Letters7:501–513.\\nCarswell LP, Speckman SG, Gill VA. 2015. Shellfish fishery conflicts\\nand perceptions of sea otters in California and Alaska. Sea Otter\\nConservation 333–368.\\nCastelblanco-Mart´ınez DN, Nourisson C, Quintana-Rizzo E, Padilla-\\nSaldivar J, Schmitter-Soto JJ. 2012. Potential effects of human pres-\\nsure and habitat fragmentation on population viability of the an-\\ntillean manatee Trichechus manatusmanatus: a predictive model.\\nEndangered Species Research18:129–145.\\nDeMotts R, Hoon P. 2012. Whose elephants? Conserving, compen-\\nsating, and competing in northern Botswana. Society and Natural\\nResources 25:837–851.\\nDickman A, Johnson PJ, Van Kesteren F, MacDonald DW. 2015. The\\nmoral basis for conservation: How is it affected by culture? Frontiers\\nin Ecology and the Environment13:325–331.\\nDuffy R, et al. 2019. Why we must question the militarisation of con-\\nservation. Biological Conservation232:66–73.\\nEcheverri A, Chan KMA, Zhao J. 2017. How messaging shapes attitudes\\ntoward sea otters as a species at risk. Human Dimensions of Wildlife\\n22:142–156.\\nEklund A, L ´opez-Bao JV, Tourani M, Chapron G, Frank J. 2017.\\nLimited evidence on the effectiveness of interventions to re-\\nduce livestock predation by large carnivores. Scientific Reports7\\nhttps://doi.org/10.1038/s41598-017-02323-w.\\nEvans JSBT, Javier N, Andr´es O, Mario Q, Eloy R, Miguel D. 2008. Dual-\\nprocessing accounts of reasoning, judgment, and social cognition.\\nAnnual Review of Psychology59:255–278.\\nFern´andez-Gil A, et al. 2016. Conflict misleads large carnivore man-\\nagement and conservation: brown bears and wolves in Spain Mar-\\ngalida. PLOS ONE 11(e0151541) https://doi.org/10.1371/journal.\\npone.0151541.\\nFisher J. 2012. No pay, no care? A case study exploring motivations for\\nparticipation in payments for ecosystem services in Uganda. Oryx\\n46:45–54.\\nFukuda Y, Manolis C, Saalfeld K, Zuur A. 2015. Dead or alive?\\nFactors affecting the survival of victims during attacks by salt-\\nwater crocodiles (Crocodylus porosus) in Australia. PLOS ONE\\n10(e0126778) https://doi.org/10.1371/journal.pone.0126778.\\nGame ET, Kareiva P, Possingham HP. 2013. Six common mistakes in'),\n", " Document(id='e1b4ed29-237c-4cde-8ed7-cbf6ffed090d', metadata={'producer': 'Acrobat Distiller 8.1.0 (Windows)', 'creator': 'Elsevier', 'creationdate': '2016-09-26T20:02:29+05:30', 'crossmarkdomains[2]': 'elsevier.com', 'crossmarkmajorversiondate': '2010-04-23', 'subject': 'Animal Behaviour, 120 (2016) 245-254. doi:10.1016/j.anbehav.2016.07.013', 'author': 'Bradley F. Blackwell', 'elsevierwebpdfspecifications': '6.5', 'crossmarkdomainexclusive': 'true', 'robots': 'noindex', 'moddate': '2016-09-26T20:03:01+05:30', 'doi': '10.1016/j.anbehav.2016.07.013', 'crossmarkdomains[1]': 'sciencedirect.com', 'title': 'No single solution: application of behavioural principles in mitigating human-wildlife conflict', 'source': 'hwc/Blackwell et al. 2016.pdf', 'total_pages': 10, 'page': 0, 'page_label': '245'}, page_content='* Correspondence: B. F. Blackwell, U.S. Department of Agriculture, Animal and\\nPlant Health Inspection Service, Wildlife Services, National Wildlife Research\\nCenter, Ohio Field Station, Sandusky, OH, 44870, U.S.A.\\nE-mail address: bradley.f.blackwell@aphis.usda.gov (B. F. Blackwell).\\nContents lists available atScienceDirect\\nAnimal Behaviour\\njournal homepage: www.elsevier.com/locate/anbehav\\nhttp://dx.doi.org/10.1016/j.anbehav.2016.07.013\\n0003-3472/Published by Elsevier Ltd on behalf of The Association for the Study of Animal Behaviour.\\nAnimal Behaviour 120 (2016) 245e254\\nSPECIAL ISSUE: CONSERVATION BEHAVIOUR'),\n", " Document(id='783a63ef-9c25-4ca8-ac67-225027bf0946', metadata={'producer': 'Canon iR C5800', 'creator': 'Canon iR C5800', 'creationdate': '2009-03-09T08:39:40-05:00', 'subject': 'Image', 'source': 'hwc/Dolbeer et al. 1994.pdf', 'total_pages': 34, 'page': 10, 'page_label': '11'}, page_content=\"gered and 'protected by state and federal laws. Control\\noperators unfamiliar with bat identification are urged to\\nsek professional help from wildlife agencies or univer-\\nsities (Frantz 1986).\\nThe presence of bats in a building usually is evidenced\\nby noise (squeaking, scratching) and by the presence and\\ndistinctive, pungent odor of the accumulated fecal drop-\\npings and urine. Bat feces are readily identified from those\\nof rodents by odor, insect content, and the ease with which\\nthey are crushed (Greenhall 1982).\\nMany people are feanul of bats and panic in their pres-\\nence. Bats occasionally contract rabics, and, although few\\nhuman deaths have resulted from bat-transmitted rabies\\n(Green hall i 982), contact with a rabid bat or a bite by a\\nbat that escapes requires pòstexposurc trcatmcnt of people\\nand pets without current vaccinations (Frantz 1986).\\nWhere bat colonies are allowed to pcrsist so that guano\\ndeposits accumulate, the fungus that causcs histoplasmosis\\ncan develop. Bats roosting near airports may be hazardous\\nto aircraft (Kincaid 1975).\\nControl Tecliiiiques.-Exclusion (including the use of\\nvalve devices that permit bats to Ieavc but not rcturn; this\\nshould be done after young reach night stagc). repellents,\\ntraps, artificial roosts, education to overcomc phobias, tox-\\nicants (may increase risk of exposure to rabics and is not\\nrecommcnded in most situations).\\nSEA VERS\\nBeaver damage is easily identified by (he distinctive,\\ncone-shaped tree stumps resulting from their gnawing and\\nolten by the prcsence of their dams and lodgcs. The latter\\nmight not be present, however. in ponds or reservoirs or\\nalong swift mountain streams. where they burrow into\\nbanks. Usually. green sticks with the bark freshly peeled\\noff may be found when beavers are active in an area.\\nDamage caused by beavers results from feeding behav-\\nior (tree cutting) and their efforts to control water levels\"),\n", " Document(id='4df77498-a539-4aeb-9832-82c4c845030c', metadata={'producer': 'Acrobat Distiller 6.0 (Windows); modified using iText 4.2.0 by 1T3XT', 'creator': 'PScript5.dll Version 5.2.2', 'creationdate': '2015-04-13T10:24:10+02:00', 'moddate': '2025-05-27T11:49:29-07:00', 'subject': 'African Journal of Wildlife Research 2015.45:76-87', 'author': 'NICO', 'title': 'Break on through to the other side : the effectiveness of game fencing to mitigate human-wildlife conflict', 'source': 'hwc/Kesch et al. 2014.pdf', 'total_pages': 12, 'page': 1, 'page_label': '2'}, page_content='lations are available, are struggling with inbred\\nanimal populations (Frankham 2009; Stein 1999;\\nTrinkel\\net al. 2008 & 2010).\\nFor many species, including elephants, lions and\\nleopards ( Panthera pardus ) non-permeability\\nof unelectrified fences is often very difficult to\\nachieve (Bonnington, Grainer, Dangerfield &\\nFanning, 2010; Davies-Mostert, Mills & Macdon -\\nald, 2009; Ferguson, Adam & Jori, 2012; Hayward,\\nAdendorff, Moolman, Hayward & Kerley, 2007;\\nHoare, 1992; Hunter\\net al. , 2007; Kesch, Bauer\\n& Loveridge, 2014; Slotow, 2012) and the\\neffectiveness of electrified fences is highly depend-\\nent on maintenance (Davies-Mostert\\net al., 2009;\\nKesch et al., 2013). Game fences, which are not\\nmaintained appropriately, can further fuel the con-\\nflict situation due to predators being attracted to\\naccumulations of prey along the fence (M.K. Kesch,\\nunpubl. data) and easy access to human-\\ndominated land. To determine if, and to what\\nextent, fences are permeable to certain animal\\nspecies and therefore the fences’ effectiveness as\\na conflict solution, the ‘Fence Incident Surveil-\\nlance System’ (FISS; Ferguson\\net al., 2012) and\\nBonnington’s (2010) spoor methodenable stake-\\nholders to calculate frequencies of fence crossings.\\nUsing a method similar to the FISS, we studied\\nthe permeability and hence effectiveness of the\\nMakgadikgadi Pans National Park game fence in\\ncentral Botswana. One of the major reasons for\\ninstallation of this fence was to resolve conflict\\nbetween agro-pastoralists and lions and ele -\\nphants (Gupta, 2005). Since the fence appears to\\nbe permeable to many animal species (see Reed\\n& Sauterau, 2005), our study investigates whether\\nthe fence is effective at excluding lions and elephants\\nfrom the human-dominated area.Furthermore, we\\nhighlight the importance of fence maintenance\\nand alignment and provide data on seasonal and\\nregional hotspots of fence transgressions.\\nMETHODS\\nStudy site\\nLocated between 20 and 21°S and 24 and 26°E,\\nthe Makgadikgadi Pans National Park (MPNP) is\\n4900 km² in size. The region has one rainy (Octo-\\nber–March) and one dry season (April–Septem -\\nber) per year and annual rainfall averages 450 mm\\n(Meynell & Parry, 2002). Temperatures range\\nbetween a mean minimum of 6.9–19.9°C and a\\nmean maximum of 25.3–35.2°C (Alexander &\\nFerguson, 2002). MPNP is home to the largest\\nremaining plains zebra (\\nEquus burchelli) and blue\\nwildebeest (Connochaetes taurinus) migration in\\nsouthern Africa. With the first rains, the animals\\nmove from their dry season range along the Boteti\\nRiver east to the big Makgadikgadi Saltpans,\\nwhere rainwater accumulates at the surface. The\\narea west of the Boteti River, which is the western\\npark boundary, is one of the highest human–wild-\\nlife conflict areas in Botswana, with the major\\nconflict species being lions (killing livestock) and\\nelephants (raiding crops) (Alexander, Signorelli,\\nMompoloki & Van Der Post, 2002). Mitigating this\\nconflict was one of the major reasons for an electri-\\nfied, double game fence (2.7 m high mesh wire\\nfence with four electric wires on each side and\\n1.5 m high unelectrified mesh wire cattle [\\nBos\\ntaurus and Bos indicus ] fence) being installed\\nin 2004, crisscrossing the dry Boteti riverbed.\\nIn 2008, after almost 20 years, the river started to\\nflow again, creating a permanent water source for\\npeople and wildlife, but also causing short-circuits\\nand flooding of the fence at some sections.\\nTogether with serious fence damage caused by\\nelephants and theft of fence material, this left the\\nfence largely unelectrified.\\nThe section of the fence north of Khumaga\\nvillage crisscrosses the Boteti River in several\\nplaces, giving wildlife access to water. By contrast,\\nthe section between the villages of Khumaga and\\nSukwane runs exclusively on the eastern side\\nof the Boteti River, excluding wildlife from the river\\n(Fig. 1).\\nSpoor and break count survey\\nWith the help of an experienced San tracker,\\ndata were collected in the rainy (November 2010\\n– April 2011) and dry (June–October 2011)\\nseasons. The maintenance road along the inside\\nof the MPNP fence was surveyed in four transects\\n(mean length ± S.D. = 21. 6 ± 2 km), with a total\\nlength of 86.4 km (Fig. 1). Due to the fence align-\\nment (see above), transects were grouped into\\nnorthern (transects 1 & 2) and southern sections\\n(transects 3 & 4, Fig. 1) for data analysis.\\nPer day of data collection, one transect was\\ndriven and a total distance of 862 km was covered\\nover 49 days of data collection. Data were collected\\nduring the early morning, when the road was still\\nundisturbed by vehicles and when there was no\\nrain or wind during the night before. The fence was\\ndriven at an average speed of 10–15 km/h with the\\ndriver, one person on the roof and one person on\\nthe bumper scanning for holes and breaks under-\\nKesch et al.: Effectiveness of game fencing to mitigate human–wildlife conflict 77')],\n", " 'answer': \"Based on the provided context, several strategies can help a community prevent bear-human conflict without removing fruit trees. Here's a breakdown of effective approaches:\\n\\n* **Secure Food Sources:** The text highlights that approaches aimed at a particular audience, such as social marketing (Salazar et al. 2018), may be more effective than simple information provision. This suggests a community-wide education campaign on proper trash management is crucial. Ensure all trash containers are bear-resistant or stored securely indoors until collection day (Duffy et al. 2019).\\n* **Fruit Tree Management:** While the text doesn’t specifically address fruit trees, it emphasizes the importance of addressing attractants. Promptly collecting fallen fruit is essential.\\n* **Participatory & Stakeholder-First Approach:** The articles emphasize participatory and stakeholder-first conflict interventions as best practice (Redpath et al. 2017). This means involving residents in developing and implementing solutions.\\n* **Adaptive Management:** Employing adaptive management strategies (Bunnefeld et al. 2017) is also important. This means monitoring the effectiveness of implemented solutions and adjusting them as needed.\\n\\n\\n\\n\"}" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rag_chain.invoke({\"input\": \"We live in a suburban area and bears sometimes come into our town to eat from our fruit trees and trash. What are the best ways for us to prevent this as a community? We don’t want to have to get rid of our fruit trees…\"})" ] }, { "cell_type": "code", "execution_count": 16, "id": "ba272b88-1622-4d06-9361-7f1e2ca89e73", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'input': 'What cattle husbandry strategies might be helpful to prevent conflict if we live in wolf country?',\n", " 'context': [Document(id='50b6a82e-13e1-4e8f-8a0a-5e7cd8a1ad50', metadata={'producer': 'PyPDF', 'creator': 'Elsevier', 'creationdate': '2022-06-07T02:40:21+00:00', 'author': 'Charlotte Lorand', 'crossmarkdomains[1]': 'elsevier.com', 'crossmarkdomains[2]': 'sciencedirect.com', 'crossmarkdomainexclusive': 'true', 'crossmarkmajorversiondate': '2010-04-23', 'elsevierwebpdfspecifications': '7.0', 'keywords': 'Human-carnivore coexistence; Lethal control; Non-lethal management; Conservation interventions; Effectiveness; Evidence-based', 'moddate': '2022-06-07T02:40:21+00:00', 'subject': 'Science of the Total Environment, 838 (2022) 156195. doi:10.1016/j.scitotenv.2022.156195', 'title': \"Effectiveness of interventions for managing human-large carnivore conflicts worldwide: Scare them off, don't remove them\", 'doi': '10.1016/j.scitotenv.2022.156195', 'robots': 'noindex', 'source': 'hwc/Lorand et al. 2022.pdf', 'total_pages': 11, 'page': 9, 'page_label': '10'}, page_content='J. Ornithol. 152 (2), 359–364. https://doi.org/10.1007/s10336-010-0593-x.\\nLeather, S.R., 2018.“Ecological Armageddon”– more evidence for the drastic decline in in-\\nsect numbers. Ann. Appl. Biol. 172 (1), 1–3. https://doi.org/10.1111/aab.12410.\\nLennox, R.J., Gallagher, A.J., Ritchie, E.G., Cooke, S.J., 2018. Evaluating the efficacy of pred-\\nator removal in a conflict-prone world. Biol. Conserv. 224 (February 2020), 277–289.\\nhttps://doi.org/10.1016/j.biocon.2018.05.003.\\nLindsey, P.A., Roulet, P.A., Romañach, S.S., 2007. Economic and conservation significance of\\nthe trophy hunting industry in sub-Saharan Africa. Biol. Conserv. 134 (4), 455–469.\\nhttps://doi.org/10.1016/j.biocon.2006.09.005.\\nLinnell, J.D.C., Aanes, R., Swenson, J.E., Odden, J., Smith, M.E., 1997. Translocations of car-\\nnivores as a method for managing problem animals: a review. Biodiversity and Conserva-\\ntion. Vol. 6, Issue 9. Kluwer Academic Publishers, pp. 1245–1257. https://doi.org/10.\\n1023/B:BIOC.0000034011.05412.cd.\\nMarker, L.L., Dickman, A.J., Macdonald, D.W., Marker, L.L., Dickman, A.J., Macdonald, D.W.,\\n2015. Society for Range Management Perceived Effectiveness of Livestock-Guarding\\nDogs Placed on Namibian Farms. 58(4), pp. 329–336.\\nMarris, E., 2014. Rethinking predators: legend of the wolf. Nature 507 (7491), 158–160.\\nhttps://doi.org/10.1038/507158a.\\nMason, J.R., Shivik, J.A., Fall, M.W., 2001.Chemical repellents and other aversive strategies\\nin predation management. Endangered Species UPDATE. 18(April), pp. 175–181.\\nC. Lorand et al. Science of the Total Environment 838 (2022) 156195\\n10'),\n", " Document(id='fe0221d8-2339-48d6-8334-56649677c3d0', metadata={'producer': 'PDF Architect 3', 'creator': 'PDF Architect 3', 'creationdate': '2017-01-25T14:50:41+00:00', 'author': 'V. Pimenta', 'moddate': '2017-01-25T14:52:31+00:00', 'source': 'hwc/Pimenta et al. 2017.pdf', 'total_pages': 20, 'page': 8, 'page_label': '9'}, page_content=\"Convention on the Conservation of European Wildlife and Natural HabitatsNature\\nand Environment Series 113. Council of Europe, Strasbourg.\\nBoitani, L., Ciucci, P., Raganella-Pelliccioni, E., 2010.Ex-post compensation payments for\\nwolf predation on livestock in Italy: a tool for conservation? Wildl. Res. 37, 722–730.\\nBradley, E.H., Pletscher, D.H., 2005.Assessing factors related to wolf depredation of cattle\\nin fenced pastures in Montana and Idaho. Wildl. Soc. Bull. 33, 1256–1265.\\nBreck, S.W., Meier, T., 2004.Managing wolf depredation in the United States: past, pres-\\nent, and future. Sheep Goat Res. J. 19 (Special Issue: Predation), 41–46.\\nBurnham, K.P., Anderson, D.R., 2002.Model Selection and Multimodel Inference. A Practi-\\ncal Information-Theoretic Approach. Springer-Verlag.\\nCade, B.S., 2015.Model averaging and muddled multimodel inferences. Ecology 96,\\n2370–2382.\\nChapron, G., Kaczensky, P., Linnell, J.D., von Arx, M., Huber, D., Andrén, H., ... Boitani, L.,\\n2014. Recovery of large carnivores in Europe's modern human-dominated land-\\nscapes. Science 346, 1517–1519.\\nDevelopment Core Team, R., 2016. R: A Language and Environment for Statistical Com-\\nputing. R Foundation for Statistical Computing.http://www.r-project.org(accessed\\n22.05.16).\\nDickman, A.J., 2010.Complexities of conflict: the importance of considering social factors\\nfor effectively resolving human–wildlife conflict. Anim. Conserv. 13, 458–466.\\nDickman, A.J., Macdonald, E.A., Macdonald, D.W., 2011.Ar e v i e wo ffinancial instruments\\nto pay for predator conservation and encourage human-carnivore coexistence. Proc.\\nNatl. Acad. Sci. U. S. A. 108, 13937–13944.\\nDixon, J., Gulliver, A., Gibbon, D., 2001.Farming Systems and Poverty: Improving Farmers'\\nLivelihoods in a Changing World. FAO and World Bank, Rome and Washington DC.\\nDondina, O., Meriggi, A., Dagradi, V., Perversi, M., Milanesi, P., 2015.Wolf predation on\\nl\\nivestock in an area of northern Italy and prediction of damage risk. Ethol. Ecol.\\nEvol. 27, 200–219.\\nGazzola, A., Capitani, C., Mattioli, L., Apollonio, M., 2008.Livestock damage and wolf pres-\\nence. J. Zool. 274, 261–269.\\nGehring, T.M., VerCauteren, K.C., Provost, M.L., Cellar, A.C., 2010.Utility of livestock-pro-\\ntection dogs for deterring wildlife from cattle farms. Wildl. Res. 37, 715–721.\\nIEA, 2008. LIFE Project COEX– Improving Coexistence of Large Carnivores and Agriculture\\nin S-Europe (LIFE 04NAT/IT/000144). Final Technical Report. Istituto di Ecologia\\nApplicata Available from.http://www.medwolf.eu(accessed 01.03.2016).\\nIEA, 2014. LIFE Project MED-WOLF– Best Practice Actions for Wolf Conservation in Med-\\niterranean-type Areas (LIFE11 NAT/IT/069). Progress Report. Istituto di Ecologia\\nApplicata Available from.http://www.life-coex.eu(accessed 01.03.2016).\\nIGP, 2009. CORINE Land Cover 2006 Map for Continental Portugal (v0).Available from.\\nhttp://www.dgterritorio.pt(accessed 01.03.2016).\\nIliopoulos, Y., Sgardelis, S., Koutis, V., Savaris, D., 2009.Wolf depredation on livestock in\\ncentral Greece. Acta Theriol. 54, 11–22.\\nImbert, C., Caniglia, R., Fabbri, E., Milanesi, P., Randi, E., Serafini, M., ... Meriggi, A., 2016.\\nWhy do wolves eat livestock?: factors influencing wolf diet in northern Italy. Biol.\\nConserv. 195, 156–168.\\nINE, 2011a. Censos 2011. Instituto Nacional de Estatística, Portugal Available from.http://\\nwww.ine.pt (accessed 10.01.2013).\\nINE, 2011b. Recenseamento Agrícola 2009. Instituto Nacional de Estatística, Portugal\\nAvailable from.http://www.ine.pt(accessed 15.05.2013).\\nINE, 2016. Dados estatísticos. Instituto Nacional de Estatística, Portugal Available from.\\nhttp://www.ine.pt(01.05.2016).\\nKaczensky, P., Chapron, G., Von Arx, M., Huber, D., Andrén, H., Linnell, J.D. (Eds.), 2013.\\nStatus, Management and Distribution of Large Carnivores— Bear, Lynx, Wolf &\\nWolverine—In Europe. Prepared for the European Commission. IUCN/SSC Large Car-\\nnivore Initiative for Europe Available from http://www.lcie.org/Publications\\n(accessed 01.02.2016).\\nKaufman, L., Rousseeuw, P.J., 1990.Finding Groups in Data: An Introduction to Cluster\\nAnalysis. Wiley, New York.\\nKöbrich, C., Rehman, T., Khan, M., 2003.Typification of farming systems for constructing\\nrepresentative farm models: two illustrations of the application of multi-variate anal-\\nyses in Chile and Pakistan. Agric. Syst. 76, 141–157.\\nLagos, L., Bárcena, F., 2015.EU sanitary regulation on livestock disposal: implications for\\nthe diet of wolves. Environ. Manag. 56, 890–902.\\nLegendre, P., Legendre, L., 1998.Numerical Ecology, Second English Edition. Elsevier,\\nAmsterdam.\\nLi, X., Buzzard, P., Chen, Y., Jiang, X., 2013.Patterns of livestock predation by carnivores:\\nhuman-wildlife con flict in Northwest Yunnan, China. Environ. Manag. 52,\\n1334–1340.\\nLinnell, J.D., Odden, J., Mertens, A., 2012.Mitigation methods for conflicts associated with\\ncarnivore depredation on livestock. In: Boitani, L., Powell, R.A. (Eds.), Carnivore Ecol-\"),\n", " Document(id='7d9539a1-b389-4682-a201-ec21f174dcc5', metadata={'producer': 'PDFlib+PDI 8.0.2p1 (C++/Win64); modified using iTextSharp™ 5.5.3 ©2000-2014 iText Group NV (AGPL-version)', 'creator': 'Arbortext Advanced Print Publisher 11.0.2857/W Unicode-x64', 'creationdate': '2018-01-10T21:11:13+05:30', 'title': 'Effectiveness of a LED flashlight technique in reducing livestock depredation by lions (Panthera leo) around Nairobi National Park, Kenya', 'eps_processor': 'PStill version 1.76.22', 'moddate': '2018-01-10T21:12:24+05:30', 'author': \"Francis Lesilau, Myrthe Fonck, Maria Gatta, Charles Musyoki, Maarten van 't Zelfde, Gerard A. Persoon, Kees C. J. M. Musters, Geert R. de Snoo, Hans H. de Iongh\", 'source': 'hwc/Lesilau et al. 2018.pdf', 'total_pages': 18, 'page': 11, 'page_label': '12'}, page_content='radio, fire and noise) were significant in predation prevention (see S1 Table).Herd size did not\\naffect nocturnal predation of shoats (Kruskal test, χ\\n2\\n= 21.76, p-value = 0.7) and cattle (χ\\n2\\n25,\\np-value = 0.6) (see S1 Table).\\nWhen respondents were asked an open question on what they believed should be done to\\nresolve human-lion conflicts around NNP, (Appendix I, question 13), most respondents\\n(92%) had one or more suggestions (S3 Table): “flashlight installation” and “some form of\\ncompensation” were by far the most mentioned suggestions, followed by measures that would\\nprevent lions from roaming outside the park boundaries. Although “fencing the park” was\\nsometimes mentioned, 62% of the respondents did not believe that complete fencing of the\\npark would resolve the human-lion conflict. Suggestions further included measures that could\\nrapidly detect and relocate freely roaming lions back to the park, which according to some will\\nbecome even more important when the announced plans for the construction of a railway\\nthrough NNP (in the northern area) will eventually take effect.\\nFig 7. Yearly mean distance of boma attack from the park boundary since the introduc tion of the flashlight technique\\nsouth of NNP.\\nhttps://doi. org/10.1371/j ournal.pone .0190898.g00 7\\nLED flashlight technique in reducing livestoc k depredation by Lions (Panthera leo)\\nPLOS ONE | https://doi.or g/10.137 1/journal.po ne.01908 98 January 31, 2018 12 / 18'),\n", " Document(id='3ae39ad2-8a67-40d4-9f52-06225def840c', metadata={'producer': 'PDF Architect 3', 'creator': 'PDF Architect 3', 'creationdate': '2017-01-25T14:50:41+00:00', 'author': 'V. Pimenta', 'moddate': '2017-01-25T14:52:31+00:00', 'source': 'hwc/Pimenta et al. 2017.pdf', 'total_pages': 20, 'page': 12, 'page_label': '13'}, page_content='3 \\n \\nVariable Variable Type Description (n) Justificat ion \\nDistance of usual \\nsummer pastures to \\nmain shelter \\nOrdinal 1 – < 1 km (n= 14) \\n2 – 1-5 km (n= 37) \\n3 - > 5 km (n= 17) \\nUse of pastures farther from \\nshelter was expected to \\nincrease exposure to wolf \\nattacks. \\nDistance of usual \\nwinter pastures to \\nmain shelter \\nOrdinal 1 – < 1 km (n= 32) \\n2 – 1-5 km (n= 31) \\n3 - > 5 km (n= 5) \\nNumber of \\nmonths/year with \\nextensive grazing \\na \\nBinary asymmetric 1 – 12 (n=61) \\n2 – < 12 (n=7) \\nExtensive grazing year around \\nwas expected to increase \\nexposure to wolf attacks. \\nPresence of shepherd \\nin Summer \\na \\n \\nOrdinal 1 – no (n=63) \\n2 – temporary (n=4) \\n3 – permanent (n=1) \\nHerds guarded by shepherds \\nwere expected to be less \\nvulnerable to wolf predation \\nPresence of shepherd \\nin Winter \\na \\nOrdinal 1 – no (n=60) \\n2 – temporary (n=3) \\n3 – permanent (n=5) \\nPresence of livestock \\nguarding dog \\na \\nBinary asymmetric 0 – no (n=60) \\n1 – yes (n=8) \\nHerds guarded by livestock \\nguarding dog were expected \\nto be less vulnerable to wolf \\npredation \\nBirth periods b Categorical A - All year around (n=50) \\nB - (All year around but) \\nmore frequent in \\nSpring/Summer (n=14) \\nC - (All year around but) \\nmore frequent in \\nAutumn/Winter (n=4) \\nHerds with birth periods not \\ncontrolled were expected to \\nbe more vulnerable to wolf \\npredation given the higher \\nvulnerability of new born \\ncalves. \\nCarcasses collected by \\ngovernmental sanitary \\nagency \\nb \\nBinary asymmetric 0 – not always (n=14) \\n1 – always (n=54) \\nLeaving carcasses in the field \\nwas expected to increase \\npredation risk as these can \\nserve as an attractant for \\nwolves \\na The variable was excluded from statistical analysis because of little variation. \\nb The variable was excluded because answers to these questions were perceived to be unreliable.')],\n", " 'answer': 'Based on the provided texts, several cattle husbandry strategies may help prevent wolf conflict. Having a permanent shepherd present, especially during winter, can reduce vulnerability to predation (Linnell, Odden, & Mertens, 2012). Additionally, utilizing livestock guarding dogs is expected to deter wildlife from cattle farms (Gehring, VerCauteren, & Provost, 2010; Marker et al., 2015). Collecting carcasses promptly by a governmental sanitary agency can also reduce predation risk by removing attractants for wolves.'}" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "prompt = \"What cattle husbandry strategies might be helpful to prevent conflict if we live in wolf country?\"\n", "\n", "rag_chain.invoke({\"input\": prompt})" ] } ], "metadata": { "kernelspec": { "display_name": "base", "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.12.10" } }, "nbformat": 4, "nbformat_minor": 5 }