HSV-AI / presentations

This repository is used to manage the presentations given at Huntsville AI meetups. It provides a collection of Issues, Cards, and Files to plan and create the content needed for a presentation.
16 stars 6 forks source link

6/26/2024 - RAG Prompt Engineering #43

Open jperiodlangley opened 1 year ago

jperiodlangley commented 1 year ago

Complete the following items to get a presentation ready for Huntsville AI

Adding material to the presentations repository

Add the file to present (prefer Jupyter Notebooks or Markdown formated files) to the folder structure. For multiple files, create a directory following the naming convention and add the files to it.

Naming convention

We use a convention of starting the filenames with a date (year/month/day) so that the files are still sorted by date even when in alphabetical format.

YYMMDD_Session_Description.extension

jperiodlangley commented 2 months ago

This seems like a really good resource - https://www.promptingguide.ai/models/mistral-7b

jperiodlangley commented 1 week ago

Description

If you have ever tried to prompt an LLM to give you what you want, you have probably run into some frustrating challenges. This can range from trying to write what you want in pseudo-code to arguing with a child about putting their toys away.

This week we will focus on some guidelines for building successful prompts for a RAG system. There is a lot of art and craft associated, and the answer to most questions is "it depends". To help understand this better, we will pull back the curtain about and talk about WHY certain prompts are effective and what types of situations they may apply to.

I am learning more about this subject every day, so if you have prior experience or tips that I should include - please reply and I'll add them to the talk.

jperiodlangley commented 1 week ago

RAG-Prompts

jperiodlangley commented 1 week ago

I need a long example of a RAG prompt that includes context and instructs the LLM to cite references in bracket notation.

Here's an example of a RAG prompt that includes context and instructs the LLM to cite references using bracket notation:

CONTEXT: [1] The Eiffel Tower, constructed in 1889, stands 324 meters tall and was designed by Gustave Eiffel. It was built as the entrance arch for the 1889 World's Fair in Paris. [2] The tower's construction took 2 years, 2 months, and 5 days, involving 300 workers and 2.5 million rivets. It was the world's tallest man-made structure until 1930. [3] Initially criticized by some of France's leading artists and intellectuals, the Eiffel Tower has become a global cultural icon of France and one of the most recognizable structures in the world. [4] The tower receives about 7 million visitors annually, making it the most-visited paid monument globally. It has three levels for visitors, with restaurants on the first and second levels.

QUESTION: Provide a brief history of the Eiffel Tower, including its construction, initial reception, and current status as a tourist attraction.

INSTRUCTIONS:

  1. Answer the question using ONLY the information provided in the CONTEXT above.
  2. Cite your sources using bracketed numbers at the end of relevant sentences, like this [1].
  3. If the answer to any part of the question is not in the CONTEXT, state that the information is not provided.
  4. Provide a concise, factual response without additional commentary.
  5. Do not use phrases like "According to the context" or "The provided information states." Simply present the facts with citations.

Answer:

Citations: [1] Prompt Engineering for RAG - LlamaIndex https://docs.llamaindex.ai/en/stable/examples/prompts/prompts_rag/ [2] How to get a RAG application to add citations - LangChain docs https://python.langchain.com/v0.2/docs/how_to/qa_citations/ [3] Langchain RAG with history and citations - python - Stack Overflow https://stackoverflow.com/questions/78411267/langchain-rag-with-history-and-citations [4] Prompt engineering for RAG - OpenAI Developer Forum https://community.openai.com/t/prompt-engineering-for-rag/621495 [5] Retrieval Augmented Generation (RAG) for LLMs https://www.promptingguide.ai/research/rag

jperiodlangley commented 1 week ago

Reference 1: According to the Intergovernmental Panel on Climate Change (IPCC) 2021 report, climate change is expected to reduce crop yields significantly due to increased temperatures, changes in precipitation patterns, and more frequent extreme weather events (IPCC, 2021).

Reference 2: A study published in Nature in 2020 highlights that regions like Sub-Saharan Africa and South Asia are particularly vulnerable to climate change impacts on agriculture, potentially leading to food insecurity (Smith et al., 2020).

Reference 3: The Food and Agriculture Organization (FAO) states that climate change will exacerbate existing challenges in agricultural productivity and food security, with smallholder farmers being the most affected (FAO, 2019).

Reference 4: Research by the United States Department of Agriculture (USDA) indicates that rising CO2 levels can have both positive and negative effects on crop growth, but the overall impact is expected to be negative due to the associated changes in climate (USDA, 2020).

Reference 5: The Journal of Agricultural and Environmental Ethics published an article in 2021 discussing the ethical implications of climate change on agriculture, emphasizing the need for adaptive strategies to support vulnerable populations (Brown et al., 2021).

Reference 6: According to a report by the World Bank, investment in climate-resilient agricultural practices is crucial to mitigate the adverse effects of climate change on food production (World Bank, 2021).

Reference 7: A 2018 report from the National Aeronautics and Space Administration (NASA) discusses how satellite data is being used to monitor the effects of climate change on agricultural land and to inform policy decisions (NASA, 2018).

Reference 8: An article in Global Environmental Change (2019) highlights that traditional agricultural practices and knowledge can play a vital role in adapting to climate change (Jones et al., 2019).

Question: Based on the above references, how is climate change expected to impact global agriculture, and what measures can be taken to mitigate these effects?