Prompt is a one time call to the LLM. You can use RAG with prompts but that does not get better and repeat itself for improvements. And most of us have to reprompt.
Something that improve the regular reprompting? Can we set a loop programitacially or via another prompt (yes a big set of instructions for Loop to work) itself by giving the end condition that must be satisfied to keep you satisfied with the results? Here comes the Loops ! And the mechanism to work with it is the Loop Engineering.
Let AI run the steps you tell it to execute. You can tell it what you want, how improvement of outputs are measures, and how to go to the next loop. You must tell it to improve. Rest it loops on its own with a while(true) and there must be an end state, to come out of loop, some success criterion or some number of iterations or some time frame.
Inside loops you can access tools with the help of Harness or you can just call in LLMs, choice is yours.
Know loops can take away your credits easily so be cautious to give right command this time a command not for a prompt but for a loop. But for an example such as Natural Calamaties, every dollar is worth savign lives for.
You can give the right loop command and this is the new norm rather than you prompting again and again for LLM to improve the results as per your requirements.
So, let me expain this with an example of Natual Calamaties alerts for managing safety of people around the world.
Prompt:
You can prompt by connecting APIs every hour, call or email the agencies involved every other hour.
You get the results from all sources by calling or mailing each hour.
But what if you ot struck in traffic and what if some Earthquake came within this one hour junction? And every hour human prompting can be tedious and sometimes mixed with human errors due to fatigue. Why not a repetitive prompt that improves itself with human supervision?
Here comes need of Loops.
Loop:
But what if we run a Loop for Natural Calamaties, and wait for 30 minutes updates from the Loop. The Loop steps executes, all you get is 30 minutes updates, if say a cyclone is on track you can get more frequent updates say 5 minutes updates. And for an earthquake alert you get 30 second updates localized and optimized for that area. With an end contition to improve and debug the Loop after 48 hours to checked and restarted. You need to set it up in your Loop the conditions.
So here are example of steps for a Loop for Natural Calamaties Alerts to be send around the world.
-i. Runs every half hour
–ii. Get the tools for climate apps and Earthquake APIs, several popular APIs for Weather Predictions, Extreme Heat, Various popular Weather Apps, Forest Fires ups and downs, El Nino variabilities, Predicitons Cloud Brusts, Volcanic Variabilities, Flash Floods Predictions, Hurricanes, Tsunami Warning, Cyclones, Tornadoes, Landslides Predictions and more. Collect all this data, lot of tools to connect to. Add RAG data of past Natural Calamaties Actions in the LLM to make LLM more aware of steps taken apart form news readings.
–iii. Analyze for severity of Natural Calamity with code, area, country, people effected, warning with contents, locations and durations.
–iv. Alert the system immediately if extreme condition. Predict preventive measures such as evacuations or helps from nearby states based on last such incidence.
–v. In case of Extreme or super Extreme condition run this Loops again in 1 minutes or 30 seconds time localized and optimized only for that area, so that responce time is less. The prompt should run it for localized area as prompt output processing time matters here as each life matter. Life matters every second counts. Add in email for non extreme but severe conditions. Action to be taken to be listed based on past actions logbooks.
–vi. Append all details and email to registered agencies.
-vii. Get input from states about actions taken, add this data to data of past Natural Calamaties and steps taken to improve this Natural Calamaties App. This includes the area near the incidence/epicenter that is effected, measures taken, time taken and more. This must be saved in seperate database or file for LLM to look into it as a RAG to improve future calamaties resuce missions.
–viii. End Condition/Break Command: Keep adding logs, so that humans/Loop can read logs if needed. End the Loop if asked after 48 hours, for improvements and debugging. #Till Loop improves.
– ix. Improve the Loop, For Eg. Forest Fires variability can be looked into with AI Drones.
-x. Repeat. Keep processing and sending instructions to humans, if situation not under contol and can be improved, else run every 30 minutes unless needed as above in case of super extreme calamity.
Once this is set we need to run it at just one place on Earth and messages are broadcasted around the world from there. Actions to be taken are listed to help humans deal with urgent situations. This makes it cost effective and worth making to save as many lives as possible.
This was a big Loop, generally Loops examples for beginners are simple, hello world, but I wanted to give a useful example, which could be understood as well as used for betterment of mankind on large.
