ML Two
Lecture 09
π€NLP 103 the finale: Embed ChatGPT (and other OpenAI AI models) in your Appπ
Welcome π©βπ€π§βπ€π¨βπ€
First of all, don't forget to confirm your attendence on
Seats App!
After today's lecture:
-- A "ChatGPT-powered" APP built on your phone
-- Knowing how to incorporate ANY OpenAI model in your future Apps (via the magic named "API")
Recap on last two weeks of NLP series π€
Basic NLP tasks
--- Language identification
--- Named Entity Recognition
--- Part-of-speech tagging
--- Lemmatization
--- Tokennization
Higher-level NLP tasks
--- Sentiment analysis
An emoji summerising up previous NLP models: πΆ
Today we are going to interact with Large Language Model (e.g. GPT models by OpenAI)!
The evolution pathway of ChatGPT π£οΈ
-- architecture improvement:
the "T" in GPT: transformer (attention mechanism)
-- upscaled data:
570GB of data obtained from various sources
-- upscaled model:
175 Billion parameters
-- upscaled computation resource:
~10,000 GPUs
etc.
Let's bring this gem into our phone (any ios app actually).
Example App code
here
referenced from
this article
βWe are not copying pasting the large language models themselves into our phone (check how large they are).
πInstead we will use OpenAI APIs to communicate with large language models stored on their servers.
To be able to use Open APIs, we need "API key"ποΈ.
API key ???
π Reading session (VERY IMPORTANT)
-- 1. Have a read on the OpenAI API document
here
-- 2. Have a read on how to get an OpenAI API key
here
Just a quick quiz: what's the model name for speech recognition?
π Hands-on session
1. Generate a new OpenAI API key
here .
2. Paste that into the codeοΌ"OpenAIConnector" file -> Line 18 let openAIKey = ""
3. Build the App. (you need to comment out line 17)
me demo π
To incorporate this to any other app:
1. Check the last section from this
article
2. See how the example code generates request(input) and handles response(output), both in JSON
A little exercise: how to turn this app into an auto-summary app?
- that is to,
π² input a paragraph to be summarised,
π click a button,
π output a summary of that paragraph!
But the response is slow π₯²:
-- There are
other language models that are faster!
-- check the timeout parameter in line 94 from OpenAIConnector.
π
Today we talked about:
1. OpenAI APIs and how to get your API key.
2. Example of embedding OpenAI models into your APP via the API.
We'll see you next week same time same place! π«‘