How to build an AI Coding Assistant with BoltAI
Build your own AI Assistants in 2 minutes
Last updated
Build your own AI Assistants in 2 minutes
Last updated
BoltAI's inline feature is very powerful. It allows you create your own AI Assistants that work across multiple mac apps.
In this post, I'm going to build an AI Coding Assistant called Gilfoyle AI with BoltAI
PREREQUISITE:
This feature requires the macOS Accessibility Permission. If you haven't granted the permission yet, follow this guide.
This is the preferred way to create an AI Assistant. To start, go to Settings > Commands. Click the Plus button at the bottom left, and fill the form as follow:
Label: Give it a friendly name. Let's call him "Gilfoyle AI".
Template: Enter the prompt template. I use a this simple prompt template below.
Behavior: Select "Replace current selection".
API Provider & Model: Select the AI service & model you want to use. Personally, I find Claude 3.5 Sonnet is the best at coding tasks.
Icon: Give it an easy to recognize icon.
Click "Add Command"
Promtp Template:
Sweet. Now you should find the newly added AI Command. Double-clicking it to edit advanced configurations. Assign a keyboard shortcut to this command. I use Command+Shift+Option+G
Now your Gilfoyle AI is ready to use. Open your favorite text editor and find the piece of code you want to help with.
Write your prompt in the comment section.
Highlight your prompt and relevant code.
Press the trigger keyboard you set previously. BoltAI should show a loading indicator and paste the AI answer back in the editor.
In this demo video, I convert the whole file from JavaScript to TypeScript in VSCode. I've tested with multiple other text editors, including Xcode and Android Studio. If it doesn't work on your favorite editor, please let me know.
So you're a power user? No problem. BoltAI allows you to customize multiple parameters to tweak the AI response to your liking.
Edit the AI Command, navigate to tab "Advanced". Here you can customize the System Instruction, other GPT paramers such as temperature
, max tokens
and others...
After you trigger the keyboard shortcut, BoltAI does the following:
BoltAI reads the content you've highlighted. It may use either Accessibility API or Clipboard API to do it. You can customize this behavior per app in Settings > Advanced > App Specific Settings.
It takes your Prompt Template and replaces the placeholder {input} with the highlighted text. Protip: you can use {clipboard} placeholder for content in your clipboard instead.
Then it sends the request to the AI service/model that we've configured.
Then finally, it attempts to paste the AI answer back into the original app.
Have a wonderful weekend 👋