from Guide to Skillshare

AI for Beginners - Build a Custom ChatGPT in 3 Steps

Hello there! Welcome to the resources page for the Skillshare course Build a Custom ChatGPT in 3 steps. Here you'll find completed code for the course and additional resources. For each lesson, follow these steps:

  1. Watch the corresponding lesson first. If you would like to take notes, see the Slides. The "Summary" slide contains the main takeaway, which you can start from for note-taking.
  2. Review the text summary. You should understand what the summary means, but you don't need to memorize it. Summaries here ae made to just jog your memory.
  3. See additional resources. Each lesson below comes with everything you need to reproduce the results in the video lesson: the prompts I used, the code I'm starting from, the calculations I did etc.

« About the Teacher: Alvin

Introduction

Before beginning the course, I would highly recommend taking the following courses of mine:

1 - Scope Project: Text to Text

  • Watch the corresponding video lesson "Scope Project: Text-to-Text".
  • Read summary: The overarching AI product can take many different kinds of inputs and produce all kinds of outputs, but the underlying Large Language Model takes text in and gives text out. For your first project, focus on text-to-text tasks for simplicity.
  • Learn more: How does an LLM access websites? The LLM issues a tool call, which accesses a webpage and extracts its contents. You can extract the contents of a webpage in the exact same way using this Colab notebook.
  • Learn more: Why is one image 2030 visual "words"? According to ViT, the image is broken up in 16x16 pixel patches, where each patch is then transformed into a visual "token", and for text at least, there are 1.6 tokens to each word. The image I used was 912x912 pixels, which would be broken up into a total of 57x57 = 3249 patches = 3249 tokens, which corresponds to 2030 visual "words".

1 - Scope Project: Capabilities

  • Watch the corresponding video lesson "Scope Project: Capabilities".
  • Read summary: Within the text-to-text domain, AI has seen commercial applications with several of its capabilities already — namely, summarizing, structuring data (converting unstructured text into structured formats like a table), and coding.

Reviews

For this prompt, I asked ChatGPT to summarize 10 bakery reviews. The reviews are fictional, as I wrote them from scratch.

https://chatgpt.com/share/689c1d81-84e8-800a-b326-7b3c89ce1a2a

Expand to see the original prompt, for reference.
Summarize these reviews in a few sentences.

The almond croissant looked gorgeous, but honestly, it was way too sweet for me. I'll stick to the plain butter croissant next time.

This place makes the flakiest butter croissants I've ever had. Didn't try the almond version yet, but I'm tempted.

The almond croissant here is perfection—crispy edges, soft middle, just the right sweetness. Worth the trip across town.

Tried the almond croissant because everyone raves about it. Beautiful to look at, but the filling was too dense for my taste.

Not a croissant person, but the cinnamon rolls here are out of this world.

Walked in for coffee, walked out with an almond croissant that blew my mind. I don't even usually like almonds!

I ordered an almond croissant with my latte. It was okay, but a bit dry—probably just an off day.

Skipped the almond croissant this time and went for their savory scone. No regrets.

The almond croissant was divine. Perfectly toasted almonds on top, and the filling was creamy without being overpowering.

I've tried the almond croissant twice now—once great, once a little stale. Still, I'll give it another chance.

Table

For this prompt, I asked ChatGPT to generate a table of almond-croissant-mentions based on the list of reviews I provided.

https://chatgpt.com/share/689c1d4b-1ac0-800a-9363-196880b1ab50.

Expand to see the original prompt, for reference.
Generate a table with three coulmns: the ID, whether the review mentioned the ALMOND croissant (ignore other croissant types and other pastries) and of those that mentioned almond croissants, label "True" if they liked it, "False" if not, and "n/a" if they did not mention almond croissants.

Not a croissant person, but the cinnamon rolls here are out of this world.

Walked in for coffee, walked out with an almond croissant that blew my mind. I don't even usually like almonds!

I ordered an almond croissant with my latte. It was okay, but a bit dry—probably just an off day.

Skipped the almond croissant this time and went for their savory scone. No regrets.

The almond croissant was divine. Perfectly toasted almonds on top, and the filling was creamy without being overpowering.
Expand to see the extra prompt that I used, to summarize as a percentage.
Of the reviewers that tried almond croissants, what percentage liked it? Return only a percentage. No other text.
Expand to see the final prompt that I used to generate a pie chart.
Make a pie chart showing reviewer sentiment towards almond croissants. Include those that liked it, those that didn't, and those that didn't try it. Include the code so I can reproduce.

1 - Scope Project: Task & Metric

  • Watch the corresponding video lesson "Scope Project: Task & Metric".
  • Read summary: For your project, define the task, the inputs, the outputs, and the metric. As an example, I defined the task to be "detect non-food critiques", the inputs to be "restaurant reviews," the outputs to be "True or False, whether or not the review deducts stars for non-food reasons", and the metric to be "model accuracy".

