Accessing the Google Pathways LLM from a Bash Script

Future Work

The PaLM shell currently accesses the Google Pathways LLM via a RESTful API. In the future, it might be possible to integrate other language models with the script. Another possibility is to transcompile the PaLM shell to C source code by using the shc Bash script to C programming language transpiler [10], and then using native code on the bare-metal PaLM shell. Transpiling to C source code, then compiling to a binary executable program, hides the PaLM API key for the user.

The PaLM shell script was developed on macOS but can run on Linux. A port to the Windows Linux subsystem is another possibility for future work.

Conclusion

Large language models are the newest thing, bringing machine learning with massive neural networks to the masses and the mainstream. Yet to learn and understand an LLM, a user needs to be able to tinker, play, and explore what an LLM can do.

The Google Pathways LLM, or PaLM, puts the LLM within reach over a RESTful API with an API key, which makes access very simple and expedient for a user. However, the tarball of source code is somewhat complex, convoluted, and unwieldy. The PaLM shell is a simple Bash script that illustrates how to access the advanced technology of a large language model with existing and well-known software tools.

Infos

  1. "PaLM API Overview | Generative AI for Developers," Google, September 2023: https://developers.generativeai.google/guide/palm_api_overview/
  2. "An Introduction to Large Language Models," by Phani Kiran, Open Source For You, volume 11, issue 12, October 2023, pp 66-68
  3. "What Is ChatGPT Doing and Why Does It Work?" by Stephen Wolfram: https://writings.stephenwolfram.com/2023/02/what-is-chatgpt-doing-and-why-does-it-work/
  4. "Prompt Engineering Complete Guide," by Fareed Khan: https://medium.com/@fareedkhandev/prompt-engineering-complete-guide-2968776f0431
  5. "Friday Essay: Secrets of the Delphic Oracle and How It Speaks to Us Today," by Julia Kindt, The Conversation: https://theconversation.com/friday-essay-secrets-of-the-delphic-oracle-and-how-it-speaks-to-us-today-61738
  6. Llama 2: https://ai.meta.com/llama/
  7. Le Scao, T., Fan, A., et al. "BLOOM: A 176B-Parameter Open-Access Multilingual Language Model." BigScience Workshop: https://arxiv.org/pdf/2211.05100.pdf
  8. Chowdhery, A., Narang, S., et al. "PaLM: Scaling Language Modeling with Pathways." Google Research: https://arxiv.org/pdf/2204.02311.pdf
  9. Read-Eval-Print Loop: https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop
  10. "Compiling Bash Shell Scripts," by Karsten Günther, Linux Magazine, issue 161, April 2014: https://www.linux-magazine.com/Issues/2014/161/SHC-Bash-Script-Compiler

The Author

William F. Gilreath is a senior software engineer, computer scientist, and writer. He describes himself as a writer of code, equations, and poems and a lover of cats. Find more about him online at https://www.wfgilreath.xyz.

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