Accessing the Google Pathways LLM from a Bash Script

De-Initialize

The final phase of the script is finalization or de-initialize (Listing 3). This is the simplest part of the Bash script. A final completion message is reported to the user and logged to the log file. After that, the script exits with a clean return code to the invoking command-line shell.

Listing 3

De-Initialize

01 echo "All done! Exiting...Have a nice day!" | tee -a $log_file
02
03 exit 0

Examples of Use

Once the author had written the Bash shell script for the PaLM shell, several prompts were given to the PaLM LLM RESTful API. This was to play with the Google Pathways LLM and also to test the PaLM shell as a Bash script. These prompts and responses were logged into an external file.

Starting the script is simple enough because there are no command-line parameters (Figure 1). You invoke the script in its directory. Once invoked, the script reports the version, copyright, and license. The script then reports the name of the session log file.

Figure 1: Starting the PaLMShell.bash script.

It is a simple text file that uses the date and time to create a unique name. The user then writes the various prompts to communicate with the Gemini API (Figure 2). The system logs all prompts and responses to the session log file.

Figure 2: Entering a prompt to the PaLMShell.bash script.

When done, the user uses the PaLM shell script command bye to quit (Figure 3).

Figure 3: Exiting the PaLMShell.bash script.

The script prints a closing message and returns to the terminal.

After the script exits, the user can then access the transcript of the session in the log file (Figure 4).

Figure 4: Working with the session log file.

The log file is a simple text file. The user can choose their favorite utility, such as bat, cat, head, nano, tail, etc., to access it.

Example: 1980s Economics Theories

To test drive the script, I tried it out on a couple of prompts related to 1980s economics. I entered the questions using the PaLM shell script, and the responses were automatically logged to an external file.

Prompt: What is Reaganomics in economic thinking?

"Reaganomics is a set of economic policies advocated by US President Ronald Reagan during the 1980s. These policies included tax cuts, deregulation, and increases in defense spending. Reaganomics is often associated with supply-side economics, an economic theory that argues that tax cuts and deregulation will increase economic growth by encouraging businesses to invest and create jobs.

Reaganomics was a major departure from the economic policies of the previous administration, which had focused on Keynesian economics, an economic theory that argues that government spending can be used to stimulate the economy during recessions. Reaganomics was based on the belief that the free market was the best way to promote economic growth and that government intervention in the economy was harmful.

The effects of Reaganomics are still debated today. Some economists argue that it led to a strong economic recovery, while others argue that it widened the gap between the rich and the poor."

Prompt: What is Thatcherism in economics?

Thatcherism is a political and economic ideology that was associated with the policies of British Prime Minister Margaret Thatcher in the 1980s. Thatcherism is often characterized by its emphasis on free market capitalism, privatization, deregulation, and reducing the size of the state.

Economically, Thatcherism is based on the belief that the free market is the best way to allocate resources and promote economic growth. Thatcherism advocates reducing the role of the state in the economy and allowing businesses to operate more freely. Thatcherism also supports privatization, which is the process of selling state-owned assets to private investors.

In the UK, Thatcherism was credited with helping to bring about an economic recovery from the 1970s recession. However, it also led to an increase in inequality and unemployment.

Some of the key policies associated with Thatcherism include:

* Privatization of state-owned industries

* Deregulation of the financial sector

* Reductions in government spending

* Tax cuts for businesses and the wealthy

* Tougher policies on trade unions

Thatcherism has had a lasting impact on British politics and economics. It is often seen as a turning point in the UK's relationship with the state and the free market.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News