berryman
berryman
John Berryman
Hi! I'm John Berryman
career ● Aerospace Engineer (just long enough to get
1 the merit badge)
● Search Technology Consultant
career ● Eventbrite Search Engineer
2 ● Wrote a book. (Swore never to do so again.)
● GitHub Code Search
● GitHub Data Science
career ● GitHub Copilot Prompt Engineer
3
● Writing a book. (But why!?)
career
● LLM Application Consulting – Arcturus?
4
What is a Language Model? How has this
taking the
world by
storm?
What is a Large Language Model?
# IT Support Assistant
The following is a transcript
between an award
What if you winning
found this scrapIT
of
support rep and a customer.
paper on the ground?
## Customer:
My cable is out! And I'm going to
miss the Superbowl!
## Support
What do you Assistant:
think the rest of the
paper would say?
Prompt Crafting
Document
type is
technique #3: document mimicry It tells a story
transcript
to condition a
particular
# IT Support Assistant response.
The following is a transcript
between an award winning IT
It uses support rep and a customer.
markdown to
establish ## Customer:
structure My cable is out! And I'm going to
miss the Superbowl!
## Support Assistant:
Let's figure out how to diagnose
your problem…
Prompt Crafting Intuition: LLMs are Dumb Mechanical Humans.
● LLMs understand better when you use familiar language and constructs.
● LLMs get distracted. Don't fill the prompt with lots of "just in case"
information.
● LLMs aren't psychic. If information is neither in training or in the prompt,
then they don't know it.
● If you look at the prompt and you can't make sense of it, a LLMs is hopeless.
Building LLM Applications
The hard
part!
Creating the Prompt
● Collect context
● Rank context
● Trim context
● Assembling Prompt
Creating the Prompt: Copilot Code Completion
● Collect context – current document, open tabs, symbols, file path
● Rank context – file path → current document → open tabs → symbols
● Trim context – drop open tab snippets; truncate current document
● Assembling Prompt // pkg/skills/search.go
ath
// type Skill interface {
file p //
// }
Execute(data []byte) (refs, error)
// </end snippet>
ip p e t from
sn
package searchskill
tab
open import (
"context"
"encoding/json"
"fmt"
nt
curre ent
"strings"
m
"time"
docu )
type Skill struct {
█
r
curso
}
The Introduction of Chat benefits
API document ● Really easy for users to build
assistants.
messages = ○ System messages make
[{
<|im_start|>
# IT Support system
Assistant controlling behavior easy.
"role": "system"
The are
You following
an award
is a winning
transcript
IT ○ The assistant always
"content": "You are
betweenrep.
support an award
Help the
winning
user with
IT responds with an
an award winning
support
their request.<|im_stop|>
rep and a customer. complete thought and
support staff then stops.
representative that
<|im_start|>
## Customer:user ● Safety is baked in:
helps customers."
My cable is out! And I'm going to ○ Assistant will (almost)
},
miss the Superbowl!<|im_stop|>
Superbowl! never respond with
{"role": "user", insults or instructions to
"content":"My cable <|im_start|>
## Support Assistant:
assistant make bombs
is out! And I'm going Let's figure out how to diagnose ○ Assistant will (almost)
to miss the your problem… never hallucinate false
Superbowl!" information.
} ○ Prompt injection is
] (almost) impossible.
(ChatGPT Nov 30, 2022)
The Introduction of Tools ● Agents can reach out into
Input: the real world
{
"type": "function",
{"role": "user",
"content": "What's the weather
○ Read information
"function": { like in Miami?"} ○ Write information
"name": "get_weather",
"description": "Get the weather", Function Call: ● Model chooses to answer
"parameters": { {"role": "assistant", in text or run a tool
Tools can be called in
"type": "object", "function": {
"properties": { "name": "get_weather", ●
"location": { "arguments": '{ series or in parallel
"type": "string",
"description": "The city and state", }'}
"location": "Miami, FL"
● Tools can be interleaved
}, with user and assistant
"unit": { Real API request: text
"type": "string", curl
"description": "degrees Fahrenheithttp://weathernow.com/miami/FL?deg=f
or Celsius" {"temp": 78}
"enum": ["celsius", "fahrenheit"]},
}, Function Response:
"required": ["location"], { "role": "tool", Assistant Response:
}, "name": "get_weather",
},
{"role": "assistant",
"content": "78ºF"} "content": "It's a balmy 78ºF"}
} (function calling Jun 13, 2022)
Building LLM Applications
Building LLM Applications:
Bag of Tools Agent
functions:
● getTemp()
● setTemp(degreesF)