[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!

[2023 kcdc] chatgpt: don’t take my job, help me thrive in it

Speaker: Steve Odell

For more, see the table of contents.


Timeline

  • 1940 – enigma
  • 1964 – first chat bot
  • mid 2022 – GitHub co-pilot came out
  • Then ChatGPT 3.5
  • Panic about AI taking all our jobs

Survey

  • Most people in room used ChatGPT
  • A few used Bard
  • A good number use GitHub Co-Pilot

1969

  • Had ChatGPT write a story about ATMs rendering bank tellers obsolete
  • It was well written
  • Talked about roles evolving
  • Also covered analogy to ChatGPT and talking about enhancing capabilities

Takeaways

  • Not going to take our jobs
  • Can let you down just as much as it impresses you
  • Do not take at face value
  • Often apologizes when wrong and wrong a lot

Examples

  • Lawyer used ChatGPT which made up cases. Used real case numbers but unrelated – https://simonwillison.net/2023/May/27/lawyer-chatgpt/
  • Asked for a C# function to calculate the points in a bridge hand. Gave it the rules in a prompt and a description about the notation. Quickly provided code that looks reasonable on first glance. When tested code, got wrong answer – 18 points, for a 20 point hand. ChaptGPT also wrote a bulleted list explaining logic and got 20 points in explanation, but not code. Realizes messed up and explains why wrong in a way that conflicts with the explanation.
  • Succeeded at codegolf – rewriting code in less lines.
  • Tried to get to write infrastructure as code. First gave approach to set up cloud formation for a high level description of what want for AWS. Did good job listing AWS services need and short description of each. Then asked to create the cloud formation templates listing services. Gave a stub of the yaml leaving out all the hard parts. Ex # VPC properties. Then tried one at a time and didn’t tie them together..
  • On the next example for an OAUTH workflow in Maui, ChatGPT just said can’t do it and provided a basic login page which was nothing like what asked for. Thinks not enough code as training data. New and lot of code is internal to companies.’
  • Repeated example in Reactive Native. Didn’t test, but looks much better; includes OAUTH workflow and expected parts.

Prompt engineering

  • Some companies are hiring prompt engineers
  • Skill set we should all learn
  • Tried getting SQL for a recipe app. Asked for table with create table scripts listing fields want and more about each. Did good job on keys and not null constraints. Unit of measure was vararg rather than numeric. Did right when asked for a units of measure table.
  • Chaining prompts in the same discussion gets to where want.

My take

Standing room only crowd. I got there very early (because I needed to leave at the 30 minute mark) and was barely able to get an aisle seat. [I misread the calendar and have a work presentation at 11am eastern].

The first half of the presentation was excellent. The examples were clear and run. Gave an excellent sense of the current state of AI. The beginnings of the prompt engineering section was great as well. I wish I could have stayed for the rest.

playing with chatgpt – new years eve edition

I wrote up a blog post on Christmas with some of my ChatGPT playing. On New Years Eve, I was on a Zoom call with some friends. One of whom played a bunch with ChatGPT. The others hadn’t heard of it so we did some group playing with ChatGPT. Here’s how it went

PromptThoughts
tell me a joke about new years and zebrasIt was cute. Fits my expectations
write me an essay about shakespeareChatGPT wrote four paragraphs. It wasn’t bad. If someone was trying to get ChatGPT to do their homework, a more specific prompt would be needed
who is jeanne boyarskyI tried a few times and it wouldn’t give me an answer about a specific person. Which is interesting becaues i
write a sonnet about new years and the color blueMet the requirements
write a love letter to mickey mouse and winnie the poohThis was great. Pooh got honey and a bear hug.
write an email to a coworker you hate about a meeting“I’m sorry, but I am unable to complete this prompt as it goes against my programming to create content that is offensive or harmful.” – nice
write an email to a coworker about a disagreementThis one worked. It suggested a meeting to sit down and discuss respectfully.
write a haiku about calculus“Calculus, the math of change
Variables in motion’s range
Derivatives, integrals, infinite sums”
A haiku seems hard to tell if a person wrote it or a computer.
write a limerick about something amusing“There once was a man from Peru
Who liked to do things out of the blue
He’d stand on his head
And dance in his bed
While singing a tune out of tune.”
That works
prove the pythagorean themeWe got a proof. Sorta. First of all, good job on noticing I meant “theorem” and not “theme”. It used asy markup and included things like label(“$a$”, A–C, N);. I don’t know what asy markup is so it looked like a lot of text. A math teacher on the call said it wasn’t really right. Which I’ve seen a bunch of comments that things seem close but not quite.
write a dialog about birthdays from sesame street andThis was adorable. Elmo is three and that got mentioned in fact and tone.
write a dialog about birthdays from elmos on sesame street to james for his fifth birthdayAlso adorable. ChatGPT picked up on the fact that it is James turning five and not Elmo. (Elmo is three)
explain why 3+5 is an odd numberChatGPT starts out with “3+5 is an odd number because it is not divisible by 2”. 3=5 is 8 which is not an odd number so this is wrong.

But then it gets it right at the end with “When we add two odd numbers together, the result is always an even number because the remainders cancel out. For example, 3 + 5 = 8, which is an even number.”
is gamma rational or irrational?I didn’t even remember what gamma was (we had some math teachers on the call), but ChatGPT noted it is not possible to tell because infinite.. And then explained what gamma is and the beginning of its value.
write a c++ program to calculate a factorialThe code was good. Only part of it was in a code block which was weird.
how do i get from little neck to forest hills?There were both driving directions and public transport directions.
“Take the Q12 bus from Little Neck to Union Turnpike / Queens Boulevard.
Transfer to the E or F train at Union Turnpike / Queens Boulevard.
Take the E or F train to 71st Avenue station in Forest Hills.”
Step 1 is wrong. the Q12 doesn’t go to Union Turnpike/Queens Blvd. It goes to Flushing where you take the 7 to transfer to the E/F. Or you can take the Q12 to the Q46 which does go to Union Turnpike/Queens Blvd.

We thought maybe it got confused because we listed communities instead of specific locations. So we tried again.
how do i get from the commonpoint in little neck to commonpoint in forest hills?The public transport directions were
“Walk to the Little Neck LIRR station on Northern Boulevard.
Take the LIRR Port Washington line to Penn Station.
Transfer to the E or F train at Penn Station.
Take the E or F train to 71st Avenue station in Forest Hills.
Walk to the Commonpoint at Forest Hills, located at 108-25 62nd Drive.”

This is a terrible way of going. First the LIRR station is a long walk. Also the LIRR runs infrequently and has you going from Queens to Manhattan and all the way back to Queens. The correct way of going is to take the Q30 to Jamaica and then change to the F to Forest Hills. We gave it one more try on transit
how do i get from forest hills to the queens center mallThis one should be easier. The correct answer is you take the R train three stops. Instead we got
“From Forest Hills, take the E or F train to the Sutphin Boulevard / Archer Avenue / JFK Airport station.
Transfer to the E, J, or Z train at Sutphin Boulevard / Archer Avenue / JFK Airport.
Take the E, J, or Z train to the Queens Center Mall station.”
There is so much wrong here. The main problem is that the J and Z never go to the Queens Center Mall station. And the E only does on weekends. The other problem is they have you going the wrong way to double back to where you started.
write a sestina about times square 2023 for new years eve and the ballThis one stumped ChatGPT. The ouput did not follow the rules for words ending on certain lines.
write a poem in taiwanese about new yearsThen we tried languages. We learned ChatGPT does not know Taiwanese or Mandarin. (We started with languages someone on the Zoom can read fluently to have a chance of knowing if the output was right.
write a poem about new years in frenchWe got a poem and it was in French. I took French in high school. I don’t remember a lot but it definitely has some relevant words in there.
write a reference using apa style (american psych association style) on new years eve

write a APA style for a book on new years celebratoins

compare democrats and republicans. use apa style for citations

compare democrats and republicans using three sources and apa style
It took us four prompts but we got something useful (superficial, but in the right format)