News for hackers. Stuff that matters.
Re:Claude 3 model family by simonw on Monday March 04, 2024 @10:56AM (#39591896)
I just released a plugin for my LLM command-line tool that adds support for the new Claude 3 models:

    pipx install llm
    llm install llm-claude-3
    llm keys set claude
    # paste Anthropic API key here
    llm -m claude-3-opus '3 fun facts about pelicans'
    llm -m claude-3-opus '3 surprising facts about walruses'
Code here: https://github.com/simonw/llm-claude-3

More on LLM: https://llm.datasette.io/

Re:Claude 3 model family by eliya_confiant on Monday March 04, 2024 @11:31AM (#39592297)
Hi Simon,

Big fan of your work with the LLM tool. I have a cool use for it that I wanted to share with you (on mac).

First, I created a quick action in Automator that recieves text. Then I put together this script with the help of ChaptGPT:

        escaped_args=""
        for arg in "$@"; do
          escaped_arg=$(printf '%s\n' "$arg" | sed "s/'/'\\\\''/g")
          escaped_args="$escaped_args '$escaped_arg'"
        done

        result=$(/Users/XXXX/Library/Python/3.9/bin/llm -m gpt-4 $escaped_args)

        escapedResult=$(echo "$result" | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | awk '{printf "%s\\n", $0}' ORS='')
        osascript -e "display dialog \"$escapedResult\""
Now I can highlight any text in any app and invoke `LLM` under the services menu, and get the llm output in a nice display dialog. I've even created a keyboard shortcut for it. It's a game changer for me. I use it to highlight terminal errors and perform impromptu searches from different contexts. I can even prompt LLM directly from any text editor or IDE using this method.
Re:Claude 3 model family by simonw on Monday March 04, 2024 @12:28PM (#39593130)
That is a brilliant hack! Thanks for sharing. Any chance you could post a screenshot of the Automator workflow somewhere - I'm having trouble figuring out how to reproduce (my effort so far is here: https://gist.github.com/simonw/d3c07969a522226067b8fe099007f...)
Re:Claude 3 model family by eliya_confiant on Monday March 04, 2024 @12:50PM (#39593480)
I added some notes to the gist.
Re:Claude 3 model family by simonw on Monday March 04, 2024 @01:24PM (#39593952)
Thank you so much!
Re:Claude 3 model family by behnamoh on Monday March 04, 2024 @12:18PM (#39592970)
I use Better Touch Tool on macOS to invoke ChatGPT as a small webview on the right side of the screen using a keyboard shortcut. Here it is: https://dropover.cloud/0db372
Re:Claude 3 model family by dcreater on Tuesday March 05, 2024 @09:25AM (#39603819)
Why not BTTs in built tool to query Chatgpt with the highlighted text?
Re:Claude 3 model family by spdustin on Monday March 04, 2024 @11:35AM (#39592348)
Hey, that's really handy. Thanks for sharing!
Re:Claude 3 model family by fragmede on Tuesday March 05, 2024 @06:25AM (#39602017)
have you tried http://openinterpreter.com? it takes that a step further
Re:Claude 3 model family by laylower on Tuesday March 05, 2024 @07:51AM (#39602655)
That is really cool, but for it to be useful you'd need:

1) Some safeguards re privacy and data ownership. Do you just send the file to the web? Do you run everything locally? 2) Can open interpreter be used with voice? So, what if I don't want to type but I want to dictate?

Re:Claude 3 model family by arendtio on Tuesday March 05, 2024 @01:29PM (#39607394)
Does someone know a similar tool like Automator on Linux for this particular use case?
Re:Claude 3 model family by c6401 on Wednesday March 06, 2024 @04:40AM (#39614096)
So one of the ways how it can be done is: In linux (at least in gnome) it's possible to bind any app or script to a custom global hotkey, plus xclip has access to the currently selected text and zenity can be used to display the result. So it's possible to do it just using bash script bound to a global hotkey.
Re:Claude 3 model family by arendtio on Friday March 08, 2024 @11:59AM (#39643043)
Thanks, xclip was the tool I was looking for. Sadly I switched to Plasma 6 two days ago and Wayland doesn't seem to have a similar tool (wl-paste just reads from the clipboard and not from the selected text).

After so many years, Wayland is still such a mess...

Re:Claude 3 model family by c6401 on Saturday March 09, 2024 @09:39AM (#39651844)
You might want to try to send ctrl+c (using something like xdotool or ydotool) to the app to copy the current selection to the clipboard and then to extract clipboard contents to use it in a script.
Re:Claude 3 model family by arendtio on Sunday March 10, 2024 @09:05AM (#39658718)
Thanks again. I changed my Klipper configuration (the KDE clipboard application) to synchronize selection and clipboard. In addition, I added a global shortcut (F1) to execute this little script:

https://bpa.st/WORA

It reads the clipboard (equal to the current selection) via wl-paste and sends a request to the Claude API via curl. Finally, it filters the response with jq (very crude) and displays it with notify-send. I have a second version of the script that sends the result via XMPP to Gajim because the answers can be quite long.

I think the experience should be similar to the one on MacOS.

Re:Claude 3 model family by simonw on Monday March 04, 2024 @01:30PM (#39594049)
Updated my Hacker News summary script to use Claude 3 Opus, first described here: https://til.simonwillison.net/llms/claude-hacker-news-themes

    #!/bin/bash
    # Validate that the argument is an integer
    if [[ ! $1 =~ ^[0-9]+$ ]]; then
      echo "Please provide a valid integer as the argument."
      exit 1
    fi
    # Make API call, parse and summarize the discussion
    curl -s "https://hn.algolia.com/api/v1/items/$1" | \
      jq -r 'recurse(.children[]) | .author + ": " + .text' | \
      llm -m claude-3-opus -s 'Summarize the themes of the opinions expressed here.
      For each theme, output a markdown header.
      Include direct "quotations" (with author attribution) where appropriate.
      You MUST quote directly from users when crediting them, with double quotes.
      Fix HTML entities. Output markdown. Go long.'

Here's the result of running that against this 300+ comment thread:

    ./hn-summary.sh 39590666
Response: https://gist.github.com/simonw/37781de39fb5555f39b4157a8ad07...
Re:Claude 3 model family by dheera on Monday March 04, 2024 @10:48PM (#39599201)
> # paste Anthropic API key here

Considering Anthropic API keys seem to be free to create I wonder if this part could be automated too using a headless chrome browser. It would be one less annoyance and allow a proliferation of other software that could just be pipped or apt-gotten and "just work" but now there's this one annoying human step.

Bonus points if when usage is nearing API limits, it uses the GPU to mine a small amount of bitcoin and use that to pay for more API capacity 100% autonomously without user intervention. We're in the AI era after all, it's about time computers did things on their own.

Re:Claude 3 model family by vladstudio on Tuesday March 05, 2024 @04:37AM (#39601217)
If you use Raycast on Mac, you can create a custom script and use it to talk to LLM cli via Raycast interface:

https://gist.github.com/vladstudio/92efe283453f5f22d4606947b...