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.
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.
When done, the user uses the PaLM shell script command bye
to quit (Figure 3).
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).
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.
« Previous 1 2 3 4 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
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.
News
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.
-
Plasma Desktop Will Soon Ask for Donations
The next iteration of Plasma has reached the soft feature freeze for the 6.2 version and includes a feature that could be divisive.
-
Linux Market Share Hits New High
For the first time, the Linux market share has reached a new high for desktops, and the trend looks like it will continue.
-
LibreOffice 24.8 Delivers New Features
LibreOffice is often considered the de facto standard office suite for the Linux operating system.
-
Deepin 23 Offers Wayland Support and New AI Tool
Deepin has been considered one of the most beautiful desktop operating systems for a long time and the arrival of version 23 has bolstered that reputation.
-
CachyOS Adds Support for System76's COSMIC Desktop
The August 2024 release of CachyOS includes support for the COSMIC desktop as well as some important bits for video.
-
Linux Foundation Adopts OMI to Foster Ethical LLMs
The Open Model Initiative hopes to create community LLMs that rival proprietary models but avoid restrictive licensing that limits usage.
-
Ubuntu 24.10 to Include the Latest Linux Kernel
Ubuntu users have grown accustomed to their favorite distribution shipping with a kernel that's not quite as up-to-date as other distros but that changes with 24.10.
-
Plasma Desktop 6.1.4 Release Includes Improvements and Bug Fixes
The latest release from the KDE team improves the KWin window and composite managers and plenty of fixes.
-
Manjaro Team Tests Immutable Version of its Arch-Based Distribution
If you're a fan of immutable operating systems, you'll be thrilled to know that the Manjaro team is working on an immutable spin that is now available for testing.