2 - Evaluate Models: Test the Best

  • Watch the corresponding video lesson "Evaluate Models: Test the Best".
  • Read summary: Test the most intelligent AI's ability to complete your task — which AI you use will depend on your ChatGPT subscription level. Test via the ChatGPT interface for ease-of-use, then via the API platform to ensure that your results are reproducible.

Prompt

For this prompt, I asked ChatGPT to complete our example project task, which is to detect reviews that deducted stars for non-food reasons.

https://chatgpt.com/share/689c324f-36c0-800a-8104-92de2a18adf1

Expand to see the original prompt, for reference.
For each of the reviews below, output just a single line True or False. Output True if the review deducted stars for a non-food reason. e.g., deducting stars for service, ambiance, experiences should all result in True. If the review did NOT deduct stars for a non-food reason -- either (a) no stars were deducted or (b) if the review deducted stars for food reasons, output False.

Here are 3 reviews. Please provide 3 lines of output. For each line, denote True or False, one boolean for each of the following reviews.

---
3 out of 5 stars
The food didn't come out in the order one would expect. The appetizers arrived after the entrees, which was disappointing.
---

---
5  out of 5 stars
I can't get enough of Arsicault, and neither can anyone I introduce Arsicault to! After Arsicault just once, my parents had to go back. Every. single. day. And I don't blame them. This place has virtually no wait, the pastries are exceptionally flaky, and the variety of flavors are all top notch. Pretty sure I've had most of the possible flavors -- if not all of them.

* Blueberry Hazelnut Almond, Almond: These are among my favorites. The almond paste is a bit too sweet, so I like to get a plain croissant alongside any of these. The blueberry variant is my absolute favorite. Such a delicious mixture of fruits and nuts. Gah. So good.

* Plain: You can't go wrong with the "vanilla" flavor at Arsicault. I always get this to remind myself how amazing their croissants are, even without any of the sugar. Just the butter. Just all the fat. Yummy yummy butter.

* Chocolate, Chocolate Almond: Not *too sweet, and a funny looking pillow shape instead of the typical croissant shape. Equally flaky and delicious.

* Ham and cheese: I gotta say, this is my least favorite. (sorry) But if I must, I will eat this if it's all that's left. Anything for a croissant -- even if it's ham and cheese!

Starting a block away, you'll start to smell the Arsicault pastries. Once you walk in, you'll see the massive ovens in the bake, the trays and trays of pastries, and very friendly staff members! I went back probably 3x in a single day, once. The staff instantly recognized me (oops). Can't wait for the next time already!
---

---
3 out of 5 stars
Came here on a Saturday afternoon right before dinner time, and it was mostly empty surprisingly. After a brief walk around the mall, Yayoi filled up pretty quickly afterwards though!

* I ordered chicken cutlet with egg. The portion was small, and the flavor was decent. The rice and the chicken were both slightly dry. There was some arugula and carrot shreds on top, to add some color to the dish. The egg and onion were cooked through.

Having just come back from Japan, perhaps my expectations are too high. However, it's worth mentioning staff were *exceptionally attentive and friendly. There were only a few other parties at the time, but waitstaff was constantly nearby to provide help. They kept our waters filled constantly, which I was super happy about (it was a hot day).
---

2 - Evaluate Models: Optimize Cost

  • Watch the corresponding video lesson "Evaluate Models: Optimize Cost".
  • Read summary: Test iteratively faster and cheaper models, until the model is no longer able to complete your task. Keep track of the cost of task completion, so you can compare intelligence per dollar across providers and options.
  • Learn more: Every API provider lists prices for input tokens and output tokens, like here OpenAI's API pricing. Usually, the price is per 1 million tokens. As a result, say you see GPT5 nano's price is $0.05 for input tokens and $0.40 for output tokens. Additionally, say your input was 100 tokens and your output was 200 tokens, then the cost can be calculated as $0.05 * 100 / 1000000 + $0.40 * 200 / 1000000 = $0.000085.

To calculate the cost of the OpenAI API calls, I used the following. You can verify the cost of GPT5 on the official OpenAI API pricing page and the number of tokens using the video lesson.

Model Reasoning # In # Out $ In $ Out $
GPT5 medium 693 267 $1.25 $10.00 $0.00353
GPT5-mini medium 693 267 $0.25 $2.00 $0.00071
GPT5-nano medium 693 779 $0.05 $0.40 $0.00034
GTP5-nano minimal 693 11 $0.05 $0.40 $0.00004
Here is me showing my work, if you'd like to check.
# GPT5 with "medium" reasoning
1.25 * 693 / 1000000 + 10 * 267 / 1000000 = 0.00353

# GPT5-mini with "medium" reasoning
0.25 * 693 / 1000000 + 2 * 267 / 1000000 = 0.00071

# GPT5-nano with "medium" reasoning
0.05 * 693 / 1000000 + 0.40 * 779 / 1000000 = 0.00034

