20 November 2023
PromptingTools.jl is your gateway to buying back valuable time. Just a few cents can now liberate you from the tedium of repetitive tasks, leaving you free to focus on what truly matters.
Installing PromptingTools.jl is a breeze. Ensure Julia is installed on your system, and add the package via the Julia REPL with ]add https://github.com/svilupp/PromptingTools.jl
. This package is designed to be user-friendly, catering to both beginners and seasoned programmers.
To use PromptingTools.jl, obtain an OpenAI API key by signing up at OpenAI. Then, set it as an environment variable in Julia: ENV["OPENAI_API_KEY"] = "your-api-key"
.
For detailed guidance on setting persistent environment variables, refer to these links for Windows (see "Windows Set-up") and Unix/Linux.
String Manipulation:
using PromptingTools
msg = aigenerate("Rewrite this sentence in a formal tone: {{sentence}}"; sentence="Hey, what's up?")
Data Extraction:
# Define a custom return type
"Individual hashtag"
struct HashTag
tag::String
end
struct HashTags
tags::Vector{HashTag}
end
msg = aiextract("Extract individual hashtags from this tweet: 'I love #JuliaLang and #GenerativeAI!'"; return_type = HashTags)
Image OCR:
# gpt4v is an alias for GPT-4 Vision
msg = aiscan("Transcribe the text in the provided image.", image_path="path_to_image.jpg", model="gpt4v")
Asking Questions:
# alias gpt4t is optional. It will forward the query to the most powerful GPT-4 Turbo model
ai"In Julia, what's the use case for a Channel?"gpt4t
Prompt Templates:
aitemplates("OCR")
PromptingTools.jl offers a variety of functions including aigenerate
, aiextract
, aiclassify
, and aiscan
. Each is tailored for specific tasks, ranging from generating content to working with images. Moreover, there are pre-defined prompt templates for common tasks - find the best one with aitemplates
. Explore the documentation to learn more about these functions and how they can transform your workflow.
Start your AI-powered journey in Julia with PromptingTools.jl and discover a new realm of possibilities!