TEXT
Match
-(\w+)(?:$|\?)
in
Clipboard

Matches
SCRIPTING
If
Matches
does not have any value
SCRIPTING
Show alert
Informational Message
SCRIPTING
Otherwise
TEXT
Get
Group At Index
1
in
Matches

Text
SCRIPTING
End If

If Result
TEXT
{
"Ask": {
"prefix": "",
"guide": "What's your question?",
"format": "text"
},
"Blog Post": {
"prefix": "You are an assistant helping draft a blog post. First, identify the language of the prompt. Then, draft a blog post in the identified language. The blog post should have an introduction, 3 topic paragraphs, and a conclusion.",
"guide": "What are you writing a blog post about?",
"format": "text"
},
"Essay": {
"prefix": "You are an assistant helping a user write an essay in a document about ",
"guide": "What are you writing an essay about?",
"format": "text"
},
"Job Description": {
"prefix": "You are an assistant helping to draft a job description for this role ",
"guide": "Which role is the job description for?",
"format": "text"
},
"Ideas": {
"prefix": "You are an assistant helping a user come up with ideas about ",
"guide": "What do you need ideas for?",
"format": "text"
},
"Meeting Adenda": {
"prefix": "You are an assistant helping to write a meeting agenda for a meeting about ",
"prompt": "What is the meeting about?",
"format": "text"
},
"Poem": {
"prefix": "You are an assistant helping to write a poem about ",
"guide": "What is the poem about?",
"format": "text"
},
"Press release": {
"prefix": "You are an assistant helping to write a press release about ",
"guide": "What is the press release about?",
"format": "text"
},
"Pros And Cons List": {
"prefix": "What are the pros and cons if I ",
"guide": "What are you considering doing?",
"format": "text"
},
"Recipe": {
"prefix": "Give me a recipe for ",
"guide": "What are you making?",
"format": "text"
},
"Recruitment Email": {
"prefix": "You are an assistant helping to write a recruitment email about ",
"guide": "What is the recruitment email about?",
"format": "text"
},
"Sales Email": {
"prefix": "You are an assistant helping to write a sales email about ",
"guide": "What is the sales email about?",
"format": "text"
},
"Script": {
"prefix": "You are an assistant helping to write a computer script that ",
"guide": "What should the script do?",
"format": "script"
},
"Social Media Post": {
"prefix": "You are an assistant helping to write a social media post about ",
"guide": "What is the social media post about?",
"format": "text"
},
"Tweet": {
"prefix": "You are an assistant helping to write a social media post that's less than 240 characters long, about ",
"guide": "What is the tweet about?",
"format": "text"
}
}

Text
SCRIPTING
Get dictionary from
Prompts Import

Dictionary
TEXT
{
"text-davinci-003": {
"limit (tokens)": 4000,
"price per token": 0.00002
},
"text-ada-001": {
"limit (tokens)": 2048,
"price per token": 0.0000004
}
}

Text
SCRIPTING
Get dictionary from
Models Import

Dictionary
TEXT
{
"-": "bullet point",
"*": "bullet point",
"•": "bullet point"
}

Text
SCRIPTING
Get dictionary from
Symbols Import

Dictionary
TEXT
abap
arduino
bash
basic
c
clojure
coffeescript
c++
c#
css
dart
diff
docker
elixir
elm
erlang
flow
fortran
f#
gherkin
glsl
go
graphql
groovy
haskell
html
java
javascript
json
julia
kotlin
latex
less
lisp
livescript
lua
makefile
markdown
markup
matlab
mermaid
nix
objective-c
ocaml
pascal
perl
php
plain text
powershell
prolog
protobuf
python
r
reason
ruby
rust
sass
scala
scheme
scss
shell
sql
swift
typescript
vb.net
verilog
vhdl
visual basic
webassembly
xml
yaml
java/c/c++/c#

Text
TEXT
Split
Text
by
New Lines

Split Text
SHORTCUTS
Run
Settings | GPT-3 x Notion

Shortcut Result
SCRIPTING
Get dictionary from
Shortcut Result

Dictionary
SCRIPTING
Get
Value
for
N API Key
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
N API Version
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
OA API Key
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
Include Request In Response?
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
model
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
temperature
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
echo
in
Settings

Dictionary Value
SCRIPTING
Get
Value
for
model
.limit (tokens)
in
Models

Dictionary Value
VARIABLES
Set variable
Prompt
to
Input
SCRIPTING
Repeat
10 times

Repeat Results
SCRIPTING
If
Chosen Prompt
has any value
SCRIPTING
Otherwise
SCRIPTING
Get
All Keys
in
All Prompts

Dictionary Value
FILES

Files
SCRIPTING
Choose from
Sorted Prompts
Prompt
Choose the type of request

