Getting Started with Generative AI

About this guide

This guide is intended to help get you started using generative AI at UVA. It is intended to be a brief introduction for the curious. If you're looking for a comprehensive introduction to Generative AI, the UVA Library has prepared an excellent LibGuide on the topic. (Read the "What is Generative AI?" LibGuide.)

In this guide we primarily explore UVA's officially supported GenAI, Microsoft Copilot. We will also look at OpenAI's ChatGPT-4o, which is freely available. (Both AIs are using the same system "under the hood".)

For additional information about AI at UVA, we encourage you to visit the following sites:

Foundational Ideas

While this is mostly a "nuts and bolts" guide to getting started, we are building upon these foundational ideas of how to use generative AI:

There always needs to be a "human in the loop" 

AIs are not replacements for humans. They are trustworthy on some topics, but much less trustworthy on others. We need to verify the information they give.

Generative AI is not a web search

While the AIs can search the web and include results, they are mostly drawing on information they have "read" (billions and billions of words, e.g. all of wikipedia) They generate a new response every time instead of giving a list of relevant links.

You are conversing with the AI, not just asking it questions

You may have heard of "prompt engineering" or "prompt writing" -- these are tips and tricks to getting good responses, but there is no "magic prompt" Instead you need to imagine your interaction as a conversation, and do as you would when conversing:

  • Ask for clarification
  • Ask to explain at different levels of expertise and technicality
  • Ask for different metaphors
We are all participating in the discovery of AIs
  • There is no instruction manual, and "experts" are only a few steps ahead of the rest of us
  • The people who built the AIs understand how they were trained, but can't anticipate what the AIs will say
  • By experimenting with AIs, you are helping to discover and understand them

Data privacy and copyright concerns

