-
-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Use AI to explain code #2517
base: main
Are you sure you want to change the base?
✨ Use AI to explain code #2517
Conversation
Try this Pull Request!Open Julia and type: julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="openai-explain-this-code")
julia> using Pluto You need an OpenAI API key to run this PR unfortunately. Generate one, and then: julia> Pluto.run(_experimental_openai_key="your_key_here") |
"Authorization": `Bearer ${key}`, | ||
}, | ||
body: JSON.stringify({ | ||
model: "text-davinci-003", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use gpt-3.5-turbo
then that's cheaper and more accurate. The API call is slightly different because it's via the chat
endpoint, but it should work for now and also for the people who have GPT-4 access. Also, maybe allow people to set the endpoint because things are moving fast in OpenAI-land?
prompt: `\`\`\`\n${code}\n\`\`\`\n\n${ | ||
code.length > 100 ? "Summarize the the intent of" : "Explain" | ||
} this Julia code in a consise way. Use Markdown to highlight important concepts:\n1.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can now officially add prompt engineer to your resume 🚀
@@ -46,6 +46,7 @@ const PORT_HINT_DEFAULT = 1234 | |||
const LAUNCH_BROWSER_DEFAULT = true | |||
const DISMISS_UPDATE_NOTIFICATION_DEFAULT = false | |||
const SHOW_FILE_SYSTEM_DEFAULT = true | |||
const _EXPERIMENTAL_OPENAI_KEY_DEFAULT = nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the secret should be inserted in the browser and be kept in the browser storage? That saves the hassle with having to make the secret key available inside the Julia process and might therefore be more secure?
Schermopname.2023-03-30.om.14.35.21.mov