Thinking of AI, LLMs and Gen-AI

Like most folks on the planet right now, AIs have been one of my major areas of interest and attention; at least in the last two years. Yes, I caught on late. But it was not for want of trying. It was just that the first wave of AIs, were too low-level for me. The theoretical aspects of the courses run by Google and the University of Helsinki were accessible to me, but the maths blew me away completely. Now I wished I had paid more attention in maths class 🙂

Well, all is not lost, and as often happens in IT, the second wave, or should I say evolutionary kind of the technology abstracts away much of the complexity of the earlier kind. Yes, you lose access to a lot of the fine-grained controls, but hey, how many folks care about the difference between Transformers and the CNNs and RNN, or what about the algorithms used by AMAs for prompt reliability? Or this simple equation from LLM calibration q^=Softmax(Wp^+b)?

Have a good look at the headline image. Those three amigos are your friends in the world of AIs and human interfaces to that complex nether world. I program in quite a few languages, including Python, on the side, but I never quite paid attention to it until recently. If you want to work with AIs, Python is your easy way in. The ecosystem is extensive and with several layers of abstraction that make it easy for almost anyone to enter at a level that is comfortable and accessible.

The other two are Swiss-army knives in their own right. I will not waste time describing them, as you will find a plethora of material on them on the Internet. Suffice to say that LlamaIndex allows you to easily collect data (documents, APIs, SQL, etc.) and build an index. It relies on LangChain for the indexing. LangChain is like a workflow engine and connector that provides easy interfaces (facades) to the LLMs and other tools. Both are available as libraries in Python.

A big shout-out to Wenqi Glantz for an excellent intro that I was able to implement within a few minutes. I intend to modularise your solution by separating the indexing function and making it an event-driven daemon, since the Gradio interface only needs to know where the index is and not create it each time. Gradio is another Python library that makes it easy to create a web UI, in this case, for building a chatbot. Thanks also for Confluence example, it should be adaptable for JIRA as well; both of those have rather poor search/introspection facilities.

Honestly, we are at the point now where most folks, in the tech sector at least, should be able to understand and use AIs. The Python programming language is a great place to start, and though I have mentioned only three libraries today, there are several others out there, each providing simple interfaces to advanced capabilities. Now is a great time to get into AIs. The technology has moved on from white-coats and geeks. You still get to see and understand some of the fundamentals, before it is all hidden away in later generation services and solutions. Take the plunge; I am sure you will enjoy the journey, and there is so much to learn and explore!

ChatGPT Prompting for Architects and Executives

Introduction

In chapter six of Lewis Carroll’s “Alice’s Adventures in Wonderland,” under a section, titled “Pig and Pepper.”, the following dialogue plays out:

Alice: Would you tell me, please, which way I ought to go from here?
The Cheshire Cat: That depends a good deal on where you want to get to.
Alice: I don’t much care where.
The Cheshire Cat: Then it doesn’t matter which way you go.

There is a lesson here for interacting with emerging machine interfaces of Large Language Models (LLM) and Generative Artificial Intelligence (Gen-AI) like ChatGPT. The way we interact with computers has evolved dramatically in the last decade, to the point where one can begin to conceive of Alice’s conversation with the Cheshire cat. However, much as it was with the Cheshire cat, you still need to know where you want to go in order to benefit from directions.

Let’s imagine that you are looking for information about the topography of Berlin, Germany, and not the whole of Europe. Well, it helps to know that your target lies somewhere between Russia, the North Sea, the Mediterranean and Lebanon (context), since there is another Berlin in Ohio (US). It is useful to understand that the focus is geographical rather than political (role), that the message is in a form suited for delivery at the UN rather than the Republican conference (tone), and the format is as a speech rather than a manifesto (format). These foundations are effective for all ChatGPT interactions, whether you’re an IT architect navigating complex technical issues or a C-Suite executive seeking strategic insights.

There are many comprehensive blogs, articles, books and other materials you can read about writing effective prompts. I find that many are quite technical, and they cover details and scenarios that most folks will never need, in work, or everyday life. What I have done is to simplify things and give you the bare essentials. A simple formula that gives you the maximum revenue-to-investment ratio. The acronym CRAFT spells out: Context, Role, Action/question, Format and Tone. These are the fundamental components of every ChatGPT prompt. By applying these to your prompts, you will get much better results, and useful feedback for improving future prompts.

Context

Context is the backstory to your dialogue; it gives depth to your prompt. It provides the AI with the necessary background information to better understand your query fully. For example, if your question is about technology threats and trends, the prompt could start like this: “In the rapidly evolving tech industry, where startups are disrupting traditional players…”

Role

Here is the best way to think of the role. Think; in real life, who would I prefer to answer this question: a lawyer, plumber, dietician, legislator, soldier? The role instructs the machine on the overall nature and perspective of the response, including any inherent biases. For instance, if you’re a COO architect seeking technical insight, your prompt, continuing from the Context example above, might be of the form: “you are an experienced Cloud infrastructure expert, with several certifications and hands-on experience of Azure …”.

Action/Question

Instructions in a ChatGPT prompt are the most important component. They need to be clear, concise, and unambiguous. Brevity might be an asset here, the clearer your instructions, the more accurate and relevant the AI’s response. A compatible question to the example given in the Context could be: “what are the emerging cybersecurity threats for Azure IaaS in 2023?”

Format

This determines the presentation of the output/response of ChatGPT. It could be a detailed analysis, a concise summary, a table, bullet points, a step-by-step guide, or a combination of things? Use simple language to tell the AI how to deliver the information in a way that suits your purposes. Once again, using our example from the Context, the format could be: “a short summary with bullet points of the 5 most significant concerns”.

Tone

The tone of your prompt sets the mood for the conversation. If you were to advise the role how best to engage with the target audience; would it be technical, formal, humorous, conversational, expert, witness, informative, urgent, casual, professional, legalistic, etc. It could also be a combination, for example professional+humorous. Extending our Context example, the tone could be: “speaking with an informative tone”, since the COO does not intend to mask their unfamiliarity with the subject.

Extra Tips

  • Use simple and precise language; imagine that you are conversing with a 10-year-old Einstein.
  • Evolve the prompt, changing the keywords you use for tone and format, in order to get an output that suits your purpose.
  • Always leave the action/question till last, as it can help reduce verbosity and improve accuracy of the output.

Conclusion and Credits

In the ever-evolving landscape of AI, mastering the art of ChatGPT prompting is a skill that can elevate your interactions with technology. IT architects can it to seek solutions to complex technical challenges, while C-Suite executives can extract strategic insights for decision-making. From general technical information to specific market analysis and research, the applications are limitless. I am convinced that we are entering a new age of man-machine relationship, and those that learn and adapt will reap significant benefits in the future.


PS: I used an approach called “Generative Knowledge” to elicit an outline and the initial draft for this article. I had to refine the prompt a few times to get things right. The final LLM output benefited from some massaging, but all-in, it saved me a lot of time, and I hope that I managed to impart some useful information to you.