# GPT5-nano with "minimal" reasoning
0.05 * 693 / 1000000 + 0.40 * 11 / 1000000 = 0.000039

2 - Evaluate Models: Open-Source

  • Watch the corresponding video lesson "Evaluate Models: Open-Source"
  • Read summary: As of today, APIs for state-of-the-art open-source models lag behind their proprietary counterparts in terms of intelligence per dollar. However, small open-source models that can run on your own machine can potentially be free to run, making them the most cost effective solution for one-off, individualized use cases.
  • Learn more: How did you conclude that a single GPU can fit at most 16 billion parameters? I had to make a few simplifying assumptions. First, I assumed that your GPU has 16 GB of VRAM. This is generally true of most modern laptops. Second, I assumed that your model has been quantized into 8 bits — in other words, every parameter in your model requires 1 byte. All told then, your GPU can hold 16 billion parameters, at most. However, your GPU could have more VRAM and your model could be quantized more aggressively, to fewer bits per parameter.
  • Learn more: Like mentioned before, every API provider lists prices per input and output tokens. Generally, the prices are listed per one million tokens. For open-source models, I estimated costs using Together AI's API pricing.

To calculate the cost of the open-source model's API calls, I used the following. For reasoning models, I assumed 693 tokens in — same as OpenAI's — and 200 tokens out. For non-reasoning models, I assumed 693 tokens in and 6 tokens out.

Model # In # Out $ In $ Out $
DeepSeek-R1 693 200 $3.00 $7.00 $0.0034
DeepSeek-R1-Llama-70B 693 200 $2.00 $2.00 $0.00170
DeepSeek-V3 693 6 $1.25 $1.25 $0.00084
Llama-3-70B 693 6 $0.88 $0.88 $0.00060
DeepSeek-R1-Qwen-1.5B 693 6 $0.18 $0.18 $0.00012

Demo - Open Source

  • Watch the corresponding video lesson "Demo: Run Open-Source".
  • Learn more: See the Chatbot Arena leaderboards for a widely-accepted ranking of AI quality. The authenticity of the results have been questioned before, but it's one of the best head-to-head comparisons we have.
  • Learn more: See the various open-source models we mentioned in the video lesson. Kimi K2 is currently the highest ranking open source model on the leaderboards but sees very low usage on HuggingFace. By contrast, Llama3.1 8B Instruct is one of the most downloaded model over the last 30 days. GPT-OSS-20B is shaping up to have even more downloads in its first 30 days after release.
  • Learn more: Professor Joseph E. Gonzalez from UC Berkeley does some napkin math, finding that its cheaper to actually call OpenAI APIs than to host equivalently-sized models on GPUs in the cloud, yourself. See the blog post, that OpenAI is too cheap to beat.

Demo

Click here to go to the demo for this course, which is hosted on Google Colab notebooks. This means you can run Large Language Models on GPUs for free: https://colab.research.google.com/drive/1q2YZVfai9MRZwSy1W8t78Yhvvm3N0P46.

3 - Refine Quality: Engineer Inputs

  • Watch the corresponding video lesson "Refine Quality: Engineer Inputs".
  • Read summary: One way to improve the quality of your Large Language Model's responses is to simplify modify the prompt. In your prompt, you should be specific, provide examples, and ask for chain-of-thought.
  • Learn more: There are a large variety of ways to improve the input to your Large Language Model. In fact, there's an entire Prompt Engineering Guide. Don't read the guide from cover to cover, but keep it around as a bag of tricks — to reference when you need another way to improve model quality without training. Outside of that guide, there were hilarious other prompt hacking techniques that AI Twitter was able to find: Promise payment, tell the AI its IQ, or warn AI that the fate of humanity depends on the correctness of its answer.

3 - Refine Quality: Constrain Outputs

  • Watch the corresponding video lesson "Refine Quality: Constrain Outputs".
  • Read summary: Another way to improve the quality of your Large Language Model's responses is to constrain its output format. You can force a particular schema on the output, allowing downstream code to easily parse and use the LLM's outputs.
  • Learn more: To constrain the outputs of our open-source model on Colab notebook, I use a library called guidance, which effectively allows you to specify constraints using regex.

Constrained

Use the following JSON schema to constrain your OpenAI API call's outputs. You should be able to save the JSON schema successfully. If you see an error, double check that you copy and pasted the fully JSON below.

{
  "name": "boolean_response",
  "strict": true,
  "schema": {
    "type": "object",
    "properties": {
      "value1": {
        "type": "boolean"
      },
      "value2": {
        "type": "boolean"
      },
      "value3": {
        "type": "boolean"
      }
    },
    "additionalProperties": false,
    "required": [
      "value1",
      "value2",
      "value3"
    ]
  }
}

Conclusion

Congratulations on making it to the end of the course, as usual! You've now seen how to get started with AI — taking the necessary first steps to understanding how existing AI performs on your task, and even improving AI's abilities to complete your task, without any training.

back to Guide to Skillshare