Chosen Item
SCRIPTING
Get
Value
for
Chosen Prompt
.format
in
All Prompts

Dictionary Value
SCRIPTING
End If

If Result
SCRIPTING
If
Format
is
script
SCRIPTING
If
Language
has any value
SCRIPTING
Otherwise
SCRIPTING
Choose from
Code Languages

Chosen Item
SCRIPTING
End If

If Result
SCRIPTING
Otherwise
SCRIPTING
End If

If Result
SCRIPTING
Get
Value
for
Chosen Prompt
.guide
in
All Prompts

Dictionary Value
SCRIPTING
Ask
Guide
Default Answer
[{'class': 'magic', 'value': 'Request', 'glyph': 'assets/cat/Variable.svg', 'UUID': ''}]

Provided Input
VARIABLES
Set variable
Request
to
Request
SCRIPTING
Get
Value
for
Chosen Prompt
.prefix
in
All Prompts

Dictionary Value
SCRIPTING
If
Format
is
script
TEXT
Request
Language
in
Prefix

Text
VARIABLES
Set variable
Prompt
to
Text
SCRIPTING
Otherwise
TEXT
Request
Prefix

Text
VARIABLES
Set variable
Prompt
to
Text
SCRIPTING
End If

If Result
SCRIPTING
Count
Characters
in
Prompt

Count
MATHS
Model Tokens Limit
-
Prompt Length
Options Under Construction

Calculation Result
TEXT
{
"model": "
model
",
"max_tokens":
Max Tokens
,
"temperature":
temperature
,
"stream": false
}

Text
SCRIPTING
Get dictionary from
OpenAI Request JSON

Dictionary
SCRIPTING
Set
prompt
to
Prompt
in
Dictionary

Dictionary
NETWORK
Get contents of
https://api.openai.com/v1/completions
Options Under Construction

Contents of URL
SCRIPTING
Get
Value
for
error
in
Contents of URL

Dictionary Value
SCRIPTING
If
error
has any value
SCRIPTING
Get
Value
for
message
in
error

Dictionary Value
SCRIPTING
Show alert
Informational Message
SCRIPTING
Show alert
Informational Message
SCRIPTING
Otherwise
SCRIPTING
Get
Value
for
choices
in
Contents of URL

Dictionary Value
SCRIPTING
Get
First Item
from
Choices

Item from List
SCRIPTING
Get
Value
for
text
in
Item from List

Dictionary Value
DOCUMENTS
Replace
\A\?\n\n|\A\n\n
with
World
in
Text

Updated Text
SCRIPTING
Get
Value
for
usage.total_tokens
in
Contents of URL

Dictionary Value
SCRIPTING
Get
Value
for
model
.price per token
in
Models

Dictionary Value
MATHS
Price Per Token
×
Tokens Used
Options Under Construction

Calculation Result
TEXT
Cost
Cost: $
Formatted Text

Text
SCRIPTING
End If

If Result
SCRIPTING
SCRIPTING
Choose from Menu

Menu Result
SCRIPTING
Resubmit

Menu Result
COMMENT
Reruns the Shortcut automatically
SCRIPTING
Copy

Menu Result
SHARING
Copy
Formatted Text
to clipboard
SCRIPTING
Exit shortcut with
Result
SCRIPTING
Send To Notion

Menu Result
SCRIPTING
If
Include request in response?
is
<value>
TEXT
{
"object": "block",
"type": "heading_2",
"heading_2": {
"rich_text": [
{
"type": "text",
"text": {
"content": "
Request
"
}
}
]
}
},

Text
VARIABLES
Set variable
Prompt JSON
to
Text
SCRIPTING
Otherwise
SCRIPTING
End If

If Result
SCRIPTING
Get
Value
for
Chosen Prompt
.format
in
All Prompts

Dictionary Value
SCRIPTING
If
Format
is
script
DOCUMENTS
Replace
"
with
\"
in
Formatted Text

Updated Text
DOCUMENTS
Replace
\n
with
\\n
in
Text w. Escaped Speechmarks

Updated Text
TEXT
{
"object": "block",
"type": "code",
"code": {
"rich_text": [
{
"text": {
"content": "
Escaped Text
"
}
}
],
"language": "
Language
"
}
}

Text
VARIABLES
Set variable
Blocks JSON
to
Text
SCRIPTING
Otherwise
TEXT
Split
Text
by
New Lines

Split Text
SCRIPTING
Count
Items
in
Split Text

Count
SCRIPTING
Repeat with each item in
Split Text

Repeat Results
TEXT
,

Text
VARIABLES
Set variable
Appended Comma
to
Comma
SCRIPTING
If
Repeat Index 2
is less than
3
COMMENT
First 2 lines are always empty so don’t process them
NOTHING
Nothing