Please be aware that, by default, these platforms collect any information you give them to help them improve their language model. UVA is considering options to provide access to Gen AI tools with attention to data privacy concerns. (Read more from the Provost's Office here: Guidance for faculty and students about the appropriate uses of this technology in teaching and learning)

You can individually opt out of giving ChatGPT your data by following these directions: How do I turn off chat history and model training?

You should not give the AIs any student data, your personal data, nor copyrighted material.

Other ethical concerns

AI and job threat

The time of the Ford Model T was not a great time for those in the horse and buggy industry. This is not a perfect analogy for GenAI, since AIs potentially affect every profession in some way. We all need to be mindful and attentive of ways to use GenAI to improve living conditions, not just improve shareholder value for GenAI companies. 

AI and resource use

GenAIs use significant amounts of electricity and water. A good approximation is that asking a GenAI for a solution is about five times as "expensive" as a web search. It takes some practice and intuition to know when a GenAI will be "worth" five web searches to get better information.  

AI and personal trust

As we all start to use GenAI, there is a possibility that personal trust will erode if we suspect we are not talking to another person, but to a bot that person has set up (or used to write an email, for example). It will be important to use GenAI mindfully and err on the side of disclosure.

AI and creative theft

GenAIs have been trained by gobbling up information on the internet indiscriminately. This means they are able to copy the style of any human whose work is publicly available in any form on the internet. It is an open debate (with many active lawsuits) whether the GenAI companies had the right to do this. As users we must endeavor not to use AIs to create forgeries.

AI and the AI apocalypse

GenAIs are startling in how much they seem like science fiction. In a large percentage of science fiction, human reliance on AIs doesn't end well. We must endeavor to collectively put guard rails on the use of AI so as to not leave important ethical decisions up to algorithms. 

AI and bias

AIs are trained on human creations. Humans have biases. AIs therefore also have biases. We must be aware of these biases and not trust AIs as impartial or objective.

AIs at a glance + using AI at UVA

While there are hundreds of different AIs, we have limited the scope of this document to two AIs: UVA's official AI partnership with Microsoft via Copilot, and ChatGPT-4o, which uses a similar system

Cost: these are all free.

NOTE: This information is accurate as of 5-21-2024. We encourage you to seek out news regarding new and improving AIs, as the technology is changing rapidly. 

Text / Code Generators at a Glance

 

Model Description Account Information
OpenAI ChatGPT 3.5 The original ChatGPT-- now obsolete  
OpenAI ChatGPT 4o The newest ChatGPT-- free to use Create an account on OpenAI.com (NOTE: you will need a unique cell phone number to register an account)
Microsoft Copilot Copilot uses a Microsoft "flavored" version of ChatGPT

Log in via Netbadge here.

You can also log in directly via https://copilot.microsoft.com

Image Generators at a Glance
 
Model Description Account Information
OpenAI Dall-E 3 The image generator used by ChatGPT Connected to your ChatGPT account
Microsoft Copilot Image Generation Same as Dall-E 3, but Microsoft "flavored" You get 15 image generations a day with your UVA Microsoft account
Google Imagen Google's answer to Dall-E Sign up using an existing gmail account or create a new one
Midjourney A image generation AI available only through Discord, requiring a subscription. We only recommend Midjourney to the very curious, as it is a bit more complicated to use. Those who would like to try should follow the guide on this page: https://docs.midjourney.com/

Prompts for Interacting with Text Generation AIs

A prompt consists of the information you provide to an AI to guide its response. Think of it as an entry point to a conversation with AI. There is no wrong way to interact with a generative text AI; we encourage you to experiment and see what it does. 

NOTE: we are using ChatGPT 4 for these prompts, but we encourage you to try these out with each tool to see how they compare.

Giving the AI a role

Here we tell the AI what role it will have, what language to use, and the style we would like. In this case we are asking it to be a tutor, which might be a way students might use the tool. 

a screenshot of ChatGPT acting as a math tutor
ME: You are my math tutor. Please speak in language that would be understandable to a first year college student. I prefer brevity.

ChatGPT: Sure, I'm happy to help with your math questions. What do you need help with?

ME: Could you explain the difference between derivation and integration?

ChatGPT: Absolutely! Derivation and integration are two fundamental operations in calculus.

1. Derivation: It's all about finding the rate at which a function is changing. When you derive a function, you get its derivative, which tells you the slope of the function at any given point. In simple terms, it answers the question, "How steep is this curve?"

2. Integration: Think of it as the reverse of derivation. It's about finding the area under the curve of a function. If you integrate a function, you get another function that will tell you how much area is accumulated up to any point.

Derivation breaks things down, while integration puts things together. Would you like to dive into any of these concepts more?
 

 

Continuing the conversation...

Digging Deeper

Here we ask ChatGPT to explain further. As noted in the Foundational Idea at the start of this document (You are conversing with the AI, not just asking it questions), we are not looking for a "magic prompt", but instead conversing naturally as we might with a human tutor.

a screenshot of ChatGPT acting as a math tutor
ME: When might I use integration in a math or physics process?

ChatGPT: Integration comes in handy in various real-world applications, especially in math and physics. Here are a few examples:

1. **Area under a Curve**: Whenever you need to find the area bounded by a curve, you use integration.

2. **Distance, Velocity, and Acceleration**: If you know the velocity of an object and want to find out how far it traveled, you'd integrate the velocity function to get distance.

3. **Electrical Engineering**: In circuit analysis, you might use integration to find quantities like charge or voltage over time.

4. **Probability**: Integration is used in calculating probabilities in continuous distributions.

5. **Physics**: It's often used in equations related to motion, energy, and waves. For example, you might use integration to find the center of mass of an object or to solve equations in quantum mechanics.

6. **Thermodynamics**: Calculating work done in processes like isothermal expansion of gases involves integration.

7. **Fluid Dynamics**: Integration helps to find properties like flow rate and pressure distribution in fluids.

8. **Economics**: Calculating consumer and producer surplus, or finding the Gini coefficient also use integration.

So, integration isn't just a theoretical concept; it has practical applications in many fields. Would you like to know more about any specific application?

... and deeper

a screenshot of ChatGPT acting as a math tutor
ME: Could you give a concrete example of using integration to find voltage over time?

Certainly! In electrical engineering, you often encounter capacitors, which store and release electrical energy. The relationship between the voltage \( V(t) \) across a capacitor and the current \( i(t) \) flowing into it is given by:

\[
i(t) = C \frac{dV(t)}{dt}
\]

Where \( C \) is the capacitance of the capacitor.

Suppose you're given a constant current \( i(t) = 2 \) A (amperes) and a capacitor with capacitance \( C = 1 \) F (farad), and you want to find the voltage across the capacitor as a function of time \( t \).

First, let's rearrange the equation to isolate \( \frac{dV(t)}{dt} \):

\[
\frac{dV(t)}{dt} = \frac{i(t)}{C}
\]
\[
\frac{dV(t)}{dt} = \frac{2}{1} = 2
\]

Now, to find \( V(t) \), you'd integrate \( \frac{dV(t)}{dt} \):

\[
\int \frac{dV(t)}{dt} dt = \int 2 dt
\]
\[
V(t) = 2t + C_1
\]

\( C_1 \) is the constant of integration and would be determined by the initial voltage across the capacitor at \( t = 0 \). If it starts at 0 volts, \( C_1 = 0 \), and \( V(t) = 2t \).

So, the voltage across the capacitor would be \( 2t \) volts at any time \( t \).

This is a simple example, but it illustrates how integration can be used to find voltage over time when dealing with capacitors.

Too deep!

a screenshot of ChatGPT acting as a math tutor
ME: whoa whoa whoa, too much math! Could you explain the thinking here without using equations?

Of course! My apologies for the heavy math.

So, imagine you have a capacitor, which is like a small battery that can store and release energy. We know two things:

1. The rate at which current is flowing into the capacitor.
2. The "storage capacity" of the capacitor, also known as capacitance.

We want to find out how the voltage across the capacitor changes over time.

In simple terms, integration here is like adding up all the small changes in voltage over time. Since the current is constant, it means that the voltage keeps going up at a steady rate.

Think of it like filling a water tank with a hose. The current is like the rate of water flow, and the voltage is like the water level. If you know how fast you're filling it (the rate of water flow or the current), you can figure out how full the tank will be (the water level or the voltage) at any given time.

So, by using integration, we can find out how the voltage changes over time. In our example, the voltage would keep increasing at a steady rate as time goes on.

Hope that clears things up a bit!

You can see that the AI keeps track of its responses, and can adjust based on your requests. While this example uses math concepts, we encourage you to try with concepts specific to your discipline.

Generating ideas

Here we ask for paper topics that could help guide the design of an assignment for a philosophy class. AIs can be useful brainstorming tools to quickly generate lists of ideas and topics, which might be useful in-and-of themselves, or might spark a different idea. 

a screenshot of ChatGPT generating philosophy paper topics
ME: Could you give me ten topics for a philosophy paper about free will and AI?

ChatGPT: Certainly! Here are ten topics that delve into the intersection of free will and artificial intelligence, each exploring unique questions and challenges:

1. **Determinism vs. Free Will: The AI Paradox**  
   - An examination of whether AI, which operates on deterministic algorithms, can ever possess free will.

2. **The Illusion of Free Will: AI and Human Cognition**  
   - A comparison of how humans perceive their own free will versus the decision-making processes in AI systems.

3. **Ethical Implications of AI with "Free Will"**  
   - Investigate the ethical considerations if artificial intelligence were to ever achieve a form of free will.

4. **AI and Moral Responsibility**  
   - Should AI systems be held accountable for their actions if they are programmed to make autonomous decisions?

5. **The Role of Randomness in AI and Free Will**  
   - Analyze whether introducing randomness into algorithms could serve as a form of free will for AI systems.

6. **Consciousness and Free Will: Requirements for Sentient AI**  
   - What cognitive and conscious features would an AI need to possess in order to have free will?

7. **The Limits of Programming: Can Free Will be Coded?**  
   - A technical discussion on the limitations of current programming paradigms in capturing the essence of free will.

8. **Human Influence on AI Decision-Making: A Hindrance to AI Free Will?**  
   - Explore how human involvement in training and programming AI impacts the possibility of AI free will.

9. **Societal Impact of Free-Willed AI**  
   - Assess what societal changes we could expect if AI were to possess free will, both positive and negative.

10. **Philosophical Parallels: Historical Views on Free Will and their Application to AI**  
    - A review of traditional philosophical arguments about free will and how they can be applied to the AI debate.

These topics offer a range of angles from ethical considerations to technical challenges, suitable for various types of research and discussion. Feel free to adapt them as you see fit for your needs.

 

Reformatting text

Generative text AIs can help with common reformatting tasks. For instance, here we asked it to give us Billy Joel's "We Didn't Start the Fire" as a bulleted list.

a screenshot of ChatGPT analyzing song lyrics
a screenshot of ChatGPT analyzing song lyrics and encountering a copyright error
ME: can you make this into a bulleted list? Harry Truman, Doris Day Red China, Johnnie Ray South Pacific Walter Winchell, Joe DiMaggio Joe McCarthy, Richard Nixon Studebaker, Television North Korea, South Korea Marilyn Monroe Rosenbergs, H-Bomb Sugar Ray, Panmunjom Brando, The King And I, And The Catcher In The Rye Eisenhower, Vaccine England's got a new queen Marciano, Liberace Santayana goodbye

ChatGPT: Certainly! Here's the text as a bulleted list:

- Harry Truman
- Doris Day
- Red China
- Johnnie Ray
- South Pacific
- Walter Winchell
- Joe DiMaggio
- Joe McCarthy
- Richard Nixon
- Studebaker
- Television
- North Korea
- South

This content may violate our content policy or terms of use. If you believe this to be in error, please submit your feedback — your input will aid our research in this area.

Interestingly, it realized about halfway through that it was dealing with copyrighted material, and stopped. One could argue whether or not reformatting the lyrics into a bulleted list qualifies as a copyright violation, but ChatGPT wants to operate cautiously.

Creative prompts: writing a sonnet about math

AIs can mimic various creative forms. While not immediately practical, the AIs can help give a fresh perspective on a concept via experimental prompts.

sonnet about integration
ME: could you write me a sonnet about integration?

ChatGPT: Certainly, here's a sonnet about integration, written in the traditional Shakespearean style:

In math, the curve that dances high and low,
A tale of space and boundless rates to tell,
By calculus, we seek to truly know,
Its secret language we must learn so well.

Integration takes the stage with grace,
A sum of parts, it seeks to unify,
From A to B, it scans the open space,
And sums it up beneath the endless sky.

Yet more it means in hearts and minds of men,
Inclusiveness, a goal we strive to keep,
From different walks, we come to blend again,
A greater whole from parts once thought so cheap.

So let us find the sum of all our parts,
And integrate the wisdom in our hearts.

I hope you enjoy the sonnet! Would you like to know more about the topic or its relation to higher education?
Where AIs fail

AIs will confidently answer questions wrong. Note how ChatGPT 3.5 answers this question:

a screenshot of ChatGPT making a mistake
ME: how many letter Rs are in the word mayonaise?

ChatGPT: There are two letter "Rs" in the word "mayonnaise."
 

However, often these "hallucinations" will often be fixed in the next version (ChatGPT 4.0):

a screenshot of ChatGPT making a mistake
ME: how many letter Rs are in the word mayonaise?

ChatGPT: The word "mayonnaise" contains zero instances of the letter "R".
FAQs on text generation AI 

Is Generative AI the same as a web search?

A web search returns existing pages and text related to the search. Generative AI is trained on many of these existing texts (such as all of Wikipedia), but it generates its answers "fresh" every time. 

Will Generative AI always give the same answer to a prompt?

"Under the hood" AI tools have a randomness parameter. Right now users are only able to access it via the tool's API (for programmers). In common usage, the randomness is always set to the max value so that each response seems original. 


Prompts for Interacting with Image Generation AIs

AI image generators can generate an image of just about anything you can imagine. In the same way that one must have a "conversation" with the text generator AIs, one needs to refine and tweak the images to get precisely what you want. It can definitely take some practice.

Each AI has a slightly different way of accessing its image generator features, which we have listed in the "How To" sections below as well.

NOTE: we are using Dall-E 3 for these images. We encourage you to try the prompts out on various tools.

Prompt example: a photo chair shaped like an avacado

This is considered one of the "classic" tasks given to early AI image generators. The AIs are trained on millions of images of chairs and millions of images of avacados; they attempt to blend both ideas in the generated image.

a screenshot of an image of a chair shaped like an avacado generated by Dall-E 3 AI
ME: A photo of a chair shaped like an avacado

ChatGPT: Here are the images of chairs inspired by avocados. Each one showcases a different setting and design approach. Please let me know if any of these resonate with you or if you'd like further modifications or information.

 

Refining the prompt: remove the pit and add a cat

We can continue to refine the prompt thusly:

a screenshot of an image of a chair shaped like an avacado with a cat in it generated by Dall-E 3 AI
ME: please remove the pit pillow from image three and add a cat sleeping there instead

ChatGPT: Here's the modified image with the avocado chair in a modern living room setting, sans the seed cushion. Instead, you'll see a relaxed cat comfortably sleeping in its place. I hope this meets your requirements! Let me know if there's anything else I can assist you with.

You'll notice that it "thinks" it removed the seed, but did not. Therefore we need to prompt it again. My hunch is that it didn't "know" how to position the cat inside the chair, so it kept the seed by default. We'll try to fix this problem by giving it an alternative.

Of course now it got rid of the cat, so we must add it back in...

a screenshot of an image of a chair shaped like an avacado with a cat and a pink pillow in it generated by Dall-E 3 AI
ME: remove the brown seed and replace it with a pink pillow

ChatGPT: I've made the modification as requested. The avocado chair now features a soft pink pillow in place of the seed, providing a lovely contrast to the green. I hope this is to your liking! If there's anything else you'd like to adjust or any other questions, please let me know.
Prompt example: Thomas Jefferson and Tony Bennett

Image generator AIs can do more than photos. Here is an image created by student Sean McGanahan (Class of '24), including how he wrote the prompts.

cartoon of thomas jefferson and tony bennett in front of rotunda

 

I wanted to make an anime-inspired image of Thomas Jefferson and Tony Bennett smiling together in front of the rotunda. 

Initially, I was getting very boring looking images 

I added the “chibi” keyword and many adjectives to further push that. “Cute”, “Adorable” “Sweet” 

I asked it to add bright and vibrant colors 

I told it to have Tony Bennet and Thomas Jefferson hugging

It knew he was the basketball coach but honestly it doesn’t look anything like him(oh well close enough) 

How to: Dall-E 2
  1. Login or create an account at https://labs.openai.com
  2. Type in the image you'd like to create (e.g. "a photo of a chair shaped like an avacado")
  3. You have 15 free credits, and must purchase more.
How to: Dall-E 3
  1. Login or create an account at https://labs.openai.com
  2. Subscribe to ChatGPT 4 ($20 / month)
  3. Start a New Chat with ChatGPT, and select Dall-E from the dropdown menu thusly:
      how to select Dall-E 3
  4. Type in the image you'd like to create (e.g. "a photo of a chair shaped like an avacado")
How to: Bing with Image Creator
  1. Login or create a personal Microsoft account (NOTE: your UVA Microsoft account will not work)
  2. Open https://bing.com and click on the blue "Chat" icon at the top of the page

    A screenshot of the Bing homepage showing the blue Chat icon
  3. Ask Bing to create an image for you (e.g. "generate a photo of a chair shaped like an avacado")
How to: Google Imagen
  1. Login or create a Google account
  2. Open https://google.com and click on the flask in the top right of the page.
    a screenshot of the google search page showing the google flask for experimental features
  3. Enable the option for "SGE: Show Generative AI in Search"
  4. Ask Google to create an image for you (e.g. "generate a photo of a chair shaped like an avacado")
How to: Midjourney

We only recommend Midjourney to the very curious, as it is a bit more complicated to use. Those who would like to try should follow the guide on this page: https://docs.midjourney.com/

Comparing the image generation AIs
  • DALL-E 2 via OpenAI.com

    • Generates images with a resolution of 256x256 pixels 

    • Images are less accurate, detailed, and realistic compared with DALL-E 3 

    • Available through OpenAI’s website with an OpenAI account 

  • DALL-E 3 via OpenAI.com

    • More accurate and realistic than DALL-E 2 and is integrated with ChatGPT 

    • Generates images with a resolution of 1024x1024 pixels

    • Can use the ChatGPT integration to brainstorm and refine your prompts and images 

    • Available through OpenAI’s website via an OpenAI account and a paid subscription to ChatGPT Plus ($20/month) 

  • DALL-E 3 via Bing Image Creator

    • Generates images through integration of DALL-E 3 with Bing’s search engine 

    • Generates images with a resolution of 512x512 pixels

    • Maximum of 10 generations per day and a watermark on the images. 

    • Available via Bing Image Creator which can be used with a Microsoft account 

  • Google Imagen

    • Generates images with a resolution of 512x512 pixels 

    • Avoids creating images of people (e.g. man, woman, human, etc.) 

    • Generates more photorealistic images 

  • Midjourney

    • Generates images from text descriptions, focusing on keywords rather than complete sentences. Can also generate images based on uploaded images and blend two or more images together to create a new image. 

    • Images are highly detailed and realistic, with less content restrictions than other tools 

    • Requires a paid account and is accessed through Discord

FAQs on image generation

New accordion content


Prompts for Interacting with Code, Data, and Document Analyzing AIs

AIs can also be used to analyze data using natural language prompts. We will be working with publicly available UVA enrollment data exported from this page: https://ira.virginia.edu/university-data-home/enrollment

NOTE: we are working with ChatGPT 4, but Claude can also work with certain kinds of data and documents

Working with data

First, start a new chat.

Click the "plus" sign to upload a file.

Ask ChatGPT to do anything with the data using a natural language prompt.

a screenshot of ChatGPT analyzing data
a screenshot of ChatGPT analyzing data
[uploaded Excel file]
ME: what is the combined number of Graduate and Undergraduate students in Nursing, Medicine, and Education combined?

ChatGPT: The data consists of three columns:

1. `School`: The name of the school or department.
2. `Undergraduate Students`: The number of undergraduate students in that school or department.
3. `Graduate Students`: The number of graduate students in that school or department.

To find the combined number of Graduate and Undergraduate students in Nursing, Medicine, and Education, I'll filter the data for these specific schools and then sum up the numbers.

The following are the enrollment numbers for the schools of Nursing, Medicine, and Education:

- **Education**: 
  - Undergraduate Students: 527
  - Graduate Students: 1223
- **Medicine**: 
  - Undergraduate Students: 0
  - Graduate Students: 610
- **Nursing**: 
  - Undergraduate Students: 484
  - Graduate Students: 268

### Summary:

- Total Undergraduate Students: 1,011
- Total Graduate Students: 2,101
- Combined Total: 3,112

Therefore, the combined number of Graduate and Undergraduate students in the schools of Nursing, Medicine, and Education is 3,112.

This is a trivial use, but shows how it can work. When working with much larger data sets this can become a more natural way to navigate the data. The prompt can be refined in the same way as we did with the text generation and image generation.

You will notice that ChatGPT gives you a "play by play" of what it is doing. You may click on "Show work" to see the Python code it is generating.

Writing code

ChatGPT can also help us write code. This can be useful to create code, and also to learn code.

a screenshot of ChatGPT writing Python code
ME: Please write Python code for selecting all strings with the letters "ete" from a list and storing them in another list

ChatGPT: The Python code successfully selected all strings containing the letters "ete" from the sample list and stored them in another list. Here's the code for your reference:

```python
# Sample list of strings
sample_list = ["complete", "delete", "pete", "element", "apple", "banana", "elephant"]

# Select strings containing the letters "ete"
selected_strings = [word for word in sample_list if "ete" in word]
```

The `selected_strings` list contains the following words: `['complete', 'delete', 'pete']`.

 

Summarizing a document

Using the same process as above, you can upload and work with text documents as well. 

NOTE: you should not upload any sensitive data

a screenshot of ChatGPT summarizing a document
[uploaded Word file]
ME: Please summarize this document

ChatGPT: The document is an outline for a guide titled "Getting Started with AI." The guide aims to provide a comprehensive introduction to the field of artificial intelligence, specifically focusing on Generative AI. The introduction offers a brief overview of the guide's objectives and emphasizes the importance of hands-on experience.

The document touches upon the definition and basic characteristics of Generative AI, mentioning that it is a subset of AI designed to create new content. It refers to algorithms that generate images, text, and music, and mentions models like ChatGPT that are trained on existing data to produce new content.

Would you like more details or have any specific questions about the document?

 

Creating HTML from text

Generative AIs can also help reformat text. It was used for this webpage, in fact, to transform a bulleted list into an HTML table. There were a few more iterations, but it was much quicker than doing the same work by hand.

a screenshot of ChatGPT generating HTML

 

FAQs on working with code, data, and documents

New accordion content

 

Still curious and want to chat?