slides
slides
CHATGPT FOR
WEB
DEVELOPERS
MAXIMILIANO FIRTMAN
MAXIMILIANO FIRTMAN
MOBILE+WEB DEVELOPER
HTML since 1996
JavaScript since 1998
AUTHOR
Authored 13 books and +70 courses
Published +150 webapps
@FIRT﹒FIRT.DEV
3
ChatGPT
ChatGPT is a large language
model designed to generate
human-like responses to
natural language input, using
the GPT architecture.
ChatGPT
ChatGPT is a computer
program that can understand
and respond to written text
like a human would.
ChatGPT
is like a talking robot that can
talk with us by reading what
we write and answering us in a
way that sounds like a person
talking
7
I'm not here to tell you
ChatGPT will replace all
web developers
:-)
So, what we going to talk
about?
What we'll cover
Machine Learning
Deep Learning
Generative
Pre-trained Transformer
GPT
Azure OpenAI
Bing Chat ChatGPT APIs
APIs
Microsoft OpenAI
fi
Arti
Machine Learning
Deep Learning
Generative
Pre-trained Transformer
GPT
Azure OpenAI
Bing Chat ChatGPT APIs
APIs
Microsoft OpenAI
fi
Arti
Machine Learning
Deep Learning
Generative
Pre-trained Transformer
GPT
Azure OpenAI
Bing Chat ChatGPT APIs
APIs
plugins
Microsoft OpenAI
fi
Large Language Models
can be used for several
tasks without changing or
training models
Token
Sequence of characters or
subwords that the model uses
as the basic unit of processing
and understanding natural
language text.
PROMPT RESULT
GPT
PROMPT RESULT
tokens tokens
GPT
• OpenAI will charge our credit card
Tokens and based on the amount of tokens
OpenAI we've used
• It applies to the prompt and the
output
• We can narrow the output defining
the maximum tokens we accept
• Approximately 3 to 6 letters per
token
• ChatGPT or GPT 3.5
OpenAI US$2 / 1 million tokens
models • GPT 4
30x to 60x more expensive
Higher token window
Better for code and complex tasks
• GPT 4 image and prompt (future)
• InstructGPT models
• Image models
• Audio models
• Not the same as having a ChatGPT
OpenAI account
account • Free to sign in
• Phone number verification
• Free credits of USD5 for 3 months
(once per phone number)
• Rate limits
• GPT 3.5, 3500 RPM
• GPT 4, 200 RPM
Requests submitted to
OpenAI API will not be
used to train or improve
future models.
OpenAI GPT 3.5 and 4
models' training data cuts
off in 2021, so they may not
have knowledge of current
events.
IA and Web Development
What can we do with GPT as web developers
Your Plugin
GPT
API
ChatGPT Plugin Manifest
You have to host the file in
yourdomain.com/.well-known/ai-plugin.json
{
"schema_version": "v1",
"name_for_human": "Frontend Masters Plugin",
"name_for_model": "Frontend Masters Plugin for ",
"description_for_human": "You can get information for web developers",
"description_for_model": "Search on video courses for information about languages and libraries",
"auth": { "type": "none"},
"api": {
"type": "openapi",
"url": "https: domain.com/openapi.yaml",
"is_user_authenticated": false
},
"logo_url": "https: frontendmasters.com/logo.png",
"contact_email": "[email protected]",
"legal_info_url": "http: .example.com/legal"
}
/
/
/
/
/
/
w
w
w
ChatGPT Endpoint description
You need to describe your service in a YAML file
openapi: 3.0.1
servers:
- url: http: api.frontendmasters.com
paths:
/videos:
get:
operationId: getVideos
summary: Get the list of videos at frontendmasters
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/getVideos'
components:
schemas:
getVideos:
type: object
properties:
/
/
• ChatGPT can browse the web,
Browser similar to how Bing Chat works
Plugin • It honors robots.txt
• The keyword for the User Agent is
ChatGPT-User
• SEO for AI, AIO?: You don't need to
do anything in special
•
• Prompt Injection from websites:
Security and See greshake.github.io for a sample
Prompt • We need to be careful with our own
Injection calls if we
• Integrate GPT data into our system
• Run actions based on GPT
responses
• We iterate responses with GPT
• Always validate format and intention
before acting
Never store your key in a
public place and control
who and how they access
your services using OpenAI
Prompt Engineering
Prompt Engineering
Process of designing and
refining prompts or inputs for
language models like GPT to
generate desired outputs or
responses.
Engineering or Hacking?
The more explicit and large
the prompt, more accurate
the results we can get from
GPT.
PROMPT RESULT
GPT
• We want consistent and
Prompt deterministics outputs
Engineering • Sometimes we need the output in
for specific formats for processing
Developers • We are paying for the API so we
need to reduce abuse
• We want to validate that user
generated content that goes into
the prompt is valid
• We want to stop prompt injection
LLMs can hallucinate,
making facts and
presenting them in a very
convincing way.
To reduce hallucination,
follow some basic rules for
prompting and use always
temperature=0
• Write specific and clear instructions
Basic Rules
• For large task you can provide the
model a list of steps you want it to
make to "think" about the problem
• Also, for large tasks you can make
several GPT calls, step by step, always
providing the previous context as if
you are "thinking" with it
• Use an iterative process to find the
right prompt for what you are
expecting
• Use delimiters for dynamic data
Specific and
• Tags as in XML
Clear
Instructions • ```
• """
• ---
• Explain to the model the delimiter
you are using
• Ask for data in a structured format
Specific and you want (JSON, HTML, CSV, or any
Clear string format you need)
USER'S
PROMPT OUTPUT
Your App
Prompt as Prompt
Embedding Prompt
+ Slice
Slice of
Embedding Output
relevant info
Embeddings GPT
Vector DB
OPEN AI
Langchain
Framework for developing
applications powered by
LLM
• Python and JS libraries
Langchain • It's multi-vendor
• Prompt Tools: templates, output
parsers,e tc.
• Indexes: document loaders, vector stores,
text splitters, etc.
• Memory: state between calls
• Chains: interface to connect different AI
calls
• Agents: making decisions on actions to
take, take the action and observe for it
for control
What we've covered