jetbrains junie

I had a coupon code for JetBrains Junie AI Ultimate for a year. I set it up last month and have been using it a good bit.

How setup went

First I installed the Junie plugin. After accepting the license, I went to:

help > register – click disabled paid plugins > click JetBrains AI Assistant > Enable and restart

Then I clicked the three dots and license info which took me to the website. I had to click buy on AI ultimate and enter the code. I’m guessing I could have started on that page.

My first test

As a simple use case, I asked JUnie to create a package with two examples. Junie gave me a plan and the two examples:

Create com.jeanneboyarsky.scoped package with immutability examples.

Explore repository to confirm coding style and package naming conventions.

  1. Create new package directory src/com/jeanneboyarsky/scoped with two classes:
  2. Ensure examples are self-contained with main methods printing illustrative output.
  3. Note compilation requirements: document that JDK 21 needs –enable-preview, while JDK 22+ compiles normally.
  4. Provide summary and submit changes.

then listed summary for each class

A new Java class has been created to demonstrate that ScopedValue bindings are immutable within their scope. The implementation highlights that reassignment attempts are not permitted due to ScopedValue being a preview API.

A new Java file has been created to demonstrate that while a ScopedValue’s binding is immutable, the underlying object can be mutable. The code successfully illustrates mutating a Map within scoped values, while also handling scope boundaries.

Finally listed two two classes it created with a link to rollback if i don’t like
A new package com.jeanneboyarsky.scoped was created with two classes: ScopedImmutable1 demonstrates the immutability of ScopedValue bindings, and ScopedMapMutable1 shows that the contents of a mutable Map inside a ScopedValue can be changed. The code compiles for JDK 21+ but lacks automated tests.

In PyCharm

The license is good for all JetBrains products so I tried it in PyCharm as well.

Create a file named junie.py that plays tic tac toe. However instead of X and O, use Unicode symbols for unicorn and wolf. Also have the computer player use a strategy with a low win rate.

The generated code was concise and clear. It used Python idioms. It was well commented. Junie decided to implement my request for a low win rate with this strategy:

# Strategy intentionally weak:
# 1) 60% of the time: choose random move outright.
# 2) 40% of the time: attempt some light heuristics but also sometimes skip blocks/wins.
# Light heuristics section (still weak)
# a) occasionally avoid taking a direct win to stay weak
# b) occasionally block human, but not always
# c) mild preference for center, but not strong
# d) otherwise random corner or side

I ran the code and it works. And won’t frustrate a small child.

Generating Docs

I’m presenting an updated version of “Java Does What Now.” I created an IntelliJ project with packages for each of the examples in my presentation. After I was done, I asked Junie to create a readme to document the unexpected behaviors exhibited by the code.

It didn’t always get it right, for example telling me the module import was invalid. But that’s a new feature so not one it’s been trained on. But overall it did a good job.

[uberconf 2023] Practical AI Tools for Java Developers

Speaker: Ken Kousen

@kenkousen

For more, see the table of contents


Prompt Engineering

  • Tools are improving fast, might not be needed as job
  • Suggest context (ex: “pretend you are”)
  • Give example of what you want

Chat GPT

  • Free version is GPT 3.5 Turbo (improved performance over original 3.5)
  • $20/month for GPT 4. Can make 25 requests in a three hour block.
  • Have not noticed quality control over plugins.
  • Plugins change rapidly.
  • Apologizes when you correct it.
  • Warning about pasting your company’s code in
  • Trained thru summer 2021
  • Can’t read files on local file system (Bard can). Can read link but doesn’t know it can
  • Often wrong if you ask it about whether can do something. Like talking to toddler; says want thinks want to know.
  • Temperature – tweaks creativity vs precision
  • REST API docs
  • REST API: cookbook has examples
  • Must give credit card to call REST APIs. Pennies are for 1000 tokens (about 750 words). Charged for both input and output words. Also limits on context (amount GPT remembers). Not expensive if don’t use it much. Ken’s bill has been pennies and too low to be sent a bill.
  • REST API JSON response says how many tokens used. Can also see graph when log into account
  • Had it make multiple choice questions on a topic

Chat GPT Code Interpreter

  • Code Interpreter beta feature.
  • Need to explicitly enable under settings.
  • From OpenAI, not third party
  • ex: can convert Groovy to Kotlin DSL for Gradle

DALL-E

  • First popular text to image generation tool
  • A generation behind text/GPT.
  • Stable Diffusion free, but behind on quality
  • Prefers MidJourney, more realistic

Whisper

  • Audio to text
  • Takes audio or video and writes transcription.
  • Free (unless use REST API)
  • Mac Whisper – $20 on time fee for larger models. Good for transcribing videos of talks. Slow first time. After that (including other videos, fast. [caching?]
  • Creates .srt file (Subtitles)

Claude.AI

  • Free beta
  • Only available in US and UK
  • Can hold 100K tokens. ex: can summarize a novel
  • Quality comparable to ChatGPT 3.5, but not as good as 4.0
  • Can upload many file types
  • Harder to get back to previous conversations than ChatGPT. Need to click on “A” icon on top to see them
  • Doesn’t do image

Bard

  • Can upload answers to Google docs on Ken’s personal account, but not business account
  • Used to be able to answer who Venkat is but can’t anymore.

Llama 2

  • Meta announced today
  • Pretrained language model
  • Free unless large company (aka: competitors)

Descript

  • Transcribes and edits video
  • Can give instructions – ex: shorten gaps in video, remove filler words
  • If don’t move around much, will make it look like you are looking at camera
  • Can give text and select a voice. With 30 minute sample, can train on your voice

Canva

  • Can describe presentation want and Canva makes a draft
  • Can choose theme from list of choices
  • Magic eraser – brush over part of image don’t want and replaces with background nearby
  • Beats Sync – line of slide transition to beats of music
  • Magic Write – like GPT 3.5
  • Magic Design – give own image and make presentation around that

GitHub Copilot

  • Virtual pair programmer
  • Plugins for VSCode and IntelliJ
  • If hesitate, suggests code
  • Can’t agree to part of suggestion. Need to accept it all or delete
  • Guesses right a lot because knows what have done before in a training class
  • Always looks plausible because trained on own code. Need to look carefully
  • Next generation is GitHub CopilotX. Only available via wait list. VS Code only at this point, can use for pull requests.
  • GitHub Next – tools in a variety of states – https://githubnext.com. “Visualizing a Codebase” runs as github action to see packages

IntelliJ AI Assistant

  • Not much documentation on how it works. Only one blog post
  • In Ultimate, not Community
  • In beta edition
  • Can highlight code and ask to explain it
  • If don’t like suggestion, can request it suggests something else and get more choices
  • Can write commit message for you
  • Find issues with code when know language well
  • Helps in language know less well because it knows the API/syntax
  • Good for nuisance tasks that would take a lot of time

YouTube Summary

  • Get summary or transcript of video
  • Free
  • Up to 20 minute video

My take

I was doing my interview with the Build Propulsion Lab so was a few minutes late. It was a full room so my seat was on the floor. Luckily, the room had a large aisle so I could sit near the front instead of in the very back! And the carpet was comfy.

As far as Ken’s actual talk, it was great. I liked the overview of a bunch of tools and seeing the REST APIs for calling OpenAI. Great breath of topics and fun examples! I learned a lot including some tools I hadn’t heard of. And some very cool functionality!